1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors sequences combinators kernel namespaces classes.tuple
4 assocs splitting words arrays memoize parser lexer io io.files
5 io.encodings.utf8 io.streams.string unicode mirrors fry math urls
6 multiline xml xml.data xml.writer xml.syntax html.components
8 IN: html.templates.chloe.syntax
12 tags [ H{ } clone ] initialize
14 : define-chloe-tag ( name quot -- ) swap tags get set-at ;
17 scan-token parse-definition define-chloe-tag ;
19 CONSTANT: chloe-ns "http://factorcode.org/chloe/1.0"
21 : chloe-name? ( name -- ? )
24 XML-NS: chloe-name http://factorcode.org/chloe/1.0
26 : required-attr ( tag name -- value )
27 [ nip ] [ chloe-name attr ] 2bi
28 [ ] [ " attribute is required" append throw ] ?if ;
30 : optional-attr ( tag name -- value )