[pmwiki-devel] Multi-line field with PmForm
Petko Yotov
5ko at 5ko.fr
Thu Mar 4 06:16:02 CST 2010
On Thursday 04 March 2010 05:57:23, DaveG wrote :
> When using PmForm it looks like multi-line fields are stored in the base
> page with each %0a on a physically separate line, rather than the normal
> PmWiki way of storing the entire page text on a single line.
>
> Here's a snip of what I mean. I've edited from the real thing to avoid
> email wrapping, but this demonstrates the end effect:
>
> text=(:pmform savedata:)(:name:test
> %0amulti
> %0aline:)%0a(:email:djg:)%0a
>
>
> I believe it's caused by the definition of the $PageTextVarPatterns,
> since form data saved using an alternate pattern I also use does not
> cause this problem.
What exactly are the new lines? \n or \r, or aren't these just spaces with the
long line wrapped?
It could be just carriage returns \r that weren't removed by PmWiki before
saving the page.
> 1] Does it matter that the line is split? I've seen no ill-effects so
> far, but I'm not sure.
It may seem to work fine now, but I think for compatibility in the future, it
is better to fix it.
You should be able to remove the \r by adding such a replacement pattern to
config.php:
$PmFormPostPatterns['/\r/'] = '';
I think this should be added as default in the pmform.php script.
> a) In particular what does (?!\\)) do? It seems to be "A zero-width
> negative look-ahead assertion."[1], and so seems to be matching
> something not followed by a ) -- I presume it's preventing false :)
> matches.
It prevents (:linebreaks:) to be considered and removed as a PTV -- the ")"
after the second ":" will cause the string to be skipped.
> b) In the next section \\s?) the closing ) seems to be left hanging.
> Obviously it isn't, so what does it match?
It closes the very first "(" on that line. It matches the beginning of the PTV
definition, but it is not used in the processing. See Pm's announcement:
http://article.gmane.org/gmane.comp.web.wiki.pmwiki.user/42757/
Petko
More information about the pmwiki-devel
mailing list