Reputation: 4648
I'm tring to use the {{PAGENAME}}
magic word in a regular expression to include an article based on the value of a parameter passed to a template. When I use the following statement with the article name hard-coded it correctly selects the articles I want:
includematch = /reportType\s*=\s*AccountReport/s
However, when I transclude the DPL into the AccountReport
article, the following doesn't work:
includematch = /reportType\s*=\s*{{PAGENAME}}/s
Does anyone know what I'm doing wrong? Is {{PAGENAME}}
being parsed before being used in the regular expression or is it trying to match the literal string?
Upvotes: 1
Views: 375
Reputation: 11
The way the dpl code is read makes it impossible for it to read the magic word. Use the dpl extension instead:
{{#dpl|code goes here}}
Upvotes: 1
Reputation: 4648
I was using the DPL tag <dpl>
but it wasn't parsing {{PAGENAME}}
before applying the regular expression. When I changed it to use the parser function {{#dpl:
then {{PAGENAME}}
was evaluated and used within the regular expression as I required.
Upvotes: 1