 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs namespaces make kernel sequences accessors
 combinators strings splitting io io.streams.string present
-xml.writer xml.data xml.entities html.forms
+sets ascii xml.writer xml.data xml.entities html.forms
 html.templates html.templates.chloe.syntax ;
 IN: html.templates.chloe.compiler
 


ERROR: tag-not-allowed-here ;

: check-tag ( -- )
    string-context? get [ tag-not-allowed-here ] when ;

: compile-tag ( tag -- )
    check-tag
    {
        [ main>> tag-stack get push ]
        [ compile-start-tag ]
        [ compile-children ]
        [ compile-end-tag ]
    } cleave
    tag-stack get pop* ;

ERROR: unknown-chloe-tag tag ;

        "\"" [write]
    ] assoc-each ;

: compile-self-closing-tag ( tag -- )
    "<" [write]
    [ name>string [write] ] [ attrs>> compile-attrs ] bi
    " />" [write] ;

: compile-start-tag ( tag -- )
    "<" [write]
    [ name>string [write] ] [ attrs>> compile-attrs ] bi
