Un-breaking Chloe
parent
915be761be
commit
dcad3ad225
|
@ -7,16 +7,16 @@ html.templates html.templates.chloe.syntax continuations ;
|
||||||
IN: html.templates.chloe.compiler
|
IN: html.templates.chloe.compiler
|
||||||
|
|
||||||
: chloe-attrs-only ( assoc -- assoc' )
|
: chloe-attrs-only ( assoc -- assoc' )
|
||||||
[ drop url>> chloe-ns = ] assoc-filter ;
|
[ drop chloe-name? ] assoc-filter ;
|
||||||
|
|
||||||
: non-chloe-attrs-only ( assoc -- assoc' )
|
: non-chloe-attrs-only ( assoc -- assoc' )
|
||||||
[ drop url>> chloe-ns = not ] assoc-filter ;
|
[ drop chloe-name? not ] assoc-filter ;
|
||||||
|
|
||||||
: chloe-tag? ( tag -- ? )
|
: chloe-tag? ( tag -- ? )
|
||||||
dup xml? [ body>> ] when
|
dup xml? [ body>> ] when
|
||||||
{
|
{
|
||||||
{ [ dup tag? not ] [ f ] }
|
{ [ dup tag? not ] [ f ] }
|
||||||
{ [ dup url>> chloe-ns = not ] [ f ] }
|
{ [ dup chloe-name? not ] [ f ] }
|
||||||
[ t ]
|
[ t ]
|
||||||
} cond nip ;
|
} cond nip ;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ DEFER: compile-element
|
||||||
reset-buffer "@" ?head [ , [ value present ] % ] [ , ] if ;
|
reset-buffer "@" ?head [ , [ value present ] % ] [ , ] if ;
|
||||||
|
|
||||||
: compile-attrs ( assoc -- )
|
: compile-attrs ( assoc -- )
|
||||||
[
|
attrs>> [
|
||||||
" " [write]
|
" " [write]
|
||||||
swap name>string [write]
|
swap name>string [write]
|
||||||
"=\"" [write]
|
"=\"" [write]
|
||||||
|
|
|
@ -21,14 +21,14 @@ tags global [ H{ } clone or ] change-at
|
||||||
|
|
||||||
: chloe-ns "http://factorcode.org/chloe/1.0" ; inline
|
: chloe-ns "http://factorcode.org/chloe/1.0" ; inline
|
||||||
|
|
||||||
: chloe-name ( string -- name )
|
: chloe-name? ( name -- ? )
|
||||||
name new
|
url>> chloe-ns = ;
|
||||||
swap >>main
|
|
||||||
chloe-ns >>url ;
|
XML-NS: chloe-name http://factorcode.org/chloe/1.0
|
||||||
|
|
||||||
: required-attr ( tag name -- value )
|
: required-attr ( tag name -- value )
|
||||||
dup chloe-name rot at*
|
tuck chloe-name attr
|
||||||
[ nip ] [ drop " attribute is required" append throw ] if ;
|
[ nip ] [ " attribute is required" append throw ] if* ;
|
||||||
|
|
||||||
: optional-attr ( tag name -- value )
|
: optional-attr ( tag name -- value )
|
||||||
chloe-name swap at ;
|
chloe-name attr ;
|
||||||
|
|
Loading…
Reference in New Issue