Last modified: 2014-04-17 21:39:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64716, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62716 - Broken template expansion with nested template parameters
Broken template expansion with nested template parameters
Status: RESOLVED FIXED
Product: Parsoid
Classification: Unclassified
DOM (Other open bugs)
unspecified
All All
: High normal
: ---
Assigned To: ssastry
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-16 18:19 UTC by Kelson [Emmanuel Engelhart]
Modified: 2014-04-17 21:39 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kelson [Emmanuel Engelhart] 2014-03-16 18:19:45 UTC
Would be great to add support of the date and time related magic words:
https://www.mediawiki.org/wiki/Help:Magic_words#Date_and_time

This affects rendering of pages using them in many ways, for example in certain use cases, this breaks transclusions (see {{Wîkîpediya:....):
http://parsoid.wmflabs.org/_rt/kuwiki/Destp%C3%AAk?oldid=614600
Comment 1 Gabriel Wicke 2014-03-16 19:21:34 UTC
We are using the PHP preprocessor's implementation of these magic words. I looked at your example, and it seems that we don't properly expand the following wikitext:

{{Wîkîpediya:Di dîrokê de îro/{{CURRENTDAY}}'ê {{#ifeq:{{CURRENTMONTHNAME}}|reşemî|reşemiyê|{{CURRENTMONTHNAME}}ê}}}}

In data-mw HTML the nested ifeq is listed as a separate part, which looks wrong. So this seems to be a general template expansion issue rather than specific to these magic words. Adjusting the title to reflect this.
Comment 2 Gabriel Wicke 2014-03-17 19:16:11 UTC
I'm also seeing an error when parsing this article locally:
TypeError: Cannot read property 'dataAttribs' of undefined
    at WikitextSerializer.escapeTplArgWT (/home/gabriel/src/parsoid/lib/wts.escapeWikitext.js:732:46)
    at pushArg (/home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:536:28)
    at /home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:553:7
    at Array.forEach (native)
    at /home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:550:16
    at Array.map (native)
    at WikitextSerializer.WSP._buildTemplateWT (/home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:487:11)
    at Object.handle (/home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:655:30)
    at WikitextSerializer.WSP._serializeNode (/home/gabriel/src/parsoid/lib/mediawiki.WikitextSerializer.js:1036:30)
    at SerializerState.SSP.serializeChildren (/home/gabriel/src/parsoid/lib/wts.SerializerState.js:110:32)
SPAN { handle: [Function], sepnls: { before: [Function] } }
error in kuwiki:Destpêk
Error
    at LogData.stack (/home/gabriel/src/parsoid/lib/LogData.js:82:53)
    at LogData.fullMsg (/home/gabriel/src/parsoid/lib/LogData.js:37:32)
    at Logger._defaultBackend (/home/gabriel/src/parsoid/lib/Logger.js:141:24)
    at /home/gabriel/src/parsoid/lib/Logger.js:163:24
    at /home/gabriel/src/parsoid/node_modules/async/lib/async.js:511:21
    at /home/gabriel/src/parsoid/node_modules/async/lib/async.js:227:13
    at /home/gabriel/src/parsoid/node_modules/async/lib/async.js:111:13
    at Array.forEach (native)
    at _each (/home/gabriel/src/parsoid/node_modules/async/lib/async.js:32:24)
    at async.each (/home/gabriel/src/parsoid/node_modules/async/lib/async.js:110:9)
Comment 3 ssastry 2014-03-18 15:34:57 UTC
The problem here seems to be that the template target comes from expanding the {{#ifeq}} .. Wîkîpediya:Di dîrokê de îro/18'ê adarê .. I don't think our template expansion pipeline handles this scenario yet.

Test: echo "{{ech{{echo|o}}|foo}}" | node parse

The error in Comment 2 probably comes from the serializer when you try to roundtrip the incorrectly parsed page with bogus data-mw attributes.
Comment 4 Gabriel Wicke 2014-03-18 16:34:58 UTC
I'm 99% certain that we used to handle this, so I'm suspecting that it got broken along the way. With the PHP preprocessor we pass the entire string to the API anyway. Maybe it got broken when we tried to distinguish between templates and parser functions?
Comment 5 Gerrit Notification Bot 2014-03-19 19:21:28 UTC
Change 119540 had a related patch set uploaded by Subramanya Sastry:
WIP: Bug 62716: Fix buggy 'isConvertibleToString'

https://gerrit.wikimedia.org/r/119540
Comment 6 Gerrit Notification Bot 2014-03-19 23:39:13 UTC
Change 119540 merged by jenkins-bot:
(Bug 62716) Fixed bug in detecting unresolvable tpl targets.

https://gerrit.wikimedia.org/r/119540

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links