Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / basis / xml / entities / html / html.factor
blob826dccf79d44f0205a819540718e37fdbcb5ded0
1 ! Copyright (C) 2009 Daniel Ehrenberg.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs io.encodings.binary io.files kernel namespaces sequences
4 values xml xml.entities ;
5 IN: xml.entities.html
7 VALUE: html-entities
9 : read-entities-file ( file -- table )
10     file>dtd nip ;
12 : get-html ( -- table )
13     { "lat1" "special" "symbol" } [
14         "resource:basis/xml/entities/html/xhtml-"
15         swap ".ent" 3append read-entities-file
16     ] map first3 assoc-union assoc-union ;
18 get-html to: html-entities
20 : with-html-entities ( quot -- )
21     html-entities swap with-entities ; inline