[pmwiki-users] PageList vs WikiForm for multi-line variables
pbowers at pobox.com
Mon Oct 5 03:44:02 CDT 2015
On Sat, Oct 3, 2015 at 9:06 PM, Thierry <pmwiki at lma.metelu.net> wrote:
> My question is: how to let PageList understand that the content of the
> "Abstract" field is all the lines that appear between ":Abstract:" and the
> definition of the next variable in the page ?
Currently $PageTextVarPatterns is defined in pmwiki.php as:
$PageTextVarPatterns = array(
'var:' => '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m',
'(:var:...:)' => '/(\\(: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\))/s'
You could extend this specifically for a variable named "Abstract" as
$PageTextVarPatterns['abstract'] = '/^(:*\\s*(Abstract)\\s*:[
Potential problems with the proposed solution:
* I typed this into an email editor and so I very well (almost certainly)
might have messed up the regex (mis-matched parens, typos, thinkos, etc.)
* Now both the 'var:' and the 'abstract' definition will match 'Abstract:'
variable defs - not sure what implications that will have - you may need to
complicate the 'var:' definition to match any variable but Abstract
probably by means of
** a negative lookahead (?!Abstract) after the first \\s*
*** $PageTextVarPatterns['var:'] = '/^(:*\\s*(?!Abstract)(\\w[-\\w]*)\\s*:[
** or a negative lookbehind (?<!Abstract) before the second \\s*
*** $PageTextVarPatterns['var:'] =
* Same caveat re typos, thinkos, etc on the regexes above.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pmwiki-users