]> gitweb.factorcode.org Git - factor.git/blob - basis/html/streams/streams-docs.factor
c85ab739b8b10cc39f3eaac1637fc05aed6fe0d4
[factor.git] / basis / html / streams / streams-docs.factor
1 IN: html.streams
2 USING: help.markup help.syntax kernel strings io io.styles
3 quotations xml.data ;
4
5 HELP: url-of
6 { $values { "object" object } { "url" string } }
7 { $contract "Outputs a link to a page displaying a presentation of the given object. This word is called when " { $link write-object } " is called on " { $link html-writer } " instances." } ;
8
9 HELP: html-writer
10 { $class-description "A formatted output stream which accumulates HTML markup as " { $vocab-link "xml.data" } " types. The " { $slot "data" } " slot contains a sequence with all markup so far." } ;
11
12 HELP: <html-writer>
13 { $values { "html-writer" html-writer } }
14 { $description "Creates a new formatted output stream which accumulates HTML markup in its " { $snippet "data" } " slot." } ;
15
16 HELP: with-html-writer
17 { $values { "quot" quotation } { "xml" xml-chunk } }
18 { $description "Calls the quotation in a new dynamic scope with " { $link output-stream } " rebound to an " { $link html-writer } ". When the quotation returns, outputs the accumulated HTML markup." }
19 { $examples
20     { $example
21         "USING: io io.styles html.streams xml.writer ;"
22         "[ \"Hello\" { { font-style bold } } format nl ] with-html-writer write-xml"
23         "<span style=\"font-style: normal; font-weight: bold; \">Hello</span><br/>"
24     }
25 } ;
26
27 ARTICLE: "html.streams" "HTML streams"
28 "The " { $vocab-link "html.streams" } " vocabulary provides a stream which implements " { $link "io.styles" } " by constructing HTML markup in the form of " { $vocab-link "xml.data" } " types."
29 { $subsection html-writer }
30 { $subsection <html-writer> }
31 { $subsection with-html-writer } ;
32
33 ABOUT: "html.streams"