[pmwiki-users] pagelist template brainstorming

Kathryn Andersen kat_lists at katspace.homelinux.org
Sun Feb 18 01:21:45 CST 2007


On Sat, Feb 17, 2007 at 11:46:26PM -0600, Patrick R. Michaud wrote:
 
> Thus I'm wondering if we can improve things for both performance 
> and readability by introducing special-purpose (:first:), (:each:),
> and (:last:) directives inside of pagelist templates.

This sounds good.
 
> The (:first:) directive would identify markup prior to the first 
> page in the pagelist, (:each:) would be markup used for each page 
> in the list, and (:last:) would contain markup used after the 
> last page in the list.  Thus with these markers, our above 
> template would read:
[snip]
> Here, (:each {=$Group}:) says to output the markup that follows
> for every page where {=$Group} results in a value different from
> the previous iteration.  With this formulation our 1000 page, 10 group 
> list now produces 2 + 10*1 + 1000*1 + 1 == 1013 lines of markup, far 
> less than 9000 lines of the original template.
> 
> I'm a bit concerned that some authors may try to put full fledged
> conditionals into (:each:), as opposed to simply values to be
> "watched".  So, perhaps (:each:) should take a conditional expression
> instead of a value to be watched...
> 
>     (:each ! equal {=$Group} {<$Group} :)
> 
> 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?

> Does this approach and markup make sense to others?

Yes, indeedie!
 
> While we're on the topic, another desirable feature we can introduce
> with this approach would be the ability to set default pagelist
> options from within a pagelist template itself.

That would be cool.

> So, again my questions are:  Would markups such as these make it
> easier or more difficult for people creating pagelist templates?  

I think the options is good, because there *are* certain pagelist
templates (especially ones with control breaks) where the pagelist
doesn't make sense if it isn't in a particular sort order.  I've also
made pagelist templates that likewise don't work properly if a
particular list= option isn't given, so I think this is all to the good.

> 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?

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe



More information about the pmwiki-users mailing list