Last modified: 2014-09-23 22:33:16 UTC
I started to work on this a while ago, but didn't have time to finish it. As this is a needed and useful feature, I'm asking here to seek attention from other developers. Cite should support directionality for references. It can be accomplished by adding a new param to the <ref> tag like this: <ref dir="rtl"> ... which would make the output LI elemnt to render like this: <li dir="rtl"> ... In order to make sure the margins and paddings of the LI elements are rendered correctly, I suggest using a CSS class for it like <li class="rtl-reference"> .rtl-reference{ direction:rtl} Also, "ltr" should be supported too (to be used on rtl wikis). The default direction will be that of the wiki, of course.
Bidirectional references are already supported: Hello World<ref group="hebrew">HEBREW TEXT HERE (WHICH IS RTL)</ref> How are you doing<ref>Book of kings, p.123</ref> ==Refs== <references/> ==Hebrew Refs== <div dir="rtl"> <references group="hebrew"/> </div>
Thanks Sharon for pointing it out. However, that way the order of references changes for the sake of grouping. What I'm suggesting here is that references should all be shown with one <references/> tag in the same order as if they were all in LTR, but RTL ones are handled correctly (or vice-versa if the content language is RTL itself). I'm reopening the bug since what you suggested is a workaround rather than a solution.
Do you think it would be visually appealing to mix LTR and RTL references in the same block?
(In reply to comment #3) > Do you think it would be visually appealing to mix LTR and RTL references in > the same block? I totally understand what you mean. However, the fact that this has been required in a large scale RTL wiki like Persian Wikipedia, may be provided as a proof for its being appealing :) Anyways, this is possible and (I believe) easy to incorporate LTR and RTL refs, and I don't have a good reason not to do so (although I don't have a good reason pro either).
For the record, using "group" attribute is not a solution anymore, because the name of the group is shown in the citation number in the text.
I'm not sure what is the best solution here: Mixed RTL and LTR lists doesn't look well, but English reference shown as RTL looks bad too. In Hebrew Wikipedia I created a hack for setting the directionality using some CSS and overriding the reference name: in common.css I added the following CSS li[id|="cite_note-hebrewRTL"] { direction:rtl; } li[id|="cite_note-LTR"] { direction:ltr; margin-left:3.2em; } and users can exlicity set the direction by giving name to ref with the correct prefix: <ref name="LTR-source">LTR reference</ref> <ref name="hebrewRTL-source">RTL reference (which used when most of the references are LTR and the <references/> it wrapped by dir="ltr")</ref> An example to it: http://he.wikipedia.org/wiki/%D7%A4%D7%A8%D7%A0%D7%A1%D7%95%D7%90%D7%94_%D7%94%D7%95%D7%9C%D7%A0%D7%93#.D7.94.D7.A2.D7.A8.D7.95.D7.AA_.D7.A9.D7.95.D7.9C.D7.99.D7.99.D7.9D However, this hack uses CSS rules that are not supported by old browsers, and it isn't user friendly. Another [wrong] solution is to use the new dir="auto": the message MediaWiki:Cite_references_link_one could just declare dir="auto" for the li - this currently works only in Chrome. it doesn't requires the user to declare the direction of each reference, but sometimes users may want to explicitly define the direction (example: <ref>Google הוא מנוע חיפוש</ref>).
The CSS based solution you have provided here, is exactly what I requested in the first place. It was questioned if it is appealing or not. Now that two large RTL wikis want this (FaWP and HeWP) and one of them has implemented this (HeWP), I think it is obvious that this is a necessity that should be addressed. The problem with your approach is not only about lack of support for older browsers. It also makes it impossible to use the "name" attribute for its actual intended purpose. The solution I proposed in the beginning, allows for selectively marking reference as RTL, such that: <ref dir="rtl">blah</ref> generates something like: <li class="citation-rtl">.... and we can define a class for that in the CSS.
I added support for it in: https://gerrit.wikimedia.org/r/#/c/7738/
Thanks for the patch, but the the look of the resulting comment is quite weird. In the following case, the wiki is LTR, the first comment is LTR and the second is RTL: 1. ↑ First English comment. 2. .SECOND PERSIAN COMMENT ↑ It would be less weird this way: 1. ↑ First English comment. 2. ↑ .SECOND PERSIAN COMMENT The layout at the bottom of bit.ly/KqZi8V is relatively better: 1. ↑ First English comment. .SECOND HEBREW COMMENT ↑ .2 3. ↑ Third English comment. 4. ↑ Fourth English comment. .FIFTH HEBREW COMMENT ↑ .5 ... But still, putting the comment numbers on different sides of the page is very weird. In printed Hebrew books the numbers are always on the right and the alignment is always to the right, even if the comment is in an LTR language. In an RTL wiki I would align comments to the left only if all of them are LTR.
If all citations are in the same direction (regardless of whether it is the same as the directionality of the wiki content), there is no need to use this new feature. Instead, the whole section can be wrapped in a div, with its directionality set to the desired direction. The use of this feature is only when some (and not all) of the citations are in the direction opposite to the directionality of the content. I am in support of allowing the direction to be set for the LI element itself. Unlike Amir, I think the bit.ly/KqZi8V layout is not weird. In Persian text, this form of numbering is quite frequent for footnotes and citations. Last but not least, wrapping the inside of ref tag in a DIV is not a solution. We actually can do that simply by using <ref><div class="whatever">...</div></ref> so there is no need to implement that DIV in the extension code. The first output in comment #9 can be achieved that way, with no change in the extension. Therefore, I propose the patch to be modified again, in such a way that the CLASS attribute would be added to the LI element itself, not to a DIV element inside of it.
I modified the latter patch to comply with what is requested in this bug, in https://gerrit.wikimedia.org/r/#/c/8733/
I thought it is a bit weird that the numbers are on different sides, and that is the reason for the div within the ref. Regarding the comment 10# it is not the same as adding div within the ref (<ref><div dir="ltr">...</div></ref>), as the whole comment (including the backlink) is in a the "correct" direction (while keeping the numbers in the same side), and without a line break. However after the discussion here I changed my mind and the other options are fine (and better than the current situation). I did a small survey in the Hebrew community Wikipedia: http://he.wikipedia.org/wiki/%D7%A9%D7%99%D7%97%D7%AA_%D7%AA%D7%91%D7%A0%D7%99%D7%AA:%D7%94%D7%A2%D7%A8%D7%94/%D7%90%D7%A0%D7%92%D7%9C%D7%99%D7%AA_%D7%95%D7%A2%D7%91%D7%A8%D7%99%D7%AA and 4 ppl thought the more correct output is as Huji said (to assign dir to the li), while 4 ppl thought the correct output is as Amir said (directionality within the reference-text+ unicode-bidi: embed) - so it is still not clear what is the correct output :) Maybe we should ask the main RTL communities (fa-wikipedia, ar-wikipedin) what they prefer. If we don't ask them, I think adding the class to the li is fine too.
Code review: Gerrit change #7738. Assigned to patch submitter.
Assigning to submitter of most recent amended patchset, Antoine Musso.
Patch in Gerrit received a -1, needs rework.
Change 7738 had a related patch set uploaded by Krinkle: Support directionality for reference https://gerrit.wikimedia.org/r/7738