]> Repositorios git - scryer-prolog.git/commitdiff
DOC: convert library(sgml) documentation to DocLog format
authorMarkus Triska <[email protected]>
Tue, 24 Jan 2023 21:42:58 +0000 (22:42 +0100)
committerMarkus Triska <[email protected]>
Tue, 24 Jan 2023 21:42:58 +0000 (22:42 +0100)
src/lib/sgml.pl

index a0370e8c293090e76c24032330345a2bb40260c9..bccba1f390493188353d0e49280fe447c8da6a98 100644 (file)
@@ -2,56 +2,69 @@
    Predicates for parsing HTML and XML documents.
    Written 2020-2022 by Markus Triska ([email protected])
    Part of Scryer Prolog.
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-   Currently, two predicates are provided:
+/** Predicates for parsing HTML and XML documents.
 
-     -  load_html(+Source, -Es, +Options)
-     -  load_xml(+Source, -Es, +Options)
+Currently, two predicates are provided:
 
-   These predicates parse HTML and XML documents, respectively.
+  -  `load_html(+Source, -Es, +Options)`
+  -  `load_xml(+Source, -Es, +Options)`
 
-   Source must be one of:
+These predicates parse HTML and XML documents, respectively.
 
-     - a list of characters with the document contents
-     - stream(S), specifying a stream S from which to read the content
-     - file(Name), where Name is a list of characters specifying a file name.
+Source must be one of:
 
-   Es is unified with the abstract syntax tree of the parsed document,
-   represented as a list of elements where each is of the form:
+  - a list of characters with the document contents
+  - `stream(S)`, specifying a stream S from which to read the content
+  - `file(Name)`, where Name is a list of characters specifying a file name.
 
-     * a list of characters, representing text
-     * element(Name, Attrs, Children)
-       - Name, an atom, is the name of the tag
-       - Attrs is a list of Key=Value pairs:
-         Key is an atom, and Value is a list of characters
-       - Children is a list of elements as specified here.
+Es is unified with the abstract syntax tree of the parsed document,
+represented as a list of elements where each is of the form:
 
-   Currently, Options are ignored. In the future, more options may be
-   provided to control parsing.
+  * a list of characters, representing text
 
-   Example:
+  * `element(Name, Attrs, Children)`
 
-      ?- load_html("<html><head><title>Hello!</title></head></html>", Es, []).
+    - `Name`, an atom, is the name of the tag
 
-   Yielding:
+    - `Attrs` is a list of `Key=Value` pairs:
+      `Key` is an atom, and `Value` is a list of characters
 
-         Es = [element(html,[],
-                [element(head,[],
-                  [element(title,[],
-                    ["Hello!"])]),
-                 element(body,[],[])])].
+    - `Children` is a list of elements as specified here.
 
-   library(xpath) provides convenient reasoning about parsed documents.
-   For example, to fetch the title of the document above, we can use:
+Currently, Options are ignored. In the future, more options may be
+provided to control parsing.
 
-      ?- load_html("<html><head><title>Hello!</title></head></html>", Es, []),
-         xpath(Es, //title(text), T).
+Example:
 
-   Yielding T = "Hello!".
+```
+   ?- load_html("<html><head><title>Hello!</title></head></html>", Es, []).
+```
 
-   Use http_open/3 from library(http/http_open) to read answers from
-   web servers via streams.
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+Yielding:
+
+```
+      Es = [element(html,[],
+             [element(head,[],
+               [element(title,[],
+                 ["Hello!"])]),
+              element(body,[],[])])].
+```
+
+`library(xpath)` provides convenient reasoning about parsed documents.
+For example, to fetch the title of the document above, we can use:
+
+```
+   ?- load_html("<html><head><title>Hello!</title></head></html>", Es, []),
+      xpath(Es, //title(text), T).
+```
+
+Yielding `T = "Hello!"`.
+
+Use `http_open/3` from `library(http/http_open)` to read answers from
+web servers via streams.
+*/
 
 :- module(sgml, [load_html/3,
                  load_xml/3]).