On Sat, Oct 3, 2015 at 9:06 PM, Thierry <[email protected]> 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: ===(snip)=== $PageTextVarPatterns = array( 'var:' => '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m', '(:var:...:)' => '/(\\(: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\))/s' ); ===(snip)=== You could extend this specifically for a variable named "Abstract" as follows: $PageTextVarPatterns['abstract'] = '/^(:*\\s*(Abstract)\\s*:[ \\t]?)(.*?)(\\n(?::*\\s*(?:\\w[-\\w]*)\\s*:))/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*:[ \\t]?)(.*)($)/m'; ** or a negative lookbehind (?<!Abstract) before the second \\s* *** $PageTextVarPatterns['var:'] = '/^(:*\\s*(\\w[-\\w]*)(?<!Abstract)\\s*:[ \\t]?)(.*)($)/m'; * Same caveat re typos, thinkos, etc on the regexes above. -Peter
_______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
