1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: html.templates.chloe.syntax
4 USING: accessors kernel sequences combinators kernel namespaces
5 classes.tuple assocs splitting words arrays memoize parser lexer
6 io io.files io.encodings.utf8 io.streams.string
7 unicode.case mirrors fry math urls
8 multiline xml xml.data xml.writer xml.utilities
15 tags global [ H{ } clone or ] change-at
17 : define-chloe-tag ( name quot -- ) swap tags get set-at ;
20 scan parse-definition define-chloe-tag ; parsing
22 : chloe-ns "http://factorcode.org/chloe/1.0" ; inline
24 : chloe-name? ( name -- ? )
27 XML-NS: chloe-name http://factorcode.org/chloe/1.0
29 : required-attr ( tag name -- value )
31 [ nip ] [ " attribute is required" append throw ] if* ;
33 : optional-attr ( tag name -- value )