1 ! Copyright (C) 2005, 2006 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: namespaces make kernel assocs sequences fry values
4 io.files io.encodings.binary ;
21 : escape-string-by ( str table -- escaped )
22 #! Convert <, >, &, ' and " to HTML entities.
23 [ '[ dup _ at [ % ] [ , ] ?if ] each ] "" make ;
25 : escape-string ( str -- newstr )
26 entities-out escape-string-by ;
28 : escape-quoted-string ( str -- newstr )
29 quoted-entities-out escape-string-by ;
40 SYMBOL: extra-entities
42 : with-entities ( entities quot -- )
43 [ swap extra-entities set call ] with-scope ; inline