Mòideal:Cslist
(deasbaireachd⧼tpt-languages-separator⧽ ⧼tpt-languages-separator⧽eachdraidh⧼tpt-languages-separator⧽ceanglaichean⧼tpt-languages-separator⧽doc⧼tpt-languages-separator⧽bogsa-gainmhich⧼tpt-languages-separator⧽cùisean deuchainn)
This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Module to implement {{Tl:CSlist}}, which creates a horizontal list similar to {{Tl:Hlist}} but using comma separators instead of mid-dots.
It can take as many list items as desired, and also an optional |semi=
, which when set to true
or yes
will use a semicolon as separator in place of the comma.
Note: the unordered list which is generated is good for accessibility, but really is only useful in tables and infoboxes as an alternative to using {{Hlist}}. It should not be used in running prose.
Eisimpleirean - Examples
- {{CSlist | first item| second item| third item| etc}} →
- first item
- second item
- third item
- etc
- {{CSlist | first item | second item | third item | etc |semi=true}} →
- first item
- second item
- third item
- etc
- {{Hlist | first item| second item| third item| etc}} →
- first item
- second item
- third item
- etc
- {{Hlist | first item | second item | third item | etc |semi=true}} →
- first item
- second item
- third item
- etc
p = {}
p.makelist = function(frame)
local args = frame.args
if not args[1] then
args = frame:getParent().args
if not args[1] then return end
end
local semi = (args.semi or ""):sub(1,1):lower()
semi = (semi == "t") or (semi == "y")
local out = ""
for k, v in ipairs(args) do
v = mw.text.trim(v)
if v ~= "" then
out = out .. "<li>" .. v .. "</li>"
end
end
if out ~= "" then
if semi then
return '<ul class="sslist">' .. out .. '</ul>'
else
return '<ul class="cslist">' .. out .. '</ul>'
end
end
end
return p