\"someoutput\" write
" } +"In the above, " { $link} " will output the opening tag with no attributes. and " { $link
} " will output the closing tag." +{ $code "\"someoutput\" write
" } +"This time the opening tag does not have the '>'. Any attribute words used between the calls to " { $link} " will write an attribute whose value is the top of the stack. Attribute values can be any object supported by the " { $link present } " word." +$nl +"Values for attributes can be used directly without any stack operations. Assuming we have a string on the stack, all three of the below will output a link:" +{ $code " \"Click me\" write " } +{ $code " \"click\" write " } +{ $code " \"click\" write " } +"Tags that have no ``closing'' equivalent have a trailing " { $snippet "tag/>" } " form:" +{ $code "" } +"For the full list of HTML tags and attributes, consult the word list for the " { $vocab-link "html.elements" } " vocabulary. In addition to HTML tag and attribute words, a few utilities are provided." +$nl +"Writing unescaped HTML to " { $vocab-link "html.streams" } ":" +{ $subsection write-html } +{ $subsection print-html } +"Writing some common HTML patterns:" +{ $subsection xhtml-preamble } +{ $subsection simple-page } +{ $subsection render-error } ; + +ABOUT: "html.elements" diff --git a/basis/html/elements/elements.factor b/basis/html/elements/elements.factor index ced2f700dc..c7281df54d 100644 --- a/basis/html/elements/elements.factor +++ b/basis/html/elements/elements.factor @@ -9,45 +9,6 @@ urls math math.parser combinators present fry ; IN: html.elements -! These words are used to provide a means of writing -! formatted HTML to standard output with a familiar 'html' look -! and feel in the code. -! -! HTML tags can be used in a number of different ways. The highest -! level involves a similar syntax to HTML: -! -!
"someoutput" write
-! -!will output the opening tag and
will output the closing -! tag with no attributes. -! -!"someoutput" write
-! -! This time the opening tag does not have the '>'. It pushes -! a namespace on the stack to hold the attributes and values. -! Any attribute words used will store the attribute and values -! in that namespace. Before the attribute word should come the -! value of that attribute. -! The finishing word will print out the operning tag including -! attributes. -! Any writes after this will appear after the opening tag. -! -! Values for attributes can be used directly without any stack -! operations: -! -! (url -- ) -! "Click me" write -! -! (url -- ) -! "click" write -! -! (url -- ) -! "click" write -! -! Tags that have no 'closing' equivalent have a trailing tag/> form: -! -! - SYMBOL: html : write-html ( str -- ) @@ -170,7 +131,7 @@ SYMBOL: html : xhtml-preamble ( -- ) "" write-html - "" write-html ; + "" write-html ; : simple-page ( title quot -- ) #! Call the quotation, with all output going to the diff --git a/basis/html/forms/forms-docs.factor b/basis/html/forms/forms-docs.factor new file mode 100644 index 0000000000..7a2134c996 --- /dev/null +++ b/basis/html/forms/forms-docs.factor @@ -0,0 +1,125 @@ +IN: html.forms +USING: help.markup help.syntax strings quotations kernel assocs ; + +HELP: