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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to