Page MenuHomePhabricator

Add a parser option to do preSaveTransform within certain tag extensions
Open, Needs TriagePublicFeature

Description

As described in the wiki when an extension registers a new tag, signatures within the tag won't be expanded because preSaveTransform skips all registered tags.

I am currently working on an extension where it would be very useful to expand signatures within the tag of my extension.
And yes, I am aware of the {{#tag:tagname| workaround, however for my use case I need a tag instead of a parser function.

Another use case would be to allow the expansion of {{subst:}} within tag attributes, which would also be very handy.

Event Timeline

Related or duplicate: T4700 (that task is for a general solution, while this request it for a specific tag, maybe more a subtask as a duplicate)

Well I think that it would have to be a tag-specific setting. Because for some tags like <pre> and <syntaxhighlight> I think it's good that no preSaveTransform take place, but for other specific tags they would be desirable.

waldyrious awarded a token.
waldyrious subscribed.

I have written a patch implementing this a long time ago: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/607367 (but I never tried to get it reviewed and merged).

I managed to come up with a workaround for my extension using the ParserPreSaveTransformComplete hook: https://git.push-f.com/mw-vote/commit/?id=166d0fbe2f0355d81669b5fde9c2a9bc576da88a

It only handles the expansion of ~~~~ and obviously also expands it in cases where it shouldn't but it works good enough that this task is no longer blocking a core feature of my extension :)