Page MenuHomePhabricator

New Hook: "InternalParseBeforeSanitize"
Closed, ResolvedPublic

Description

adds a new hook 'InternalParseBeforeSanitize' to the parser

I am in need for a new hook, making it possible to change parser output before it goes to the sanitizer. This is the second extension I am working on which would profit from this.
The first time I was able to build around this by using 'InternalParseBeforeLinks' hook, calling Sanitizer::removeHTMLtags() manually on the newly inserted stuff. Now I had to run the whole sanitizer on the whole text for a second time.

I guess calling the sanitizer just once would be faster and the new hook would be more suitable for extension development. One suitable name could be 'InternalParseBeforeSanitize'. See my patch for details.


Version: 1.19
Severity: enhancement

attachment InternalParseBeforeSanitize.patch ignored as obsolete

Details

Reference
bz34678

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:12 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz34678.
bzimport added a subscriber: Unknown Object (MLST).

You should also add this hook to doc/hooks.txt

equal to previous patch but with hooks documentation updated

Thanks Reedy, I wasn't aware of that list. I will also create the hooks documentation on mediawiki.org as soon as it's implemented.

Attached:

sumanah wrote:

Daniel, would it be reasonable for you to submit this into Gerrit?

Sure Sumana, almost forgot about this since I am not working on these extensions currently but I'll submit it soon.