[pmwiki-users] Great pagelist question...

Patrick R. Michaud pmichaud at pobox.com
Wed Aug 30 12:11:42 CDT 2006


On Wed, Aug 30, 2006 at 06:17:07PM +0200, Dominique Faure wrote:
> Some questions in order to clarify things a bit (at least for me):
> 
> Having '^Properties' in pages would be a very nice way to initialize
> page variables so why having two kind of "variables" accessor in pages
> {$FullName} and {$:Something}, since semantically, they are both page
> attributes?

Wow, I have a lot of responses to this particular question.  I'll
try to get them all in a resonable sequence...

By '^Properties' I'm assuming you're referring to the markup rule
that the Cookbook uses that treats any line of the form 
"PropertyName: value" as setting a value for PropertyName.  And
I agree it's a very nice way to initialize page variables, 
although I'm not sure we can use it exclusively.  (What if we
want to initialize a page variable that *isn't* to be displayed
in the output -- does it have to be a comment somehow?)

Side note 1:  It might be *really* nice if there were a convenient
markup that sets a page property but doesn't display it.  The best I 
can come up with so far is a leading caret (but I don't like it much):

    Name: Patrick Michaud           # displayed
    ^Name: Patrick Michaud          # hidden, like a comment

In thinking about it further (and in coming up with the {$:...}
markup) I'm becoming more convinced that page properties are in
fact a special case of page variables, and they really should
have separate accessors.   In particular, as things stand now
we can't set properties in a page Group.XYZ with things like

    Name: Patrick Michaud
    Title: Benevolent Dictator
    Group: PmWiki enthusiasts
    Version: 2.0

because the page variables {$Name}, {$Title}, {$Group}, {$Version},
etc. already have a different and predefined meaning.  Having a
separate {$:...} accessor for content-based properties avoids the 
conflict altogether:

    {$Name} -> XYZ              {$:Name} -> Patrick Michaud
    {$Group} -> Group           {$:Group} -> PmWiki Enthusiasts
    {$Title} -> XYZ             {$:Title} -> Benevolent Dictator

So, the colon represents that we're getting something from a
page's markup contents (a "content page variable"), whereas no colon 
means we're looking at something that is at a meta-level for the 
page itself (a "meta-level page variable").

Side note 1:  Arguably it might be nice if the ':' designated the 
meta-level items, but it'd be too difficult to switch, and besides 
I think the meta-level variables are used far more often than the
content-level ones, so it makes sense that they'd be shorter.

Side note 2:  You mention above that both {$FullName} and {$:Something}
are "page attributes", but I try to reserve the term "page attribute"
to refer to those things that are stored directly in the page
files; i.e., things such as "time", "author", "ctime", "text", etc.
Yes, it's confusing -- if anyone has a better system of terms
that people would readily understand, I'm all for it.
    
> Practically speaking, how do you want the PageVariableExtensions
> recipe to be integrated into this scheme?

I haven't looked in detail at PageVariableExtensions to figure
this out yet.  There are still a *lot* of things to consider, even
without PageVariableExtensions:

   - what's the relative ordering between {$var}, {$:var}, conditional
     markups, etc?
   - what happens if a property's value itself contains a page 
     variable, as might be the case for ...

         Version: 2006-08-30
         Title:  A new article, {$Title} and {$:Version}

   - how much of this belongs in the core, if any?  

Pm




More information about the pmwiki-users mailing list