|
This is how a template might look like:
<table border=1>
<!-- TMPL_LOOP rows -->
<tr>
<!-- TMPL_LOOP cols -->
<!-- TMPL_IF colorful-style -->
<td align="right" bgcolor="pink"><!-- TMPL_VAR content --></td>
<!-- TMPL_ELSE -->
<td align="right" ><!-- TMPL_VAR content --></td>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</tr>
<!-- /TMPL_LOOP -->
</table>
And this could be the corresponding Lisp code:
(let* ((rows (loop for i below 49 by 7
collect (list :cols
(loop for j from i below (+ i 7)
for string = (format nil "~R" j)
collect (list :content string
:colorful-style (oddp j))))))
(values (list :rows rows)))
(fill-and-print-template #p"/tmp/foo.tmpl" values))
|