[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.]
On Sun, 26 Nov 2006 14:56:15 +0100, "Marijn Haverbeke" marijnh@gmail.com wrote:
I sent this to Edi earlier, but it seems to have been ignored.
I didn't really ignore it. I just put it into my "do later" folder, because I'm too busy with other things right now. Sorry.
Also, reading a few older message on this list suggests that adding fancy new features isn't a priority for this library
That's the general policy, right. But I am open for new stuff /sometimes/ - see TMPL_UNLESS... :)
but I still think adding a dynamic way to include subtemplates would be useful enough to warrant the extra complexity.
I haven't thought about it enough to say whether I like it or not, but maybe other people on this list have an opinion.
Cheers, Edi.
On Sun, 26 Nov 2006 14:56:15 +0100, "Marijn Haverbeke" marijnh@gmail.com wrote:
Support for the TMPL_CALL tag is added.
OK, sorry for the /long/ delay, but as I said I'm pretty busy at the moment.
Your proposal sounds fine to me and I think we should include it. If you want this to be released quickly, please send a clean patch that not only includes the code with doc string but also updates the test file and the HTML documentation accordingly.
Thanks in advance, Edi.
Your proposal sounds fine to me and I think we should include it. If you want this to be released quickly, please send a clean patch that not only includes the code with doc string but also updates the test file and the HTML documentation accordingly.
Attached is the path which should do all that. I also included a small refactoring which splits up create-simple-printer, but that should be easy to remove if you don't like it.
Regards, Marijn
On Mon, 11 Dec 2006 20:15:26 +0100, "Marijn Haverbeke" marijnh@gmail.com wrote:
Attached is the path which should do all that. I also included a small refactoring which splits up create-simple-printer, but that should be easy to remove if you don't like it.
Very nice, thanks a lot. I've released a new version with your modifications.
Cheers, Edi.
html-template-devel@common-lisp.net