| This document temple "system" is so trivial I hesitated to post it. Uses 'atstrings. And the <li> generator is something that just came up. ;== html/test.html ==
;<html>
; <body>@(header)</body>
;</html>
;== html/top.html ==
;<h1>@( companyname )</h1>
;(def companyname () "Acme Co")
;(def header ()
; (render "html/top.html"))
;arc> (render "html/test.html")
;"<html>\n <body><h1>Acme Co</h1>\n\n</html>\n"
(declare 'atstrings t)
(def render (file)
(eval (filechars file)))
;<li> for use in <ul> or <ol>
;gentag prs all over the place, need to build strings, eval, THEN print
(def li (l)
(string
(mappend [if (is (type _) 'table)
(list
"<li "
(aif (_ 'class) (string "class=\"" it "\""))
(aif (_ 'id) (string "id=\"" it "\""))
">"
(_ 'body)
"</li>")
(list
"<li>"
(string _)
"</li>")
] l )))
;usage
;arc> (li `(,(obj body "hi" id "brown") ,(obj body "world" class "green") "foo"))
;"<li id=\"brown\">hi</li><li class=\"green\">world</li><li>foo</li>"
|