factor/basis/xml/entities/html/html.factor

22 lines
631 B
Factor
Raw Normal View History

2009-01-15 23:20:24 -05:00
! Copyright (C) 2009 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs io.encodings.binary io.files kernel namespaces sequences
2011-11-29 00:26:06 -05:00
xml xml.entities accessors xml.state ;
2009-01-15 23:20:24 -05:00
IN: xml.entities.html
2011-11-29 00:26:06 -05:00
SYMBOL: html-entities
2009-01-15 23:20:24 -05:00
: read-entities-file ( file -- table )
file>dtd entities>> ;
2009-01-15 23:20:24 -05:00
: get-html ( -- table )
{ "lat1" "special" "symbol" } [
2009-11-12 04:01:09 -05:00
"vocab:xml/entities/html/xhtml-" ".ent" surround
read-entities-file
2009-01-15 23:20:24 -05:00
] map first3 assoc-union assoc-union ;
2011-11-29 00:26:06 -05:00
get-html html-entities set-global
2009-01-15 23:20:24 -05:00
: with-html-entities ( quot -- )
2011-11-29 00:26:06 -05:00
html-entities get-global swap with-entities ; inline