]> gitweb.factorcode.org Git - factor.git/commitdiff
html.entities: adding some examples to the docs.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 22 Apr 2014 22:51:25 +0000 (15:51 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 22 Apr 2014 22:51:25 +0000 (15:51 -0700)
extra/html/entities/entities-docs.factor

index 2b22ce758da3b6e69a2d59082de4cbe9d2967e5a..49db0a0abbc5eba38ceaf5418b15990fdd005354 100644 (file)
@@ -3,8 +3,18 @@ IN: html.entities
 
 HELP: html-escape
 { $values { "str" string } { "newstr" string } }
-{ $description "Replaces special characters " { $snippet "&" } ", " { $snippet "<" } ", " { $snippet ">" } ", " { $snippet "\"" } ", and " { $snippet "'" } " to HTML-safe sequences." } ;
+{ $description "Replaces special characters " { $snippet "&" } ", " { $snippet "<" } ", " { $snippet ">" } ", " { $snippet "\"" } ", and " { $snippet "'" } " to HTML-safe sequences." }
+{ $examples
+    { $example "USING: html.entities prettyprint ;"
+               "\"<foo>\" html-escape ."
+               "\"&lt;foo&gt;\"" }
+} ;
 
 HELP: html-unescape
 { $values { "str" string } { "newstr" string } }
-{ $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." } ;
+{ $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." }
+{ $examples
+    { $example "USING: html.entities prettyprint ;"
+               "\"x &lt; 2 &amp;&amp y &gt; 5\" html-unescape ."
+               "\"x < 2 && y > 5\"" }
+} ;