Last modified: 2009-07-19 17:46:05 UTC
"Copy markup from page Xyz" is an extremely common instruction when telling people how to make edits in MediaWiki. Yet this is extremely complicated and prone to error. If users just visit the page, they don't get the markup, but if you tell users to edit page Xyz, select its markup and copy it, the moment users visit they're presented a UI that doesn't match what you want them to do — it encourages them to edit, tells them to preview, asks for a summary, etc. It also wastes CPU, MediaWiki renders the page, then renders the complicated editing UI.
Instead MediaWiki should have a dedicated action to view markup.
The code for this action is already present in MediaWiki! On many wikis, if you view a protected page, the  tab turns into [View source], and if you choose the edit action you're presented with an uneditable text box with the markup and "You can view and copy the source of this page". See e.g. http://semanticweb.org/index.php?title=MediaWiki:Smw_import_foaf&action=edit So all that's needed is an action that triggers this behavior, with a slightly different introductory paragraph. Maybe reuse the optional parameter &preview to show what the markup looks like.
* I have a mild preference for action=view_markup because I confuse MediaWiki's "view source" with my browser's "View source", but I don't feel strongly about the terminology.
* action=raw eventually provides the markup of a page, but it's way too user-unfriendly: it triggers a download dialog and "What should Firefox do with this file", and lacks the explanatory "You can view and copy the source of this page".
* http://www.mediawiki.org/wiki/Manual:Creating_pages_with_preloaded_text discusses workarounds for for the specific case of creating a new page from a template, e.g. using the CreateBox extension.
Maybe there should be
or format=text/plain... (sounds like the API)
type of overriding possibilities...
>It also wastes CPU, MediaWiki renders the page, then renders the
> complicated editing UI.
The editing UI is rendered-client (toolbar et al.). Messages are cached.
It's not a problem.
(In reply to comment #1)
> Maybe there should be
> action=raw&Content-Type=text/plain or
> action=raw&content-type=text/plain etc.
> or format=text/plain... (sounds like the API)
> type of overriding possibilities...
That's a different bug, you're welcome to file it. This bug requests the same user-friendly, in-wiki presentation of markup that action=edit ''already'' implements (but only when the page is protected).
(In reply to comment #3)
> (In reply to comment #1)
> > Maybe there should be
> > action=raw&Content-Type=text/plain or
> > action=raw&content-type=text/plain etc.
> > or format=text/plain... (sounds like the API)
> > type of overriding possibilities...
> That's a different bug, you're welcome to file it.
Bug 8775 "ctype=text/plain" is WONTFIX. See bug for details.
And bug2845#c13 says why they don't just use text/plain in the first place.
Source is available in editing view. There's no benefit to adding a second way to get at the same thing, but arbitrarily restricted.