[pmwiki-users] New template expression markup....

The Editor editor at fast.st
Tue May 1 05:28:31 CDT 2007


On 5/1/07, Hans <design5 at softflow.co.uk> wrote:
> Tuesday, May 1, 2007, 1:42:07 AM, The Editor wrote:
> > [...]
> > (:template <datapage> <templatepage>:)
>
> > It opens the datapage, explodes the content by the anchors, inserts
> > the data values into the template, and then re-implodes the output and
> > sends it back to the page.  All the data is cleanly stored on one
> > page.  And the template can be instantly updated sitewide.  The best
> > of both worlds!
>
> > I wrote out the code this morning but haven't had a chance to test or
> > debut it yet.  Should be able to finish tomorrow.  Any thoughts?
>
> Kathryn is right; don't use (:template ...:).
>
> Otherwise very interesting. A short while ago I had a discussion about
> this with Feral. We were polishing her new recipe FeralFormattedEntry
> http://www.pmwiki.org/wiki/Cookbook/FeralFormattedEntry
> which provides a kind of data container markup, and uses a template
> for formatted display of its data content. Data is stored as parameter
> values inside the markup, for instance
>
> (:ffe heading="A new entry" author="Jim" template=Site.BlogTemplate:)
> Some text
> from a textarea input box.
> (:ffeend:)
>
> (:ffe heading="reply to you" author="John" template=Site.BlogTemplate:)
> What is all this about?
> more text lines...
> (:ffeend:)
>
> One advantage to what you are proposing is that every entry can have
> its own template specified. Nice for instance for a blog where the
> first topic entry can look quite different than all the reply comments.
> The other difference is that it does not use anchors to split the page
> into different data entry sections, but the markup acts like a
> container. So, this is working and you can play with it. I like to use
> it for displaying forum posts with display templates.
>
> So then I thought: we could expand this and allow PTVs inside the
> (:ffe :) ... (:ffeend:) container. I actually generalised Feral's
> script to this extend for testing out this idea. So one could create a
> page with
>
> (:ffe template=Site.BlogTemplate:)
> (:heading:A new entry:)
> (:author:Jim:)
> (:text:
> Some text
> from a textarea input box.
> (:ffeend:)
>
> (:ffe template=Site.BlogTemplate:)
> (:heading:reply to you:)
> (:author:John:)
> (:text:
> What is all this about?
> more text lines...
> (:ffeend:)
>
> But Feral's main objection was that we are creating "pseudo PTVs" and
> that the source code looks less tidy and not so easy to edit later
> than her own ffe markup.
>
> The point about pseudo PTVs is certainly true and applies to your
> approach as well. PTVs are at the moment restricted, as all PTVs on one
> page should bear unique names. So reusing PTV names in multiple data
> sections of  a page is against how PmWiki defines PTVs, and is not
> suitable also for how PmWiki handles PTVs, for instance in pagelist
> searches.
>
> A concept of multiple data sections on a page using some sort of PTV
> needs to address this and really creates a new type of PTV, perhaps
> better called SectionTextVariable, or STV. And this may indeed be very
> useful.


I've though of another way to do this that might be even more useful,
though I'm still toying a bit with the exact implementation.  The code
should be easier and the syntax cleaner.  Namely something like:

==========
[[#ID1]]
date: ...
author: ...
comment: ...
==========
[[#ID1]]
date: ...
author: ...
comment: ...
==========

Then define a markup rule or two that takes the ========== wrappers
and uses them to process the ptv's inside according to some template.

The template could be defined by a (:sectiontemplate page:) markup, or
perhaps be a ptv in the section, or I even thought of simply having
the first section define the template.

ZAP has the ability to edit sections (delimited by anchors) so it
would be fairly trivial to pull the stv's back into a text box and
edit them just as they appear above (I'd just need to handle the
trailing section line better).

This gives a nice clean source that should be searchable, yet display
fully formatted without needing pagelists.  Also the code for handling
the STV's will be quite a bit simpler not using hidden ptv format.

Just thinking out loud...  Thanks for the input Hans!

Cheers,
Dan



More information about the pmwiki-users mailing list