Page MenuHomePhabricator

extensions are parsed before template variable substitution
Closed, DuplicatePublic

Description

Author: lcureel

Description:
It seems there is a parse order bug either in the extension code or in the template processor.

I discovered this while trying to pass arguments to a template containing google map extension code.

I wanted to say:

<googlemap version="0.9" lat={{{lat|"47.1160849"}}} lon="-88.588851" type="map" zoom="15" selector="no" scale="yes" overview=yes controls="large">

But but no substitution worked.

I even tried making the google maps start tag be the default argument to a template parameter.

{{{foo|<googlemap version="0.9" lat="47.1160849" lon="-88.588851" type="map" zoom="15" selector="no" scale="yes" overview=yes controls="large">}}}

The wiki page here is displayed as:

{{{foo
[followed by the map]

This indicates that the google tags are processed first and gobble up the closing }}} of the template parameters.

This is clearly a parse order bug as the template parameters should be processed and replaced prior to any other processing on the page.

So, okay - I think maybe I am misunderstanding the way code is processed in the wiki.
But then I try to make a template containing an image map using Tim Starling's extension.

At first I try to pass a parameter to change the width of the image, but it doesn't work, so I try to change the alt text for the image,

Template:
<imagemap>
Image:bhk.jpg|{{{1}}}
rect 13 5 112 58 [[centennial]]
desc bottom-left
</imagemap>

Page:
{{Map|Alt Text}}

which results in the following html code:

<img alt="{{{1}}}" src="/images/Bhk.jpg" width="1048" height="797" border="0" usemap="#ImageMap_1"/>

Which just seems wrong. I feel like the template parameters should never show up in the html output.
Again, it appears the template variables are substituted after extension code has been parsed out.


Version: 1.13.x
Severity: normal

Details

Reference
bz15307

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:22 PM
bzimport set Reference to bz15307.
bzimport added a subscriber: Unknown Object (MLST).
  • This bug has been marked as a duplicate of bug 2257 ***