Allow references to be listed with letters
OpenPublic

Description

Author: aleonard1

Description:
First of all, the <ref> system was a godsend. Even better when I discovered the "hack" using {{#tag to nest them, which makes footnoting and citing footnotes so much easier. But right now, to have the two separate classes of footnotes, I have to give one an unsightly name. For example, right now, on http://en.wikipedia.org/wiki/List_of_Governors_of_New_Jersey I use <ref group='N'> for footnotes, and just regular <ref> for citations. That way, citations are rendered [1], [2], etc, and displayed at the bottom, while footnotes, rendered [N 1], [N 2], etc., are displayed earlier, through <references group='N'>.

My suggestion: Allow an alphabetical rendering. So instead of having the large and ugly [N 1], instead automatically do it like [a], [b], [c], ... [y], [z], [aa], [ab], etc. So it could be like, <ref method=alpha>. This way, we wouldn't have two competing systems of numbers, one with an unsightly extra letter, and the page would be overall more sensical and pretty.


Version: unspecified
Severity: enhancement

bzimport added a project: Cite.Via ConduitNov 21 2014, 10:55 PM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz22265.
bzimport created this task.Via LegacyJan 25 2010, 6:37 PM
Gadget850 added a comment.Via ConduitMay 22 2010, 12:41 PM

I agree. This is one of the reasons that {{ref}} and other templates are hanging on. And hackish templates like http://en.wikipedia.org/wiki/Template:Cnote2_Begin

Platonides added a comment.Via ConduitMay 22 2010, 2:32 PM

Fixed in r66749.

If you create MediaWiki:cite_link_label_group-footnote with "a b c d e f" any <ref group="footnote"> will display with the appropiate item overriding the default "group <offset>". And so on for any other group name.
You could even override the default with [[MediaWiki:cite_link_label_group-]] but that's obviously discouraged.

Gadget850 added a comment.Via ConduitMay 22 2010, 3:31 PM

I recall reading about this someplace, but did not realize that it had been implemented. Thanks.

Gadget850 added a comment.Via ConduitMay 22 2010, 3:34 PM

(In reply to comment #2)

Fixed in r66749.

If you create MediaWiki:cite_link_label_group-footnote with "a b c d e f" any
<ref group="footnote"> will display with the appropiate item overriding the
default "group <offset>". And so on for any other group name.
You could even override the default with [[MediaWiki:cite_link_label_group-]]
but that's obviously discouraged.

How would you do the override at MediaWiki:cite_link_label_group- ? Not planning to implement, but I want to understand how it works.

Platonides added a comment.Via ConduitMay 22 2010, 3:43 PM

I *just* implemented it (will take a while to be live on wikipedia). It simply looks like [[MediaWiki:cite_references_link_many_format_backlink_labels]]

The messages are "MediaWiki:cite_link_label_group-" + group name. If there's no group name, it's for the default.

It might be better to only not allow spaces as separators, though, forcing new lines instead. What do you think?

Gadget850 added a comment.Via ConduitMay 22 2010, 8:12 PM

I see your example for Klingon :) I have seen some uses of {{ref}} with Greek letters and Roman numerals, so this makes it easy to add those styles.

I see you detect when you run out of backlinks and give an error— I was wondering about that; will have to add the error message to the list.

Not sure what you mean by "only not allow spaces as separators".

Platonides added a comment.Via ConduitMay 22 2010, 9:02 PM

The letters are separated by spaces, new lines or tabs.
This means that if you wanted link names with spaces (eg. 'twenty four', separating with a space), you can't.

Gadget850 added a comment.Via ConduitMay 23 2010, 9:02 PM

I can't think of any scheme that would require spaces in the backlink label.

bzimport added a comment.Via ConduitMay 25 2010, 1:15 AM

aleonard1 wrote:

(In reply to comment #5)

I *just* implemented it (will take a while to be live on wikipedia).

Pardon my ignorance; by that, you mean it's been implemented on Wikipedia's code but will take a while before it goes live, or it's been implemented in the Cite extension and it'll be a while before the new Cite goes live on Wikipedia? (In other words, how excited should I be that this exists :P)

Gadget850 added a comment.Via ConduitMay 25 2010, 1:41 AM

This is implemented in r66749. Cite.php en.Wikipedia is r66620. So the second answer.

http://en.wikipedia.org/wiki/Special:Version

Gadget850 added a comment.Via ConduitMay 25 2010, 2:06 PM

I have started documenting this at [[User:Gadget850/Footnotes – Cite link labels]]. Please edit or comment.

Gadget850 added a comment.Via ConduitFeb 25 2011, 6:31 PM

This went live with 1.17mf.Two issues:

  • The error message at [[MediaWiki:Cite error no link label group]] gets classed as a reference, so you can't use a wikilink in the message to link to a help page
  • The reference list is an ordered list and uses numbers that don't match the in-text cite labels.
Allen4names added a comment.Via ConduitMar 2 2011, 11:46 PM

A new variable, {{CITECLASS}}, along with other changes should fix the ordered list problem.

My very limited PHP skills are not up to creating a new variable but the code below should give you an idea what I am thinking of.

'cite_class_group-default' => 'decimal';
'cite_class_group-@alpha' => 'alpha';
'cite_references_prefix' => '<div class="references">
<ol class="{{CITECLASS}}">';

Some CSS style rules are also needed.

div.references ol.decimal { list-style-type: decimal; }
div.references ol.alpha { list-style-type: lower-alpha; }

Hopefully this can be of some help to you.

Edokter added a comment.Via ConduitMar 3 2011, 5:25 PM

I don't think cite.php can inject a class name; that is done at [[MediaWiki:Cite references prefix]]. This means we cannot use <references /> with matching list styling (but we can using the reflist template).

Allen4names added a comment.Via ConduitMar 3 2011, 7:18 PM

I think I have come up with the changes that are needed but [[MediaWiki:Common.css]] will still need to be edited.

Cite_body.php

function refKey( $key, $num = null ) {
+ if ( $group == '@alpha' ) {
+ $prefix = wfMsgForContent( 'cite_reference_link_prefix_group-@alpha' );
+ } elseif ( $group == '@greek' ) {
+ $prefix = wfMsgForContent( 'cite_reference_link_prefix_group-@greek' );
+ } else {

			$prefix = wfMsgForContent( 'cite_reference_link_prefix' );

+ }

		$suffix = wfMsgForContent( 'cite_reference_link_suffix' );
		if ( isset( $num ) )
			$key = wfMsgForContentNoTrans( 'cite_reference_link_key_with_num', $key, $num );
		
		return $prefix . $key . $suffix;

}

Cite.i18n.php

'cite_references_prefix' => '<ol class="references">',
+ 'cite_references_prefix_group-@alpha' => '<ol class="references alpha">',
+ 'cite_references_prefix_group-@greek' => '<ol class="references greek">',
'cite_references_suffix' => '</ol>',

Hopefully this will make it unnecessary to use Parser Functions to fix this.

Gadget850 added a comment.Via ConduitMar 3 2011, 8:02 PM

See [[Wikipedia:Manual of Style (footnotes)/Cite link labels]]. I documented the template and class changes needed to style the reference list. This works beautifully with {{reflist}} byt not <references>.

Platonides added a comment.Via ConduitMar 4 2011, 11:51 PM

Allen, you are using an undefined variable $group. That code does nothing.

Allen4names added a comment.Via ConduitMar 5 2011, 8:07 AM

The first occurrence of $group in Cite_body.php is at line 169 in r83093.

Edokter added a comment.Via ConduitMar 5 2011, 12:45 PM

The disadvantage of Allen's code is that you are stuck with a few predefined group names within cite_body.php, making any wiki-side HTML customization in Mediawiki:cite_reference_link_prefix impossible. Is there a way to inject a groupname as a CSS value into cite_reference_link_prefix, ie. if it were to contain:

<ol class="references" style="list-style-type: $1;">

That way, it would only have to check if a group name has an associated file present, and pass that to $1 (else default to "decimal").

Platonides added a comment.Via ConduitMar 8 2011, 12:59 PM
  • The error message at [[MediaWiki:Cite error no link label group]] gets classed as a reference, so you can't use a wikilink in the message to link to a help page

It is a link, so it doesn't accept links. The simple solution seems to be to not use a link there. How do you propose solving it?

Gadget850 added a comment.Via ConduitJul 5 2011, 3:53 PM

Version r66749 of the Cite.php extension implements the ability to create styles for the cite link labels. See:

http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style_%28footnotes%29#Cite_label_styles

http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style_%28footnotes%29/Cite_link_labels

Note that label styles must be created and {{reflist}} must be updated.

I think this can be closed.

Edokter added a comment.Via ConduitJul 6 2011, 12:12 AM

Closed per r66749.

bzimport added a comment.Via ConduitApr 2 2012, 5:17 PM

bluehairedlawyer wrote:

This seems a bit of a hack to me as:

  • the ability of the footnotes themselves (as opposed to the superscript links) to be in any form other than decimal is in a template not in the extension.
  • we have customised Mediawiki: pages on Wikipedia for entirely predictable patterns which could not be changed in any sensible fashion: ie surely lower-roman should always be lower case Roman numerals. I can't see nay of the http://en.wikipedia.org/wiki/MediaWiki:Cite_link_label_group-* being any way different from how they are now. (Except for error-test.)
  • the current configuration allows for this weirdness:

http://en.wikipedia.org/wiki/User:Blue-Haired_Lawyer/footnote_weirdness

What would be wrong with hard-coding support for lower-alpha, upper-alpha, lower-roman, and upper-roman?

Gadget850 added a comment.Via ConduitApr 2 2012, 5:40 PM

I don't see the weirdness, as your example uses the standard labels.

Allen4names added a comment.Via ConduitApr 2 2012, 5:41 PM

The following protocol relative URL may be of more use than the one provided by bluehairedlawyer.

//en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=Cite+link+label+group&namespace=8

bzimport added a comment.Via ConduitApr 2 2012, 11:14 PM

bluehairedlawyer wrote:

The weirdness is that two entirely different footnotes are labelled as "[1]". There are six footnotes but only three numbers.

Gadget850 added a comment.Via ConduitApr 3 2012, 7:40 AM

This is because http://en.wikipedia.org/wiki/MediaWiki:Cite_link_label_group-decimal is defined, allowing two separate decimal groups— the default and the explicit decimal. See http://en.wikipedia.org/wiki/Help:Cite_link_labels. When we started creating the label groups, we thought this might be useful in tables and the like.

bzimport added a comment.Via ConduitApr 3 2012, 8:10 PM

bluehairedlawyer wrote:

I see where you're coming from but I feel it's more likely to confuse than be of help.

Another problem with not supporting a <ref group="decimal"> properly is on sites where the default footnote style is something other than decimal. I've filed a bug report: bug 35675

bzimport added a comment.Via ConduitApr 18 2012, 11:58 AM

bluehairedlawyer wrote:

Hard coded support for css list types

A patch which would hard code support for lower-alpha, upper-alpha, lower-greek, lower-roman, upper-roman and decimal css list types.

Attached: diff.txt

bzimport added a comment.Via ConduitMay 16 2012, 8:52 PM

sumanah wrote:

bluehairedlawyer, I suggest you submit that patch directly into Git, our source control system. You can do that with developer access:
https://www.mediawiki.org/wiki/Developer_access That way it'll get reviewed
faster.

Thanks for the patch!

Add Comment