]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/xml/entities/entities.factor
factor: trim using lists
[factor.git] / basis / xml / entities / entities.factor
index 7eac725052b38e8aeddf4ad15ad96bf9854a5485..8a1ef96c9e4dcac5c8814e036fd578da807c80e1 100644 (file)
@@ -1,7 +1,6 @@
 ! Copyright (C) 2005, 2006 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces make kernel assocs sequences fry values
-io.files io.encodings.binary xml.state ;
+USING: assocs kernel make namespaces sequences xml.state ;
 IN: xml.entities
 
 CONSTANT: entities-out
@@ -15,12 +14,12 @@ CONSTANT: quoted-entities-out
     H{
         { CHAR: & "&"  }
         { CHAR: ' "'" }
-        { CHAR: " """ }
+        { CHAR: \" """ }
         { CHAR: < "&lt;"   }
     }
 
 : escape-string-by ( str table -- escaped )
-    #! Convert <, >, &, ' and " to HTML entities.
+    ! Convert <, >, &, ' and " to HTML entities.
     [ '[ dup _ at [ % ] [ , ] ?if ] each ] "" make ;
 
 : escape-string ( str -- newstr )
@@ -35,8 +34,8 @@ CONSTANT: entities
         { "gt"    CHAR: >  }
         { "amp"   CHAR: &  }
         { "apos"  CHAR: '  }
-        { "quot"  CHAR: "  }
+        { "quot"  CHAR: \"  }
     }
 
 : with-entities ( entities quot -- )
-    [ swap extra-entities set call ] with-scope ; inline
+    [ extra-entities ] dip with-variable ; inline