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