Author: a.d.bergi
Deployment:
This ticket has been implemented, please read about this new feature and its deployment plan at https://www.mediawiki.org/wiki/Editing/Projects/Columns_for_references . This is an *opt-in feature* everywhere.
This means that, when editing a group of references, it is possible to choose that the columns are responsive. Only some wikis have that flag enabled by default instead. See the MediaWiki page linked above to request that it becomes a default option at your wiki.
Original description:
The German Wikipedians would like to format the references list in multiple columns (http://de.wikipedia.org/wiki/Wikipedia:Umfragen/Multicol). This CSS3 technique is already used on en:wp, but there it is tied to a template.
We do not want to make the same mistake: templates are evil, mostly because another new syntax would be confusing, they cost (little) parser resources, and they would have to be spread over all articles. A native implementation would be much cleaner, and hereby I'd like to request one.
Of course it would be quite simple for us to just add some lines of code to MediaWiki:common.js, but that doesn't fulfil our requirements.
The points mostly named are:
- It should be simple: a plain <references /> should do everything automatically.
- Very few lines of references don't look good as columns. An automatic solution can't be done with templates; I'd propose counting the ref-tags to display and when the count is higher than an integer variable (configurable as a system message) a "column"-class should be added to the list tag.
- There will always be cases where the automation doesn't work or the article author wants something special. So he must be able to set the layout manually (on/off). This /could/ be done by solving T8019; which should be not that difficult, see r81865 for example), but I think a simple on/off switch per parameter would be enough.
- Different colum widths should be settable, fitting to the content (size of the ref-tags). I don't think this is automatable, it's just that there should be an option to change it.
Implementing the ref-count and fixing T8019 would be enough, but I think we should implement a more specific solution that also prohibits uncontrolled usage.
I would propose the following algorithm (for each <references />-tag):
- Fetch "cite colums autonumber", "cite columns autoclass" and all "cite colums width-*" system messages. The first should contain an integer, the latter ones DOMStrings.
- Look if the references-tag has a "columns"-attribute
- If so, look up whether its value fetches the name of one of those "cite_columns_width-..." messages
- If so, use the message content as the class name
- Else set the class empty. E.g. values like columns="none" could be used the prevent multicoumn layout.
- When there is no attribute, count the <ref>-tags which should get displayed in the current list. If that number is higher than (or equal to) the "cite columns autonumber"-message,
- then use the content of the "cite columns autoclass"-message as the class name
- else set the class empty
- If so, look up whether its value fetches the name of one of those "cite_columns_width-..." messages
- Add the class name to the "class" attribute of the ol-element (behind the "references ").
This should allow the wiki admins a very precise, local configuration (with Mediawiki-messages and the local CSS files), and make the usage of this feature as simple as possible.