]> gitweb.factorcode.org Git - factor.git/commitdiff
xml.data-docs: update the documentation formatting and add links
authorAlexander Ilin <alex.ilin@protonmail.com>
Thu, 17 Aug 2023 20:37:25 +0000 (22:37 +0200)
committerAlexander Ilin <alex.ilin@protonmail.com>
Thu, 17 Aug 2023 20:38:34 +0000 (22:38 +0200)
basis/xml/data/data-docs.factor

index 9f599293a81ec55fa05e4e84c1df4c9bba2d4480..f5103b83020250966a6627ae30f31843713745b4 100644 (file)
@@ -62,126 +62,178 @@ ARTICLE: { "xml.data" "constructors" } "XML data constructors"
 
 HELP: tag
 { $class-description "Tuple representing an XML tag, delegating to a " { $link
-name } ", containing the slots attrs (an alist of names to strings) and children (a sequence). Tags implement the sequence protocol by acting like a sequence of its chidren, and the assoc protocol by acting like its attributes." }
-{ $see-also <tag> name contained-tag xml } ;
+name } ", containing the following slots:"
+{ $slots
+    { { $slot "attrs" } "an alist of names to strings" }
+    { { $slot "children" } { "a " { $link sequence } } } }
+"Tags implement the " { $link "sequence-protocol" }
+" by acting like a sequence of its chidren, and the "
+{ $link "assocs-protocol" } " for getting and setting their attributes." } ;
 
 HELP: <tag>
-{ $values { "name" "an XML tag name" }
+{ $values { "name" { "an XML tag " { $link name } } }
     { "attrs" "an alist of names to strings" }
     { "children" sequence }
     { "tag" tag } }
-{ $description "Constructs an XML " { $link tag } " with the name (not a string) and tag attributes specified in attrs and children specified." }
-{ $see-also tag <contained-tag> } ;
+{ $description "Constructs an XML " { $link tag } " with the " { $link name }
+" (not a string) and tag attributes specified in the given "
+{ $snippet "attrs" } " and " { $snippet "children" } "." } ;
 
 HELP: name
-{ $class-description "Represents an XML name, with the fields space (a string representing the namespace, as written in the document, tag (a string of the actual name of the tag) and url (a string of the URL that the namespace points to)." }
-{ $see-also <name> tag } ;
+{ $class-description "Represents an XML name, with the following slots:"
+    { $slots
+        { { $slot "space" }
+            "an optional string representing the namespace, as written in the document," }
+        { { $slot "main" } "a string with the actual tag name," }
+        { { $slot "url" } "an optional string with the URL that the namespace points to." } } } ;
 
 HELP: <name>
 { $values { "space" string } { "main" string } { "url" string }
-    { "name" "an XML tag name" } }
-{ $description "Creates a name tuple with the namespace prefix space, the the given main part of the name, and the namespace URL given by url." }
-{ $see-also name <tag> } ;
+    { "name" { "an XML tag " { $link name } } } }
+{ $description "Creates a " { $link name } " tuple with the namespace prefix "
+{ $snippet "space" } ", the given " { $snippet "main" }
+" part of the name, and the namespace URL given by " { $snippet "url" } "." } ;
+
+{ name <name> <simple-name> } related-words
 
 HELP: contained-tag
-{ $class-description "This is a subclass of " { $link tag } " consisting of tags with no body, like " { $snippet "<a/>" } "." }
-{ $see-also tag <contained-tag> } ;
+{ $class-description "This is a predicate class of " { $link tag }
+"s with no body, e.g. " { $snippet "<a/>" } "." }
+{ $notes "The tags created with " { $link <tag> } " initially satisfy this predicate." } ;
 
 HELP: <contained-tag>
-{ $values { "name" "an XML tag name" }
+{ $values { "name" { "an XML tag " { $link name } } }
     { "attrs" "an alist from names to strings" }
     { "tag" tag } }
-{ $description "Creates an empty tag (like " { $snippet "<a/>" } ") with the specified name and tag attributes." }
-{ $see-also contained-tag <tag> } ;
+{ $description "Creates an empty tag (like " { $snippet "<a/>" } ") with the specified " { $snippet "name" } " and " { $snippet "tag" } " attributes." } ;
+
+HELP: open-tag
+{ $class-description "This is a predicate class of " { $link tag }
+"s with children, i.e. the opposite of a " { $link contained-tag } "." } ;
+
+{ tag <tag> contained-tag <contained-tag> open-tag } related-words
 
 HELP: xml
-{ $class-description "Tuple representing an XML document, delegating to the main tag, containing the fields prolog (the header " { $snippet "<?xml...?>" } "), before (whatever comes between the prolog and the main tag) and after (whatever comes after the main tag)." }
-{ $see-also <xml> tag prolog } ;
+{ $class-description "Tuple representing an XML document, delegating to the main tag, containing the following slots:"
+{ $slots
+    { { $slot "prolog" } { "the " { $link prolog } " header " { $snippet "<?xml...?>" } } }
+    { { $slot "before" } { "whatever comes between the " { $slot "prolog" } " and the main tag" } }
+    { { $slot "body" } { "contains the main " { $link tag } " itself" } }
+    { { $slot "after" } "whatever comes after the main tag" } } } ;
 
 HELP: <xml>
-{ $values { "prolog" "an XML prolog" } { "before" "a sequence of XML elements" }
+{ $values { "prolog" "an XML " { $link prolog } } { "before" "a sequence of XML elements" }
 { "body" tag } { "after" "a sequence of XML elements" } { "xml" "an XML document" } }
-{ $description "Creates an XML document. The " { $snippet "before" } " and " { $snippet "after" } " slots store what comes before and after the main tag, and " { $snippet "body" } " contains the main tag itself." }
-{ $see-also xml <tag> } ;
+{ $description "Creates an XML document. The " { $slot "before" } " and "
+{ $slot "after" } " slots store what comes before and after the main tag, and "
+{ $slot "body" } " contains the main tag itself." } ;
+
+{ xml <xml> } related-words
 
 HELP: prolog
-{ $class-description "represents an XML prolog, with the tuple fields version (containing \"1.0\" or \"1.1\"), encoding (a string representing the encoding type), and standalone (t or f, whether the document is standalone without external entities)" }
-{ $see-also <prolog> xml } ;
+{ $class-description "Represents an XML prolog, with the following slots:"
+{ $slots
+    { { $slot "version" } "containing \"1.0\" or \"1.1\"" }
+    { { $slot "encoding" } { "a " { $link string } " representing the encoding type" } }
+    { { $slot "standalone" } { "a " { $link boolean } ", whether the document is standalone without external entities" } } } } ;
 
 HELP: <prolog>
-{ $values { "version" "a string, 1.0 or 1.1" }
-{ "encoding" string } { "standalone" boolean } { "prolog" "an XML prolog" } }
-{ $description "Creates an XML prolog tuple." }
-{ $see-also prolog <xml> } ;
+{ $values
+    { "version" "a string: \"1.0\" or \"1.1\"" } { "encoding" string }
+    { "standalone" boolean } { "prolog" "an XML " { $link prolog } } }
+{ $description "Creates an XML " { $link prolog } " tuple." } ;
+
+{ prolog <prolog> } related-words
 
 HELP: comment
-{ $class-description "Represents a comment in XML. This tuple has one slot, " { $snippet "text" } ", which contains the string of the comment." }
-{ $see-also <comment> } ;
+{ $class-description "Represents a comment in XML. This tuple has one slot, "
+{ $slot "text" } ", which contains the comment " { $link string } "." } ;
 
 HELP: <comment>
 { $values { "text" string } { "comment" comment } }
-{ $description "Creates an XML " { $link comment } " tuple." }
-{ $see-also comment } ;
+{ $description "Creates an XML " { $link comment } " tuple." } ;
+
+{ comment <comment> } related-words
 
 HELP: instruction
-{ $class-description "Represents an XML instruction, such as " { $snippet "<?xsl stylesheet='foo.xml'?>" } ". Contains one slot, " { $snippet "text" } ", which contains the string between the question marks." }
-{ $see-also <instruction> } ;
+{ $class-description "Represents an XML instruction, such as "
+{ $snippet "<?xsl stylesheet='foo.xml'?>" } ". Contains one slot, "
+{ $slot "text" } ", which contains the string between the question marks." } ;
 
 HELP: <instruction>
-{ $values { "text" string } { "instruction" "an XML instruction" } }
-{ $description "Creates an XML parsing instruction, like " { $snippet "<?xsl stylesheet='foo.xml'?>" } "." }
-{ $see-also instruction } ;
+{ $values { "text" string } { "instruction" "an XML " { $link instruction } } }
+{ $description "Creates an XML parsing instruction, like " { $snippet "<?xsl stylesheet='foo.xml'?>" } "." } ;
+
+{ instruction <instruction> } related-words
 
 HELP: opener
-{ $class-description "Describes an opening tag, like " { $snippet "<a>" } ". Contains two slots, " { $snippet "name" } " and " { $snippet "attrs" } " containing, respectively, the name of the tag and its attributes." } ;
+{ $class-description
+"Describes an opening tag, like " { $snippet "<a>" } ". Contains two slots:"
+{ $slots
+    { { $slot "name" } { "the " { $link name } " of the tag" } }
+    { { $slot "attrs" } "the tag attributes" } } } ;
 
 HELP: closer
-{ $class-description "Describes a closing tag, like " { $snippet "</a>" } ". Contains one slot, " { $snippet "name" } ", containing the closer's name." } ;
+{ $class-description
+"Describes a closing tag, like " { $snippet "</a>" } ". Contains one slot:"
+{ $slots { { $slot "name" } "contains the closer's name." } } } ;
 
 HELP: contained
-{ $class-description "Represents a self-closing tag, like " { $snippet "<a/>" } ". Contains two slots, " { $snippet "name" } " and " { $snippet "attrs" } " containing, respectively, the name of the tag and its attributes." } ;
+{ $class-description
+"Represents a self-closing tag, like " { $snippet "<a/>" } ". Contains two slots:"
+{ $slots
+    { { $slot "name" } { "the " { $link name } " of the tag" } }
+    { { $slot "attrs" } "tag attributes" } } } ;
 
 { opener closer contained } related-words
 
-HELP: open-tag
-{ $class-description "Represents a tag that does have children, ie. is not a contained tag" }
-{ $notes "The constructor used for this class is simply " { $link <tag> } "." }
-{ $see-also tag contained-tag } ;
-
 HELP: names-match?
-{ $values { "name1" "a name" } { "name2" "a name" } { "?" "t or f" } }
-{ $description "Checks to see if the two names match, that is, if all fields are equal, ignoring fields whose value is f in either name." }
+{ $values { "name1" name } { "name2" name } { "?" boolean } }
+{ $description "Checks to see if the two names match, that is, if all slots are equal, ignoring those whose value is "
+{ $link f } " in either name." }
 { $example "USING: prettyprint xml.data ;" "T{ name f \"rpc\" \"methodCall\" f } T{ name f f \"methodCall\" \"http://www.xmlrpc.org/\" } names-match? ." "t" }
 { $see-also name } ;
 
 HELP: assure-name
-{ $values { "string/name" "a string or a name" } { "name" "a name" } }
-{ $description "Converts a string into an XML name, if it is not already a name." } ;
+{ $values { "string/name" { "a " { $link string } " or a " { $link name } } } { "name" name } }
+{ $description "Converts a string into an XML " { $link name } ", if it is not already a name." } ;
 
 HELP: <simple-name>
 { $values { "string" string } { "name" name } }
-{ $description "Converts a string into an XML name with an empty prefix and URL." } ;
+{ $description "Converts a string into an XML " { $link name }
+" with an empty namespace prefix and URL." } ;
 
 HELP: element-decl
-{ $class-description "Describes the class of element declarations, like <!ELEMENT greeting (#PCDATA)>." } ;
+{ $class-description "Describes the class of element declarations, like "
+{ $snippet "<!ELEMENT greeting (#PCDATA)>" } "." } ;
 
 HELP: <element-decl>
-{ $values { "name" name } { "content-spec" string } { "element-decl" entity-decl } }
-{ $description "Creates an element declaration object, of the class " { $link element-decl } } ;
+{ $values { "name" name } { "content-spec" string } { "element-decl" element-decl } }
+{ $description "Creates an element declaration object, of the class " { $link element-decl } "." } ;
+
+{ element-decl <element-decl> } related-words
 
 HELP: attlist-decl
 { $class-description "Describes the class of element declarations, like " { $snippet "<!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>" } "." } ;
 
 HELP: <attlist-decl>
 { $values { "name" name } { "att-defs" string } { "attlist-decl" attlist-decl } }
-{ $description "Creates an element declaration object, of the class " { $link attlist-decl } } ;
+{ $description "Creates an element declaration object, of the class " { $link attlist-decl } "." } ;
+
+{ attlist-decl <attlist-decl> } related-words
 
 HELP: entity-decl
 { $class-description "Describes the class of element declarations, like " { $snippet "<!ENTITY foo 'bar'>" } "." } ;
 
 HELP: <entity-decl>
-{ $values { "name" name } { "def" string } { "pe?" "t or f" } { "entity-decl" entity-decl } }
-{ $description "Creates an entity declaration object, of the class " { $link entity-decl } ". The pe? slot should be t if the object is a DTD-internal entity, like " { $snippet "<!ENTITY % foo 'bar'>" } " and f if the object is like " { $snippet "<!ENTITY foo 'bar'>" } ", that is, it can be used outside of the DTD." } ;
+{ $values { "name" name } { "def" string } { "pe?" boolean } { "entity-decl" entity-decl } }
+{ $description "Creates an entity declaration object, of the class " { $link entity-decl }
+". The " { $slot "pe?" } " slot should be " { $link t }
+" if the object is a DTD-internal entity, like "
+{ $snippet "<!ENTITY % foo 'bar'>" } " and " { $link f } " if the object is like "
+{ $snippet "<!ENTITY foo 'bar'>" } ", that is, it can be used outside of the DTD." } ;
+
+{ entity-decl <entity-decl> } related-words
 
 HELP: system-id
 { $class-description "Describes the class of system identifiers within an XML DTD directive, such as " { $snippet "<!DOCTYPE greeting " { $emphasis "SYSTEM 'hello.dtd'" } ">" } "." } ;
@@ -190,37 +242,53 @@ HELP: <system-id>
 { $values { "system-literal" string } { "system-id" system-id } }
 { $description "Constructs a " { $link system-id } " tuple." } ;
 
+{ system-id <system-id> } related-words
+
 HELP: public-id
 { $class-description "Describes the class of public identifiers within an XML DTD directive, such as " { $snippet "<!DOCTYPE open-hatch " { $emphasis "PUBLIC '-//Textuality//TEXT Standard open-hatch boilerplate//EN' 'http://www.textuality.com/boilerplate/OpenHatch.xml'" } ">" } } ;
 
 HELP: <public-id>
 { $values { "pubid-literal" string } { "system-literal" string } { "public-id" public-id } }
-{ $description "Constructs a " { $link system-id } " tuple." } ;
+{ $description "Constructs a " { $link public-id } " tuple." } ;
+
+{ public-id <public-id> } related-words
 
 HELP: notation-decl
 { $class-description "Describes the class of element declarations, like " { $snippet "<!NOTATION jpg SYSTEM './jpgviewer'>" } "." } ;
 
 HELP: <notation-decl>
 { $values { "name" string } { "id" string } { "notation-decl" notation-decl } }
-{ $description "Creates an notation declaration object, of the class " { $link notation-decl } "." } ;
+{ $description "Creates a notation declaration object, of the class " { $link notation-decl } "." } ;
+
+{ notation-decl <notation-decl> } related-words
 
 HELP: doctype-decl
-{ $class-description "Describes the class of doctype declarations." } ;
+{ $class-description "Describes the class of document type declarations." } ;
 
 HELP: <doctype-decl>
 { $values { "name" name } { "external-id" id } { "internal-subset" sequence } { "doctype-decl" doctype-decl } }
-{ $description "Creates a new doctype declaration object, of the class " { $link doctype-decl } ". Only one of external-id or internal-subset will be non-null." } ;
+{ $description "Creates a new document type declaration object, of the class "
+{ $link doctype-decl } ". Only one of " { $snippet "external-id" } " or " { $snippet "internal-subset" } " will be non-"
+{ $link f } "." } ;
+
+{ doctype-decl <doctype-decl> } related-words
 
 HELP: unescaped
-{ $class-description "When constructing XML documents to write to output, it can be useful to splice in a string which is already written. This tuple type allows for that. Printing an " { $snippet "unescaped" } " is the same is printing its " { $snippet "string" } " slot." } ;
+{ $class-description "When constructing XML documents to write to output, it can be useful to splice in a string which is already written. This tuple type allows for that. Printing an "
+{ $snippet "unescaped" } " is the same is printing its " { $slot "string" }
+" slot." } ;
 
 HELP: <unescaped>
 { $values { "string" string } { "unescaped" unescaped } }
-{ $description "Constructs an " { $link unescaped } " tuple, given a string." } ;
+{ $description "Constructs an " { $link unescaped } " tuple, given a " { $link string } "." } ;
+
+{ unescaped <unescaped> } related-words
 
 HELP: xml-chunk
-{ $class-description "Encapsulates a balanced fragment of an XML document. This is a sequence (following the sequence protocol) of XML data types, eg " { $link string } "s and " { $link tag } "s." } ;
+{ $class-description "Encapsulates a balanced fragment of an XML document. This is a sequence (following the " { $link "sequence-protocol" } ") of XML data types, e.g. " { $link string } "s and " { $link tag } "s." } ;
 
 HELP: <xml-chunk>
 { $values { "seq" sequence } { "xml-chunk" xml-chunk } }
-{ $description "Constructs an " { $link xml-chunk } " tuple, given a sequence to be its contents." } ;
+{ $description "Constructs an " { $link xml-chunk } " tuple, given a " { $snippet "seq" } " for its contents." } ;
+
+{ xml-chunk <xml-chunk> } related-words