I'm writing an extension that enables pages in a particular namespace to be stored and edited in a special notation. The extension converts that notation into wiki markup for display. I've tried adding a hook for ParserBeforeInternalParse or ArticleAfterFetchContentObject.
ParserBeforeInternalParse works fine except for one problem. Not only the page content gets converted, but also the part of the footer that says "This page has been accessed ... times", and also some of the text shown for the "View History" tab (and probably other pieces of user-interface text that I'm not aware of). One solution would be to embed some unique identifying string in the notation, or surround the notation with a a unique tag, but I hope to avoid that. The extension checks getTitle()->getNamespace() so that it only converts text for the appropriate namespace. I'm hoping something similar can distinguish page content from other text.
ArticleAfterFetchContentObject also works fine except for a different (similar) problem. The page content is converted even when the user selects the "Edit" tab. It's important that the "Edit" tab should bring up the notation as it's stored, unconverted.
Without embedding any special text in the page content, can the handler for ParserBeforeInternalParse recognize when it's being called for page content rather than for footer/history/etc.? Or can the handler for ArticleAfterFetchContentObject recognize when it's being called for the "Read" tab as opposed to the "Edit" tab?
Alternatively, is there a different hook that would serve this purpose better?
Thanks and best wishes,
Tom
ParserBeforeStrip? I'm not sure I completely understand what you are doing, but that's what I use for modifying the saved wikitext. I don't recall seeing any of the other things you mention.
On Sep 21, 2013, at 3:28 PM, Tom Bishop, Wenlin Institute wrote:
I'm writing an extension that enables pages in a particular namespace to be stored and edited in a special notation. The extension converts that notation into wiki markup for display. I've tried adding a hook for ParserBeforeInternalParse or ArticleAfterFetchContentObject.
ParserBeforeInternalParse works fine except for one problem. Not only the page content gets converted, but also the part of the footer that says "This page has been accessed ... times", and also some of the text shown for the "View History" tab (and probably other pieces of user-interface text that I'm not aware of). One solution would be to embed some unique identifying string in the notation, or surround the notation with a a unique tag, but I hope to avoid that. The extension checks getTitle()->getNamespace() so that it only converts text for the appropriate namespace. I'm hoping something similar can distinguish page content from other text.
ArticleAfterFetchContentObject also works fine except for a different (similar) problem. The page content is converted even when the user selects the "Edit" tab. It's important that the "Edit" tab should bring up the notation as it's stored, unconverted.
Without embedding any special text in the page content, can the handler for ParserBeforeInternalParse recognize when it's being called for page content rather than for footer/history/etc.? Or can the handler for ArticleAfterFetchContentObject recognize when it's being called for the "Read" tab as opposed to the "Edit" tab?
Alternatively, is there a different hook that would serve this purpose better?
Thanks and best wishes,
Tom
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
mediawiki-l@lists.wikimedia.org