Page MenuHomePhabricator

frame:expandTemplate doesn't work with parser functions
Closed, ResolvedPublic

Description

frame:expandTemplate does not work on parser functions. I didn't test #style but at the very least fullurl doesn't work with it.

This would be problematic for the same reason it's problematic for templates.


Version: unspecified
Severity: normal

Details

Reference
bz41769

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:12 AM
bzimport set Reference to bz41769.

yperret wrote:

As far as I know parser functions are not "real" templates (but it uses the same syntax so...).

Calling "fullurl" works if you use frame:preprocess() rather that frame:expandTemplate().

Whatever in my opinion all these functions should be mapped inside mw module, including pseudo-templates such as {{PAGENAME}} and others.

Regards,

(In reply to comment #1)

As far as I know parser functions are not "real" templates (but it uses the
same syntax so...).

Calling "fullurl" works if you use frame:preprocess() rather that
frame:expandTemplate().

frame:preprocess() does not handle argument data directly. It's far to unreliable to use when you have user specified data. And iirc with what I remember of the way our parser works with it's handling of variables, it's actually impossible to use frame:preprocess in every situation that frame:expandTemplate would work.

yperret wrote:

That's true. It can be used as a workaround but not for general use.

Whatever I still think that the best way is to treat these features at Lua/C level in order to avoid calling preprocess/expandTemplate.
It is what is expressed in http://www.mediawiki.org/wiki/Extension:Scribunto/Deployment_priorities#Should_have (the goal of Lua is to avoid calling too much mediawiki preprocess stuff, after all).

Something like mw.parserfunctions maybe, or something with dedicated submethods such as mw.page, mw.tools, ...

Gerrit change 52060
Gerrit change 52061

Merged. Note this will likely be deployed along with 1.22wmf1, see https://www.mediawiki.org/wiki/MediaWiki_1.22/Roadmap for the schedule.

Is gerrit 52060 necessary for Scribunto compatibility with MW 1.21? If so, should it be backported?

(In reply to comment #6)

Is Gerrit change #52060 necessary for Scribunto compatibility with MW 1.21?

Only if you want to use a version of Scribunto later than 0dc45ff2f89b8a6b90cee7e0c1fb70e2a38985f1.

(In reply to comment #7)

(In reply to comment #6)

Is Gerrit change #52060 necessary for Scribunto compatibility with MW 1.21?

Only if you want to use a version of Scribunto later than
0dc45ff2f89b8a6b90cee7e0c1fb70e2a38985f1.

I take that to mean the change is *not* supposed to be released as part of 1.21.
Fine with me.

(In reply to comment #8)

I take that to mean the change is *not* supposed to be released as part of
1.21.
Fine with me.

Take it more literally: If 1.21 should be compatible with a version of Scribunto later than 0dc45ff2f89b8a6b90cee7e0c1fb70e2a38985f1, then this would need to be backported.

Related URL: https://gerrit.wikimedia.org/r/59637 (Gerrit Change I339b882010dedd714e7965e25ad650ed8b8cd48f)

Change 95391 had a related patch set uploaded by MarkAHershberger:
(bug 41769) Add frame:callParserFunction() and frame::extensionTag()

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

Change 95391 merged by MarkAHershberger:
(bug 41769) Add frame:callParserFunction() and frame::extensionTag()

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

No open patches to review here (backport patch to REL_1_21 got merged), hence resetting status to RESOLVED FIXED. Backport_to_Stable flag might be set to "+" by hexmode.