Jump to content

Template talk:Separated entries

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Template:Enum, sandboxed version is better

[edit]

The sandboxed version of the {{enum}} template, which invokes this, works with the comma= parameter properly; the version in main doesn't. (See the testcases.) Can we move it over? I write here rather than there as I don't think that gets much talk. Si Trew (talk) 09:30, 14 November 2015 (UTC)[reply]

Request to add parameter to Module:Separated entries

[edit]

Please copy Module:Separated entries/sandbox to Module:Separated entries. See diff.

Effect of change: The edit does not change the default behavior of the module, but adds a new parameter |dataPlural=. If dataPlural is non-empty, and either |separator= or |conjunction= are set, then the module will emit an empty span with display:none. That span has an attribute "data-plural" which is set to 0 if the module produces only one entry, and 1 if the module produces more than one entry. See the module testcases to see the effect of the change.

Reasoning behind change: Several infoboxes (e.g., {{Infobox settlement}}, {{Infobox person}}) use {{Pluralize from text}} to change the labels of a field depending on the data. For example,

{{Pluralize from text|{{{region|}}}|singular=Region|likely=Region(s)|plural=Regions}}

will analyze |region= and produce a label depending on whether |region= is clearly singular, clearly plural, or probably plural. {{Pluralize from text}} uses the logic in Module:Detect singular.

Unfortunately, Module:Detect singular cannot tell the difference between |region=Bosnia and Herzegovina and |region={{enum|California|Nevada}}, so the above code will emit "Region(s)" for both cases. Anyone can signal Module:Detect singular that its input is singular or plural, via the empty span described above (implemented for users at {{force singular}} and {{force plural}}).

The proposed edit will allow {{Enum}} to signal to Module:Detect singular that, e.g., {{enum|Bosnia and Herzegovina}} produces a single entry while {{enum|California|Nevada}} produces two entries (see Template:Enum/sandbox for proposed change there). The proposed edit will increase the precision of Module:Detect singular hence make infoboxes cleaner with fewer labels that look like "Region(s)".

Thanks for your help! — hike395 (talk) 12:18, 29 October 2024 (UTC)[reply]

 Done * Pppery * it has begun... 16:07, 9 November 2024 (UTC)[reply]