Page MenuHomePhabricator

mapping templates ending in whitespaces result in faulty mapping
Closed, ResolvedPublic

Description

[Using SF3.4] When the mapping template ends in a whitespace [0], labels will get mapped with new values correctly, but instead of passing the label to the resulting page, sf passes the (mapped) value. e.g.:
say, mapping template maps {{{1}}} to {{{1}}}_mapped

when using [0] as a templatete, sf passes 'val1' as 'val1_mapped' as selected value to the resulting page instead of the expected 'val1'

proposed solution:
Patch SF_Utils' public static function getLabelsFromTemplate( $values, $templateName )
change line 709f from

$label = $wgParser->recursiveTagParse( '{{' . $templateName .
                  '|' . $value . '}}' );

to

$label = trim($wgParser->recursiveTagParse( '{{' . $templateName .
                  '|' . $value . '}}' ));

[0] erroneous template:

{{{1}}}_mapped
</noinclude><!-- this is my mapping template--> ... </noinclude>

[1] atm working:

{{{1}}}_mapped</noinclude><!-- this is my mapping template--> ... </noinclude>

Event Timeline

Oetterer raised the priority of this task from to Low.
Oetterer updated the task description. (Show Details)
Oetterer subscribed.

Thank you for the bug report. I have proposed a patch to fix it as well as corresponding fixes to mapping property and mapping cargo table/field: https://gerrit.wikimedia.org/r/249168.

@cicalese - I just merged in your patch. Thank you!

Is this problem fixed now?

Yaron_Koren claimed this task.

I'm assuming it was fixed...