Hi!
We at plwiki are in progress of refactoring the inplementation of standard {{mbox}} template family and unifying them into a single template. One of the tasks is to port these to TemplateStyles, instead of relying on global styles defined in MediaWiki: namespace.
While it's quite easy for majority of the templates, an issue is {{fmbox}}, which is commonly used on special pages, edit intros, and edit notices. In these places, TemplateStyles don't work out of the box. An approach that I've thought of is to automatically wrap the actual message box with div of mw-parser-output class if the template is transcluded in these places, so as to enable TemplateStyles. (And do it conditionally, to have a common mbox for in-content and in-interface messages).
Detecting whether we're at a special page should be pretty easy – checking the {{NAMESPACE}} should suffice. However, I don't think this will work for e.g. edit notice (I'd get the namespace of the edited page).
So here comes the question: is there a reliable way to check when a template is transcluded outside of the standard page content (i.e. outside of .mw-parser-output)? Or, alternatively, to safely enable TemplateStyles in all places a template can be transcluded in, without breaking anything related to actual wiki content?
Regards and thanks in advance,
Marcin
User:Msz2001