Skip Menu |

This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id: 125303
Status: new
Priority: 0/
Queue: XML-Twig

People
Owner: MIROD [...] cpan.org
Requestors: chrispitude [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 3.52
Fixed in: (no value)



Subject: add more detail to wrap_children documentation
Please note the following in the wrap_children documentation (simple list form is fine): * Inside tag brackets, only '.' is treated as a special regex character. * Outside tag brackets, regex works normally (including lookaheads and lookbehinds). * '^' and '$' is interpreted as the beginning and end of children in the current twig. You could also provide the following example, which adds topic hierarchy to flat content with h1/h2/h3 heading tags: $body->wrap_children('<h3>.*?(?=(<h1>|<h2>|<h3>)|$)', topic => {}); $body->wrap_children('<h2>.*?(?=(<h1>|<h2>|<h3>)|$)', topic => {}); $body->wrap_children('<h1>.*?(?=(<h1>|<h2>|<h3>)|$)', topic => {}); It demonstrates several capabilities, such as minimal matching, plus matching to the next match OR to the end-of-twig.
Actually, lookaheads work, BUT lookbehinds don't work because the '<' in the lookbehind expression causes issues with the tag recognition. :(
I filed a Git pull request to implement these documentation updates: https://github.com/mirod/xmltwig/pull/34