html.entities: adding better HTML 5 escaping.
parent
70fd2ebf52
commit
e79bb8f6e4
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,10 @@
|
|||
USING: help.markup help.syntax strings ;
|
||||
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." } ;
|
||||
|
||||
HELP: html-unescape
|
||||
{ $values { "str" string } { "newstr" string } }
|
||||
{ $description "Convert all named and numeric character references (e.g. >, >, &x3e;) in the string " { $snippet "str" } " to the corresponding unicode characters using the rules defined by the HTML5 standard" } ;
|
|
@ -0,0 +1,9 @@
|
|||
USING: tools.test ;
|
||||
IN: html.entities
|
||||
|
||||
{ "&" } [ "&" html-unescape ] unit-test
|
||||
{ "a" } [ "a" html-unescape ] unit-test
|
||||
{ "<foo>" } [ "<foo>" html-unescape ] unit-test
|
||||
|
||||
{ "&" } [ "&" html-escape ] unit-test
|
||||
{ "<foo>" } [ "<foo>" html-escape ] unit-test
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue