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.