[html-template-devel] Proposed new feature for HTML-TEMPLATE

Marijn Haverbeke marijnh at gmail.com
Sun Nov 26 13:56:15 UTC 2006


[I sent this to Edi earlier, but it seems to have been ignored. I just saw
that there is actually a mailing list for this project, so I'm hoping that
sending it to the correct place will generate a bit more response.]

> For a personal project I extended your HTML-TEMPLATE library with an
> extra TMPL tag. If you think my extension is useful enough to be
> included in the library proper, I'll be happy to properly document it
> and submit a patch. Here is how it works:
>
> Support for the TMPL_CALL tag is added. This is related to
> TMPL_INCLUDE, but allows the values passed to a template to
> 'dynamically' determine which sub-templates should be used. It was
> inspired by the way XSLT's apply-templates works. The tag takes a
> single symbol as argument, and treats it the way TMPL_LOOP does,
> iterating over a list or a vector of values. Each of these values
> specifies a template to use and a set of values to apply that template
> to. These are extracted by applying the functions
> *call-template-access-function* and *call-values-access-function* to
> the given values - these default to #'car and #'cdr respectively.
>
> If *default-template-pathname* is set properly, and there are
> templates named "fancy-paragraph" and "standard-footer", something
> like this...
>
> '(:title "Title"
>   :body
>     ((#P"fancy-paragraph" :content "This is a fancy paragraph")
>      (#P"standard-footer")))
>
> ... can be fed to a template that applies TMPL_CALL to :body to render
> its body in whatever way the code that generated the values thought
> suitable.
>
> Basically, this extension allows the use of outer templates that do
> not know precisely what kind of content will be inserted into them. A
> very basic example is a template that contains the <html>, <head>, &
> <body> tags + maybe some basic formatting, and which can be used by
> all pages that generate pages with a similar outer structure.
>
> Let me know what you think,
> Marijn Haverbeke

[Also, reading a few older message on this list suggests that adding fancy
new features isn't a priority for this library -- but I still think adding a
dynamic way to include subtemplates would be useful enough to warrant the
extra complexity.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/html-template-devel/attachments/20061126/70bbe2a2/attachment.html>


More information about the Html-template-devel mailing list