{ { $snippet "t:write-title" } "Renders the child's title. Intended for use in a child template." }
{ { $snippet "t:style" } { "Adds CSS markup from the file named by the " { $snippet "t:include" } " attribute. Intended for use in a child template." } }
{ { $snippet "t:write-style" } "Renders the children's CSS markup. Intended for use in a master template." }
+ { { $snippet "t:script" } { "Adds JS from the file named by the " { $snippet "t:include" } " attribute. Intended for use in a child template." } }
+ { { $snippet "t:write-script" } "Renders the children's JS. Intended for use in a master template." }
{ { $snippet "t:atom" } { "Adds an Atom feed link. The attributes are the same as the " { $snippet "t:link" } " tag. Intended for use in a child template. (*)" } }
{ { $snippet "t:write-atom" } "Renders the children's list of Atom feed links. Intended for use in a master template. (*)" }
{ { $snippet "t:call-next-template" } "Calls the next child template from a master template." }
[XML <style type="text/css"> <-> </style> XML]
] [xml-code] ;
+CHLOE: script
+ dup "include" optional-attr [
+ utf8 file-contents [ add-script ] [code-with]
+ ] [
+ compile-children>string [ add-script ] [code]
+ ] ?if ;
+
+CHLOE: write-script
+ drop [
+ get-script
+ [XML <script type="text/javascript"> <-> </script> XML]
+ ] [xml-code] ;
+
CHLOE: even
[ "index" value even? swap when ] process-children ;
: write-style ( -- )
get-style write ;
+SYMBOL: script
+
+: add-script ( string -- )
+ "\n" script get push-all
+ script get push-all ;
+
+: get-script ( -- string )
+ script get >string ;
+
+: write-script ( -- )
+ get-script write ;
+
SYMBOL: atom-feeds
: add-atom-feed ( title url -- )
[
title [ [ <box> ] unless* ] change
style [ [ SBUF" " clone ] unless* ] change
+ script [ [ SBUF" " clone ] unless* ] change
atom-feeds [ V{ } like ] change
[