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

Pico pmwiki at ben-amotz.com
Mon Oct 9 11:13:11 CDT 2006


Patrick R. Michaud wrote:
> 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
>     :)
> 
When I try this, all of the lines (including the opening and closing) 
appear in the page.  See Test/MultiLinePageTextVariables

>> (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
>       =]
> 
I've been testing with an escape [@...@] and that works well.

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

I'm not sure that "this include occurs a lot of times" is the problem. 
Each include occurs only 1x, but there are many 1x includes.

Pico


-- 

         __  /
        /   /
       /___/ _/  ___/  __  /
      /      /  /     /   /
    _/     _/  ____/ ____/

 >>>===pmwiki at ben-amotz.com===>




More information about the pmwiki-users mailing list