2008-06-01 18:22:39 -04:00
|
|
|
! Copyright (C) 2008 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
IN: html.templates.chloe.syntax
|
|
|
|
USING: accessors kernel sequences combinators kernel namespaces
|
2008-06-25 04:25:08 -04:00
|
|
|
classes.tuple assocs splitting words arrays memoize parser lexer
|
2008-06-01 18:22:39 -04:00
|
|
|
io io.files io.encodings.utf8 io.streams.string
|
2008-09-05 21:39:45 -04:00
|
|
|
unicode.case mirrors fry math urls
|
2008-06-01 18:22:39 -04:00
|
|
|
multiline xml xml.data xml.writer xml.utilities
|
|
|
|
html.elements
|
|
|
|
html.components
|
|
|
|
html.templates ;
|
|
|
|
|
|
|
|
SYMBOL: tags
|
|
|
|
|
|
|
|
tags global [ H{ } clone or ] change-at
|
|
|
|
|
2008-06-02 16:00:03 -04:00
|
|
|
: define-chloe-tag ( name quot -- ) swap tags get set-at ;
|
2008-06-01 18:22:39 -04:00
|
|
|
|
|
|
|
: CHLOE:
|
2008-06-02 16:00:03 -04:00
|
|
|
scan parse-definition define-chloe-tag ; parsing
|
2008-06-01 18:22:39 -04:00
|
|
|
|
|
|
|
: chloe-ns "http://factorcode.org/chloe/1.0" ; inline
|
|
|
|
|
2008-09-08 02:11:09 -04:00
|
|
|
: chloe-name ( string -- name )
|
2008-06-01 18:22:39 -04:00
|
|
|
name new
|
2008-08-29 05:23:39 -04:00
|
|
|
swap >>main
|
2008-06-01 18:22:39 -04:00
|
|
|
chloe-ns >>url ;
|
|
|
|
|
|
|
|
: required-attr ( tag name -- value )
|
|
|
|
dup chloe-name rot at*
|
|
|
|
[ nip ] [ drop " attribute is required" append throw ] if ;
|
|
|
|
|
|
|
|
: optional-attr ( tag name -- value )
|
|
|
|
chloe-name swap at ;
|