PageRenderTime 100ms CodeModel.GetById 92ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 1ms

/extra/html/elements/elements-docs.factor

http://github.com/abeaumont/factor
Unknown | 27 lines | 25 code | 2 blank | 0 comment | 0 complexity | 0fe6bd760028e009f8f1eec7d60277d9 MD5 | raw file
 1USING: help.markup help.syntax io present html ;
 2IN: html.elements
 3
 4ARTICLE: "html.elements" "HTML elements"
 5"The " { $vocab-link "html.elements" } " vocabulary provides words for writing HTML tags to the " { $link output-stream } " with a familiar look and feel in the code."
 6$nl
 7"HTML tags can be used in a number of different ways. The simplest is a tag with no attributes:"
 8{ $code "<p> \"someoutput\" write </p>" }
 9"In the above, " { $link <p> } " will output the opening tag with no attributes. and " { $link </p> } " will output the closing tag."
10{ $code "<p \"red\" =class p> \"someoutput\" write </p>" }
11"This time the opening tag does not have the '>'. Any attribute words used between the calls to " { $link <p } " and " { $link p> } " will write an attribute whose value is the top of the stack. Attribute values can be any object supported by the " { $link present } " word."
12$nl
13"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:"
14{ $code "<a =href a> \"Click me\" write </a>" }
15{ $code "<a \"http://\" prepend =href a> \"click\" write </a>" }
16{ $code "<a [ \"http://\" % % ] \"\" make =href a> \"click\" write </a>" }
17"Tags that have no “closing” equivalent have a trailing " { $snippet "tag/>" } " form:"
18{ $code "<input \"text\" =type \"name\" =name 20 =size input/>" }
19"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."
20$nl
21"Writing unescaped HTML to " { $vocab-link "html.streams" } ":"
22{ $subsections
23    write-html
24    print-html
25} ;
26
27ABOUT: "html.elements"