mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 17:59:29 +02:00
Use recursive regex to deal with nested braces.
- Fix: Properly handle templates that include other templates. Addresses #29.
This commit is contained in:
@ -464,7 +464,9 @@ class Extension {
|
|||||||
|
|
||||||
if ( $wgLinkTitlesSkipTemplates )
|
if ( $wgLinkTitlesSkipTemplates )
|
||||||
{
|
{
|
||||||
$templatesDelimiter = '{{[^}]+}}|';
|
// Use recursive regex to balance curly braces;
|
||||||
|
// see http://www.regular-expressions.info/recurse.html
|
||||||
|
$templatesDelimiter = '{{(?>[^{}]|(?R))*}}|';
|
||||||
} else {
|
} else {
|
||||||
// Match template names (ignoring any piped [[]] links in them)
|
// Match template names (ignoring any piped [[]] links in them)
|
||||||
// along with the trailing pipe and parameter name or closing
|
// along with the trailing pipe and parameter name or closing
|
||||||
|
Reference in New Issue
Block a user