Page MenuHomePhabricator

Pass parameters to parser functions without evaluating them
Closed, ResolvedPublic

Description

Author: zocky

Description:
If I correctly understand how the parser works, parameters for parser functions
are parsed _before_ they are passed to parser function hooks. This seems awfully
wasteful, especially for #switch and different flavours of #if, where big chunks
of code, including metatemplates, are often parsed and thrown away.

Parsing could be left up to the hook functions to do as needed, preferably with
a new way to set such hooks, so that the current extensions don't get broken.


Version: unspecified
Severity: enhancement

Details

Reference
bz8314

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:34 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz8314.
bzimport added a subscriber: Unknown Object (MLST).

ssanbeg wrote:

The simplest solution may be to add a magic word to defer parsing until later;
i.e. {{#myfn:{{first}}|{{defer:second}}}} would parse first before the function
is called, and second after.

Although I'm not quite sure how to add a new magic word, I was able to test this
by recycling an existing magic word, and it seems to work.

ssanbeg wrote:

*** Bug 9439 has been marked as a duplicate of this bug. ***

happy.melon.wiki wrote:

This behaviour was totally changed when the new preprocessor was implemented in 2008.