User:Franamax/Preview refs

This proposed change to MediaWiki will allow editors to optionally preview the formatted output of tags when editing sections of articles.

Overview

The MediaWiki (MW) Cite extension allows footnoting to attribute sources and add notes, where source information is enclosed in ... tagsExample of tagging a reference and the tag is placed later in the page to format and output all the accumulated references, as shown here:

For most articles, the tag is placed in a separate section, near the bottom of the article. When editing an entire page, the formatted output can be previewed and checked for errors, however the preferred mode of editing is per-section. When previewing a section, there is currently no method to check the references for errors, instead the section must be saved and the entire article redisplayed to check for reference errors. Alternatively, a tag or {{tl|reflist}} template can be placed temporarily in the section for preview purposes. Both these methods are time-consuming and error-prone.

We propose addition of an optional check-box on the edit screen which will cause the Preview function to duplicate the functionality of temporarily adding the {{tl|reflist}} template.

Known limitations

Named references defined elsewhere in the article (with and referred in the section being previewed will generate an error message. It is not feasible to scan the entire article for all references, due to prograsmming complexity and increased parsing time for large pages. Instead, an informational note will be shown instead of an error message. There is still a possibility that an editor may misspell a reference name.

Technical implementation

class="wikitable"

!Task!!Notes

Add config variable $wgPreviewRefsOpt-in/out for individual sites
Add UI element in EditPage.php:
Preview refs (what's this?)On the same line as "This is a minor edit" and "Watch this page"
Add system messages for UI text and tooltipTranslate for other languages
Add help page for "what's this?"Translate for other languages
Add logic to "Show preview" buttonIf preview-refs and Cite-installed, call Cite()
Add $preview parameter to Cite.php and Cite_body.phpOr use a global variable?
If $preview set, output alternate error messagescite_preview_references_no_text instead of cite_error_references_no_text
Add system message cite_preview_references_no_textTranslate for other languages
Add help page to explain the information messageTranslate for other languages
Bask in glory as thanks pour inOr blame someone else