Last modified: 2014-02-04 10:57:25 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 T19131, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17131 - Feature Request: Transclusion Preprocessing Hook
Feature Request: Transclusion Preprocessing Hook
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Low enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: need-parsertest
Depends on:
Blocks: 1605
  Show dependency treegraph
 
Reported: 2009-01-23 17:11 UTC by Kinsey Moore
Modified: 2014-02-04 10:57 UTC (History)
2 users (show)

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


Attachments
Transclude Hooks (1.33 KB, patch)
2009-01-26 16:45 UTC, Kinsey Moore
Details

Description Kinsey Moore 2009-01-23 17:11:03 UTC
I'd like to have access to templates and other transcluded pages, pre-transclusion (and before subtransclusions take place), so that I may do some rendering modifications on the wikitext in a context sensitive manner.  There is currently no way to do this as far as I know.  I relate this to the ParserAfterStrip hook that is called on source documents before templates and other variables are expanded.  I'm sure such a hook could also be useful to the community at large for other purposes.  Poking at the code, I've found that I can insert a hook near the end of the braceSubstitution function in Parser.php and have it work as intended (though I haven't done any exhaustive testing).
Comment 1 Kinsey Moore 2009-01-23 20:35:37 UTC
I'm fairly sure that braceSubstitution is the best function for this hook.  I'm beginning to think that the proper location is just before this line:
wfProfileOut( __METHOD__ . '-loadtpl' );
I'm still undecided on what exactly should get passed to the hook other than the text.  Also, I need to check to see if the text there is in DOM format or not.  I'll see what I can hammer out this weekend if no one has a better suggestion.
Comment 2 Kinsey Moore 2009-01-26 16:45:59 UTC
Created attachment 5732 [details]
Transclude Hooks

I'm sure this patch is wrong in some way, but I'd appreciate some hints on how to improve it.  Right now, it attempts to cover both local and interwiki transcludes.
Comment 3 Kinsey Moore 2009-01-26 16:47:09 UTC
Also, I'm currently using the ParserAfterStrip hook.  I'm not sure if I want to make a new hook or use this one.  It's open to debate.
Comment 4 Kinsey Moore 2009-01-27 04:31:15 UTC
Setting this to need-review
Comment 5 au 2012-06-17 18:41:02 UTC
Hi Kinsey, thank you for the patch!

As you may already know, MediaWiki is currently revamping its PHP-based parser
into a "Parsoid" prototype component, to support the rich-text Visual Editor
project:

   https://www.mediawiki.org/wiki/Parsoid
   https://www.mediawiki.org/wiki/Visual_editor

Folks interested in enhancing the parser's capabilities are very much welcome
to join the Parsoid project, and contribute patches as Git branches:

   https://www.mediawiki.org/wiki/Git/Tutorial#How_to_submit_a_patch

Compared to .diff attachments in Bugzilla tickets, Git branches are much easier
for us to review, refine and merge features together.

Each change set has a distinct URL generated by the "git review" tool, which
can be referenced in Bugzilla by pasting its gerrit.wikimedia.org URL as a
comment.

If you run into any issues with the patch process, please feel free to ask on
irc.freenode.net #wikimedia-dev and the wikitext-l mailing list. Thank you!
Comment 6 Gerrit Notification Bot 2013-12-22 14:33:38 UTC
Change 103238 had a related patch set uploaded by Cptanu:
Included a hook to have access to templates and other transcluded pages.

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

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


Navigation
Links