Jump to content

User:Franamax/Preview refs

From Wikipedia, the free encyclopedia

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

Overview

[edit]

The MediaWiki (MW) Cite extension allows footnoting to attribute sources and add notes, where source information is enclosed in <ref>...</ref> tags[1] and the <references /> tag is placed later in the page to format and output all the accumulated references, as shown here:

  1. ^ Example of tagging a reference

For most articles, the <references /> 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 <references /> tag or {{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 {{reflist}} template.

Known limitations

[edit]

Named references defined elsewhere in the article (with <ref name="example"> 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

[edit]
Task Notes
Add config variable $wgPreviewRefs Opt-in/out for individual sites
Add UI element in EditPage.php:
<checkbox> 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 tooltip Translate for other languages
Add help page for "what's this?" Translate for other languages
Add logic to "Show preview" button If preview-refs and Cite-installed, call Cite()
Add $preview parameter to Cite.php and Cite_body.php Or use a global variable?
If $preview set, output alternate error messages cite_preview_references_no_text instead of cite_error_references_no_text
Add system message cite_preview_references_no_text Translate for other languages
Add help page to explain the information message Translate for other languages
Bask in glory as thanks pour in Or blame someone else