]> gitweb.factorcode.org Git - factor.git/blob - extra/html/entities/entities-docs.factor
html.entities: adding some examples to the docs.
[factor.git] / extra / html / entities / entities-docs.factor
1 USING: help.markup help.syntax strings ;
2 IN: html.entities
3
4 HELP: html-escape
5 { $values { "str" string } { "newstr" string } }
6 { $description "Replaces special characters " { $snippet "&" } ", " { $snippet "<" } ", " { $snippet ">" } ", " { $snippet "\"" } ", and " { $snippet "'" } " to HTML-safe sequences." }
7 { $examples
8     { $example "USING: html.entities prettyprint ;"
9                "\"<foo>\" html-escape ."
10                "\"&lt;foo&gt;\"" }
11 } ;
12
13 HELP: html-unescape
14 { $values { "str" string } { "newstr" string } }
15 { $description "Convert all named and numeric character references (e.g. " { $snippet "&gt;" } ", " { $snippet "&#62;" } ", " { $snippet "&#x3e;" } ") in the string " { $snippet "str" } " to the corresponding unicode characters using the rules defined by the HTML5 standard." }
16 { $examples
17     { $example "USING: html.entities prettyprint ;"
18                "\"x &lt; 2 &amp;&amp y &gt; 5\" html-unescape ."
19                "\"x < 2 && y > 5\"" }
20 } ;