Last modified: 2010-05-15 14:35:49 UTC
It should be possible to show the wiki source of a page, regardless of how it was rendered. Currently, this is not possible; layers of templates and template parameters can make the "source" one sees far removed from the generated content. To truly make content available for easy reuse in another wiki, it should be possible to extract a cleaner source copy than the HTML source of the rendered browser page. In the same sense, MW should offer "show wiki source" for the page /it/ renders.
Created attachment 1206 [details] proposed patch Here's a patch - I don't know how robust it is. Please test! To use it, specify action=raw&expandtemplates=true in the url.
Created attachment 1208 [details] Improved patch Improved the patch a bit and cleaned up some code, there's still an issue with it (and yours) it only does replacing of first-level templates, not second-level, third leve...
To get arbitrary-level expansion, it looks to me as if we want to use $wgParser->replaceVariables instead of $wgParser->transformMsg. However, this method is marked private in the comments, and I don't know how to invoke it correctly.
Created attachment 1211 [details] Updated patch, expand all templates This patch should expand all templates, including those hidden inside other templates.
FIXED in CVS HEAD