From marijnh at gmail.com Sun Nov 26 13:56:15 2006 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 26 Nov 2006 14:56:15 +0100 Subject: [html-template-devel] Proposed new feature for HTML-TEMPLATE In-Reply-To: References: Message-ID: [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 , , & > 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: From edi at agharta.de Sun Nov 26 22:57:03 2006 From: edi at agharta.de (Edi Weitz) Date: Sun, 26 Nov 2006 23:57:03 +0100 Subject: [html-template-devel] Proposed new feature for HTML-TEMPLATE In-Reply-To: (Marijn Haverbeke's message of "Sun, 26 Nov 2006 14:56:15 +0100") References: Message-ID: On Sun, 26 Nov 2006 14:56:15 +0100, "Marijn Haverbeke" 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.