Page MenuHomePhabricator

VisualEditor: Warn user when saving page with <ref>s but not <references />
Closed, InvalidPublic

Description

When a user saves a page, VE should check for references (<ref>s) created without the de-referencing block (<references /> or {{reflist}} or...) and intervene:

  • prompt them to fix before saving (out of the notices area?);
  • refuse to save before fixed (grey out the save button?); or
  • auto-fix for them (insert a "== References ==\n<references />" section just above the categories), though this (a) sucks, (b) enforces a particular wiki's style on other wikis in code, and (c) would be difficult to internationalise

Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=54906
https://bugzilla.wikimedia.org/show_bug.cgi?id=51260

Details

Reference
bz45132

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:37 AM
bzimport set Reference to bz45132.

Currently this would require scanning for the exact html it outputs as the <span style="color:red;">...</a> tag. Which can be tricky to do reliably.

Though the Cite extension could perhaps be the first to give their elements some kind of standard attribute for parse errors, it should probably do more like the TemplateData extension: Refuse to save without it and show a warning there instead. Then the API will return to VE with a nice { error: .. } block containing a error code which we can use to fetch a localised message.

Bug 50779 makes it easy to accidentally delete the references list, so this should check for its presence every save not just when references have been added.

  • Bug 51910 has been marked as a duplicate of this bug. ***

The auto-fix option in comment 0 has been requested today by en.wp user Mahitgar. If the issues noted can be overcome, then it would be the most user-friendly way forward.

Regarding those issues, it is not obvious why this "sucks" - please could you elucidate?

Internationalisation of the section title could (I guess easily) be achieved by inserting the contents of a MediaWiki page instead of something defined in code. e.g. the equivalent of

{{subst:MediaWiki:Refsection title}}

<{{subst:MediaWiki:Reflist function name}} />

This doesn't solve the option of imposing en.wp style on other wikis though.

(In reply to comment #4)

The auto-fix option in comment 0 has been requested today by en.wp user
Mahitgar. If the issues noted can be overcome, then it would be the most
user-friendly way forward.

Regarding those issues, it is not obvious why this "sucks" - please could you
elucidate?

Internationalisation of the section title could (I guess easily) be achieved
by
inserting the contents of a MediaWiki page instead of something defined in
code. e.g. the equivalent of

{{subst:MediaWiki:Refsection title}}

<{{subst:MediaWiki:Reflist function name}} />

This doesn't solve the option of imposing en.wp style on other wikis though.

Blindly putting the references section at the end of the article seems to not be great (it'd be after the "external links" and "see also" sections, and after any stub or thematic templates).

The last thing I want us to be doing is adding more error messages. I really think that we can get away with actually fixing the error for people.

I'd rather see us put it in the wrong place and someone have to fix it than us give the user an error they probably don't know how to fix.

Can we do a quick audit of major sites and where they put the reference list? I worry we're worrying a bit too much about about negative feedback that might not be as big a deal as we might think.

Deskana subscribed.

This probably doesn't really matter any more, since the absence of a references template will simply cause the references to display at the end of the page.