1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs sequences kernel parser fry quotations
6 html.templates.chloe.compiler
7 html.templates.chloe.syntax ;
8 IN: html.templates.chloe.components
10 : singleton-component-tag ( tag class -- )
11 [ "name" required-attr compile-attr ]
12 [ literalize [ render ] [code-with] ]
17 [ name>> ] [ '[ , singleton-component-tag ] ] bi
21 : compile-component-attrs ( tag class -- )
22 [ attrs>> [ drop main>> "name" = not ] assoc-filter ] dip
23 [ all-slots swap '[ name>> , at compile-attr ] each ]
24 [ [ boa ] [code-with] ]
27 : tuple-component-tag ( tag class -- )
28 [ drop "name" required-attr compile-attr ] [ compile-component-attrs ] 2bi
33 [ name>> ] [ '[ , tuple-component-tag ] ] bi