[pmwiki-users] Using Page Text Variables {$:Var} for multi-line Includes

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 28 12:22:30 CDT 2006


On Thu, Sep 28, 2006 at 03:27:54PM +0000, Pico wrote:
> Currently, the new page text variables {$:var} store values up until 
> the first line break.  Long paragraphs are apparently ok, as long as 
> the text is wrapped without intervening line breaks.  Apart from that, 
> page text variables do not appear to work with multi-line text.
> 
> (1) Are there any work-arounds that would allow line breaks in page 
> text variables?

The (:var:value:) form of definition currently works with line 
breaks:

    (:Address:
       123 Any Street
       Anytown, USA
    :)

> (2) Are there any plans to support line breaks in page text variables?

The only other things I've been considering are:

  - lines with backslashes (\) at the end would join together

      Address: 123 Any Street\
        Anytown, USA

  - honoring line breaks in [=...=] escapes, as in:

      Address:[=
        123 Any Street
        Anytown, USA
      =]

But these are just under consideration for the moment, I don't
have any specific plans for them in the core.  

Note also that it's possible to customize the markups being used
to define page text variables, so you can come up with a markup
that would enable multi-line values, I can get you the
customization that would enable it.

> (3) Are page text variables more "efficient" than the include directive?  

I don't think there's much of a difference in terms of efficiency
or capability.  At the moment I'd tend to go with includes if there
are multi-line values, especially if those values are intended to
have other markup in them.

And we can easily fix the maximum include limitation; it exists
at the moment simply as a stop against runaway nested includes.
The easiest fix would be to add an option to (:include:) that says
"don't count this against $MaxIncludes".  This would give authors
an explicit way of deliberately saying "it's okay if this include 
occurs a lot of times", while still protecting against the accidental
loop.

Pm




More information about the pmwiki-users mailing list