Last modified: 2014-09-23 22:40:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24265, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22265 - Allow references to be listed with letters
Allow references to be listed with letters
Status: REOPENED
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-25 18:37 UTC by Andrew
Modified: 2014-09-23 22:40 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Hard coded support for css list types (6.80 KB, patch)
2012-04-18 11:58 UTC, bluehairedlawyer
Details

Description Andrew 2010-01-25 18:37:55 UTC
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.
Comment 1 Gadget850 2010-05-22 12:41:17 UTC
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
Comment 2 Platonides 2010-05-22 14:32:45 UTC
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.
Comment 3 Gadget850 2010-05-22 15:31:33 UTC
I recall reading about this someplace, but did not realize that it had been implemented. Thanks.
Comment 4 Gadget850 2010-05-22 15:34:54 UTC
(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.
Comment 5 Platonides 2010-05-22 15:43:13 UTC
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?
Comment 6 Gadget850 2010-05-22 20:12:57 UTC
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".
Comment 7 Platonides 2010-05-22 21:02:10 UTC
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.
Comment 8 Gadget850 2010-05-23 21:02:24 UTC
I can't think of any scheme that would require spaces in the backlink label.
Comment 9 Andrew 2010-05-25 01:15:44 UTC
(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)
Comment 10 Gadget850 2010-05-25 01:41:21 UTC
This is implemented in r66749. Cite.php en.Wikipedia is r66620. So the second answer.

[[http://en.wikipedia.org/wiki/Special:Version]]
Comment 11 Gadget850 2010-05-25 14:06:21 UTC
I have started documenting this at [[User:Gadget850/Footnotes – Cite link labels]]. Please edit or comment.
Comment 12 Gadget850 2011-02-25 18:31:14 UTC
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.
Comment 13 Allen Stambaugh 2011-03-02 23:46:33 UTC
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.
Comment 14 Erwin Dokter 2011-03-03 17:25:27 UTC
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).
Comment 15 Allen Stambaugh 2011-03-03 19:18:27 UTC
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.
Comment 16 Gadget850 2011-03-03 20:02:14 UTC
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>.
Comment 17 Platonides 2011-03-04 23:51:10 UTC
Allen, you are using an undefined variable $group. That code does nothing.
Comment 18 Allen Stambaugh 2011-03-05 08:07:08 UTC
The first occurrence of $group in Cite_body.php is at line 169 in r83093.
Comment 19 Erwin Dokter 2011-03-05 12:45:41 UTC
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").
Comment 20 Platonides 2011-03-08 12:59:14 UTC
> * 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?
Comment 21 Gadget850 2011-07-05 15:53:16 UTC
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.
Comment 22 Erwin Dokter 2011-07-06 00:12:16 UTC
Closed per r66749.
Comment 23 bluehairedlawyer 2012-04-02 17:17:41 UTC
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?
Comment 24 Gadget850 2012-04-02 17:40:00 UTC
I don't see the weirdness, as your example uses the standard labels.

> 
> * 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?
Comment 25 Allen Stambaugh 2012-04-02 17:41:12 UTC
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
Comment 26 bluehairedlawyer 2012-04-02 23:14:21 UTC
The weirdness is that two entirely different footnotes are labelled as "[1]". There are six footnotes but only three numbers.
Comment 27 Gadget850 2012-04-03 07:40:43 UTC
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.
Comment 28 bluehairedlawyer 2012-04-03 20:10:27 UTC
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
Comment 29 bluehairedlawyer 2012-04-18 11:58:23 UTC
Created attachment 10429 [details]
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.
Comment 30 Sumana Harihareswara 2012-05-16 20:52:16 UTC
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!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links