[pmwiki-users] PTVs on multiple lines

Petko Yotov 5ko at 5ko.fr
Sun Oct 18 13:57:44 CDT 2015


Indeed, I don't think single line PTV definitions should include 
linebreaks before or after the colons. If someone does not provide 
arguments for those, I'll remove them.

We're talking about cases like these:

   :
   name
   : value

or (more than one linebreak):

   name

   : value

Only such a cases should be supported:

   : name : value
   name : value

> (:hidden:
> some
> text:)
> 
> also text:) was seen as a PTV with name 'text' and value')'

We probably should not modify this; there is a possibility that a single 
line PTV starts with the ")" character. There is also a possibility that 
a hidden multiline PTV contains a number of single line PTVs:

(:hidden:
var1: value 1
var2: value 2
var3: value 3
etc:)

As long as the {$:hidden} variable contains all text, this is not a bug.

Petko

-- 
Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades


On 2015-10-18 14:03, Hans Bracker wrote:
> I like to question the PTV definition for simple text and definition
> list PTVs. (pmwiki.php line 156):
> 
>   'var:'        => '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m',
> 
> I created a test page to demonstrate this:
> http://www.pmwiki.org/wiki/Test/MultilinePTVs
> 
> I do not see the point why the pattern allows the colon to be on the
> line below, or even several lines below. I think it should not allow
> this. So cases 2, 3 and 5 should not be rendered as PTVs.
> (In case 5 the definition list item is not rendered as such, but as PTV
> nonetheless, but this is beside my point)
> 
> For PTVs as directives (I call them hidden PTVs) the middle colon on
> a subsequent line is disallowed (case 7), which is good, and the
> variable text can span multiple lines (cases 8 and 9), which is also
> good, and I use this  a lot.
> 
> This issue of having the colon on the next or later line came up for
> me when writing a new script, with a part checking for PTVs, where
> for a hidden PTV as in case 8 or 9 also a text PTV was rendered, with
> the last part of the hidden PTV value. So for
> 
> (:hidden:
> some
> text:)
> 
> also text:) was seen as a PTV with name 'text' and value')'
> 
> To resolve the issues I like to request that the pattern be changed to
> disallow the colon on the next line(s), i.e. to:
> 
>   'var:'        => '/^(:*\\s*(\\w[-\\w]*)[ \\t]*:[ \\t]?)(.*)($)/m',
> 
> Maybe I missed something important why the pattern allows the colon on
> a next line, but otherwise this could be a PITS entry.
> 



More information about the pmwiki-users mailing list