Module talk:List

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Tests via template calls

Ordered not working[edit]

See Template talk:Ordered list#Not working. Very apparent on this module's documentation page. Edokter (talk) — 13:07, 24 November 2013 (UTC)

Sorry, that was a variable clash. Should be fixed now. — Mr. Stradivarius ♪ talk ♪ 13:26, 24 November 2013 (UTC)
And now I've written some test cases which should catch things like this in the future. Better late than never, I suppose... — Mr. Stradivarius ♪ talk ♪ 14:21, 24 November 2013 (UTC)
Nice. I see some minor issues with list_style_type though. Edokter (talk) — 14:27, 24 November 2013 (UTC)
Do you mean the Greek letters in the unbulleted table of the test cases? I can have a go at fixing that. — Mr. Stradivarius ♪ talk ♪ 14:36, 24 November 2013 (UTC)
Now fixed - let me know if there's anything else that you spotted. — Mr. Stradivarius ♪ talk ♪ 15:00, 24 November 2013 (UTC)
Seems to only fire with |ordered now, but not |bulleted. Is that by design? Edokter (talk) — 16:32, 24 November 2013 (UTC)
@Edokter: I wasn't seeing any difference for my tests with <ul>...</ul> and list-style-type, so I assumed that it wasn't supposed to enabled for ul in MediaWiki and that there was no need to include it. But if it's supposed to be included, or we could change the backend somewhere to make it work, then it will be easy enough to enable it for bulleted lists too. — Mr. Stradivarius ♪ talk ♪ 10:31, 26 November 2013 (UTC)
──────────────────────────────────────────────────────────────────────────────────────────────────── It should basically behave as normal lists behave within MediaWiki. After some testing, I found that list-style-type indeed only works with ordered lists. Unordered lists work with the bullet image disabled (list-style-image overrides list-style-type). So it's not broken. Edokter (talk) — 18:03, 26 November 2013 (UTC)
@Edokter: That sounds fair enough - we shouldn't be trying to second-guess the MediaWiki software, I suppose. So, just to be doubly sure, it looks like you want me to revert to this version (diff). Have I understood you correctly? — Mr. Stradivarius ♪ talk ♪ 01:56, 28 November 2013 (UTC)
All I can say is it behaves as expected in its current form. Edokter (talk) — 10:50, 28 November 2013 (UTC)
Well, that sounds good enough for me. Thanks. :) — Mr. Stradivarius ♪ talk ♪ 11:30, 28 November 2013 (UTC)

horizontal_ordered and start value[edit]

Following a litle discussion at MediaWiki talk:Common.css#ordered list start with hlist, there is a way to specify a start value for ordered horizontal lists. My lua knowledge leaves to be desired but the solution is quite simple. When ordered and start=3 is passed, the module outputs <ol start="3">. When horizontal_ordered is given with start=3, it should (also) output <ol style="counter-reset: listitem 2;"> instead. And yes, you need to substract 1. For unknown reason, it does not work in IE8, which it should do so in theory, but who cares. Edokter (talk) — 19:31, 6 January 2014 (UTC)

I've added it to the module, as well as switching the module to use Module:Arguments for argument processing. It's looking very nice - thank you for the fix! — Mr. Stradivarius ♪ talk ♪ 03:18, 7 January 2014 (UTC)
Thank you for implementing it. It works exactly as advertised. Edokter (talk) — 11:16, 7 January 2014 (UTC)

Parameter names[edit]

Hello. For the sake of consistency with the parameter-naming pattern used in {{Navbox}}, {{Infobox}}, {{Sidebar}} etc, I've tried adding the alternate parameter names liststyle, itemstyle and itemNstyle to this version of the sandbox (current as of this message). As they seem to work, is it okay to add them to and start using them with the live version? Sardanaphalus (talk) 20:34, 31 August 2014 (UTC)

That would be the third variation of those parameter names to be allowed. This is getting a bit out of hand. This is not a user-usable template but a meta module, so I don't see the need. -- [[User:Edokter]] {{talk}} 21:04, 31 August 2014 (UTC)
  • "For the sake of consistency with the parameter-naming pattern used in {{Navbox}}, {{Infobox}}, {{Sidebar}} etc...".
    If three sets of names is too many, replace/remove one (or even both) of the other two. Sardanaphalus (talk) 00:15, 1 September 2014 (UTC)
  • That would surely break backward compatibility with some templates. I'm all for consistency, but that is not always possible wihtout either too many variations or breaking too many legacy templates. -- [[User:Edokter]] {{talk}} 11:40, 1 September 2014 (UTC)
  • Sorry not to've got back to your reply until now. If compatibility needs to be maintained – yes – but three sets of names is too many, how about:
  1. Add the more consistent set as a third set, but only temporarily while...
  2. ...a bot is tasked to rename instances from one of the other sets, meaning that...
  3. ...that other set may then be removed, restoring the two-set limit...?
Sardanaphalus (talk) 11:32, 8 September 2014 (UTC)
I'm not going to do it. Also, modules are not templates; perhaps it is a good thing that module parameters have a different naming scheme to prevent potential conflicts and confusion. -- [[User:Edokter]] {{talk}} 16:07, 8 September 2014 (UTC)
  • In that case, can the templates that call Module:List (hlist, ublist, etc) include conversions such as liststyle → list_style, itemNstyle → itemN_style, etc? Sardanaphalus (talk) 21:45, 9 September 2014 (UTC)

Unbulleted list doesn't work in another wiki.[edit]

Hello, I copied this module to Lithuanian Wikipedia, but the unbulleted doesn't seem working properly (haven't tried others). Can someone explain why? Here is the testcases page. Any help would be appreciated.--Zygimantus (talk) 15:30, 1 October 2015 (UTC)

You need to copy some classes from MediaWiki:Common.css, most notably .hlist and .plainlist. -- [[User:Edokter]] {{talk}} 16:08, 1 October 2015 (UTC)
Thank you very much, we changed Common.css now it works.--Zygimantus (talk) 19:31, 1 October 2015 (UTC)

Redundant div?[edit]

Why is {{Unbulleted list}} generating <div class="plainlist"><ul>...</ul></div> when <ul class="plainlist">...</ul> should suffice? it seems to have something to do with renderList(data), mentioned in Module:List. Redrose64 pointed out, "as it's a module, I rather suspect that several templates use it, so one of those may need the enclosing <div>...</div>." That's likely true, but I'm wondering if there's a way to have it only generate a div when asked to. It's better to have a small bit of extra code in a module than to have unneeded markup being sent out thousands of times per minute.  — SMcCandlish ¢ ≽ʌⱷ҅ʌ≼  23:44, 5 September 2016 (UTC)

@SMcCandlish: As far as I'm aware, it's redundant. I added the extra div to the module because that's the way all the old templates were, but I don't see any other particular reason why it should be so. If we want to change it we should be careful, though - for example, there could be CSS selectors in user scripts or gadgets that depend on the div being there in the HTML. — Mr. Stradivarius ♪ talk ♪ 23:56, 28 February 2017 (UTC)
@Mr. Stradivarius: I don't see a practical means of "being careful" other than changing it and being willing to change it back, or otherwise work with them, if people say something broke.  — SMcCandlish ¢ ≽ʌⱷ҅ʌ≼  23:50, 3 March 2017 (UTC)

Negative numbers[edit]

Is it possible to have negative numbers with correct typographic minuses (−) instead of hyphens (-)? As I understand, the current implementation uses built-in HTML numbering, which is not aware about proper formatting (outputs −1 as "-1" and does not even understand "−1" in the value property). Can it be modified somehow (to have it still as a list rather than emulating with a table) to get the proper formatting? If not, what is the best alternative? — Mikhail Ryazanov (talk) 20:16, 28 February 2017 (UTC)

We should use semantically valid HTML. This means using the ol element to enclose one or more li elements like this:
  1. Minus Two
  2. Minus One
  3. Zero
  4. Plus One
  5. Plus Two
What your browser does with those li elements is largely outside our control - we can specify start value - this is the start=-2 attribute here; also whether numbers (decimal or Roman) or letters are to be used (also if capitals should be used for Roman numerals or letters) - this is the type=1 attribute here. What we cannot do is specify how a minus sign is to be displayed. --Redrose64 🌹 (talk) 20:36, 28 February 2017 (UTC)
Well, yes — it seems that HTML/CSS does not give any control for how the list markers are displayed (and ::marker is not supported anywhere). Then the question is: can this be emulated using <dl> with some styling to match the <ol> format? Or I really have to use a table? — Mikhail Ryazanov (talk) 01:14, 1 March 2017 (UTC)
Again, we should use semantically valid HTML.
  • The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document.
  • The dl element represents an association list consisting of zero or more name-value groups (a description list).
  • The table element represents data with more than one dimension, in the form of a table.
If the information is an ordered list of items, we use the the ol element, and must not use a different element for other than its intended purpose. Quite apart from appearance, we must consider accessibility.
It would help greatly if you gave an example of the page(s) where you are having these difficulties. --Redrose64 🌹 (talk) 10:19, 1 March 2017 (UTC)
I totally agree that we should strive for semantically correct and accessible code, and that is why I was asking how to achieve a typographically correct appearance while still keeping the list as a list (in this respect a description list is a general case of a numbered list). The particular example of the problem is in Absement#Higher_integrals. — Mikhail Ryazanov (talk) 23:50, 1 March 2017 (UTC)
There is a working draft for CSS to allow customisation of the negative sign in ordered lists, but unfortunately it only currently has support in Firefox. — Mr. Stradivarius ♪ talk ♪ 02:46, 2 March 2017 (UTC)
Looks interesting, but why even Firefox does not understand type and glyphs from the W3C draft, requiring its own system and symbols instead?
Anyway, it seems that <ol> should be considered literally ordered rather than numbered, since copy-pasting such lists completely looses the numbers in plain-text mode and loses the numbering system (just renumbers the copied items as "1.", "2.", "3.", ...) in reach-text mode (at least, this is what VisualEditor here does), so it is quite useless/harmful when the actual numbering is important. — Mikhail Ryazanov (talk) 05:30, 2 March 2017 (UTC)
The doc linked by Mr. Stradivarius is a W3C Working Draft; that means that it is a long way from being accepted as a W3C Recommendation (see World Wide Web Consortium Process Document section 6.1.2 Maturity Levels), and so browser vendors like Mozilla are under no obligation to implement any of that proposal. Indeed, it may change significantly before adoption, or even be cropped entirely and wind up as a Working Group Note.
The tag name <ol>...</ol> stands for "ordered list". It implies nothing about numbering; indeed, a list which is ordered yet not numbered might be
  1. No trump
  2. Spades
  3. Hearts
  4. Diamonds
  5. Clubs
When you copypaste one or more items of a HTML list (ordered or otherwise), whether the item markers are copied or not is browser-dependent. --Redrose64 🌹 (talk) 17:32, 2 March 2017 (UTC)
Are you a mathematician? ;–)
Although the current standard does not call it "numbered" explicitly, the numbering is implied by the presence of the start attribute and that the items have ordinal values, which form a continuous sequence. (The draft from 19 October 2010 is more explicit, saying: "The start attribute on the ol element was deprecated in a previous version of HTML, but is no longer deprecated, as it has meaning and is not simply presentational.")
In any case, do you have any suggestions about the example that I gave above? — Mikhail Ryazanov (talk) 04:09, 4 March 2017 (UTC)

:after[edit]

I want to apply a style to all items (item_style), but after them. Final product should be like:

.hlist li:after{content:"-after"}

Is there some option, how to achieve this? --Dvorapa (talk) 17:43, 1 May 2017 (UTC)