[pmwiki-users] pagelist template brainstorming

Patrick R. Michaud pmichaud at pobox.com
Sun Feb 18 08:33:02 CST 2007


On Sun, Feb 18, 2007 at 06:21:45PM +1100, Kathryn Andersen wrote:
> On Sat, Feb 17, 2007 at 11:46:26PM -0600, Patrick R. Michaud wrote:
> > But somehow I think it reads better if (:each:) simply watches
> > a value for control breaks, and that we tell authors to always
> > use (:if:) when a condtional needs to be evaluated.
> 
> I agree; since "each" is related to "each page" or "each value",
> I think it's cleaner not to make it use a conditional expression.
> 
> Would there arise a situation where one would wish to check more than
> one value, though?

Sure, one could do this with something like:

    (:each {=$:State} {=$:City}:)

to get a control break anytime the state or city changed.

> > And is the (:first:)/(:each:)/(:last:) syntax appropriate, or 
> > would a different syntax be more desirable?
> 
> Hmmm.  If (:first:) is *before* the first page, and (:last:) is *after*
> the last page, do you think something like "start" and "end" or "pre"
> and "post" might be better?  Or "plpre" etc?

Well, as I think about it more, I think I overstated things in my
original message.  (:first:) would specify markup only for the
first page, and (:last:) would specify markup only for the last
page, but the order would be specified within the pagelist template
itself.  In other words, if an author wrote:

    [[#template]]
    (:last:)
    ...and the last page is: 
    (:each:)
    {=$FullName}
    [[#templateend]]

then the text "...and the last page is:" would appear just before
the last page in the list.  An author could even specify multiple
first or last sections in the template -- all processed in the
order they appear in the template:

    [[#template]]
    (:last:)
    ... and the last page is
    (:each:)
    {=$FullName}
    (:last:)
    and we're done.
    [[#template]]

Granted, this is a bit of advanced usage, but it does give us an
easy way to specify "before the first record", "after the first
record", "before the last record", and "after the last record",
with a syntax that does the natural thing if someone simply
writes the natural sequence (:first:)...(:each:)...(:last:).

The other issue I have with start/end or pre/post is that I think
first/last may be more author (non-programmer) friendly.  It also
helps us to think of things in terms of lists of pages, which
is what this is all about.

Excellent comments!

Pm



More information about the pmwiki-users mailing list