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

Pico pmwiki at ben-amotz.com
Tue Oct 10 07:02:00 CDT 2006


Patrick R. Michaud wrote:
> On Mon, Oct 09, 2006 at 12:13:11PM -0400, Pico wrote:
>> Patrick R. Michaud wrote:
>>> 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
> 
> Oops, you're right.  Now fixed on pmwiki.org, it'll appear in the
> next release.
> 
> Thanks!
> 

Thank you.

I know I am very late in speaking up about this, but the more I think 
about the directive form of page text variables, the more I am bothered 
by its use for multi-line text.

The main issue is that it looks like a broken directive.  Are there 
other instances where a directive can include hard returns?  I am 
recalling multiple posts that warn authors to be sure to purge any line 
feeds when cut and pasting a directive from an e-mail.  If this is the 
only example of a directive (or markup that looks like a directive) that 
allows line returns, then maybe we are better off making this consistent 
with other directives and finding some other (multi-line) markup to use 
for multi-line page text variables.

Another issue is that whenever I would want to define multi-line page 
text variables, I would *not* want the content to be hidden by default. 
  As a result, I would always use the directive form, and then call the 
page text variable to display it.  That does not seem like a great 
solution for drafting, rendering, or editing.

My initial suggestion is to allow anchor markup to define the start (and 
end) of a multi-line page text variable.  Includes use them.  So does 
the fmt argument of pagelists.  If there was a need to distinguish these 
from other anchors, then perhaps you could supplement the anchor markup, 
for example:

[[#anchor1]]
[[#:anchor2]]

In either case, these two markups could be treated as ordinary anchors, 
but only the second form would also be treated as the opening for a page 
text variable.

To close these page text variable anchors, my preference would be to 
have them close with the very next anchor (or page text variable 
anchor), just as the fmt= argument appears to work in pagelist 
templates.  If more was needed, then perhaps an argument could be 
allowed to specify a different end point (just as you can with 
includes), but I would still argue that the default end point should be 
the next anchor, if exists, else end of page.

Pico
-- 

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

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




More information about the pmwiki-users mailing list