Module:Hatnote list: Difference between revisions
Content added Content deleted
(Removed default texts set in forSeeArgsToTable(); unset items in table are now empty rather than filled with defaults; defaults are filled in forSeeTableToString().) |
(Updated with "formatted" option for andList and orList from sandbox) |
||
Line 26: | Line 26: | ||
separator = ",", |
separator = ",", |
||
altSeparator = ";", |
altSeparator = ";", |
||
space = " " |
space = " ", |
||
formatted = false |
|||
} |
} |
||
Line 40: | Line 41: | ||
end |
end |
||
local s = options.space |
local s = options.space |
||
-- Format the list if requested |
|||
if options.formatted then list = mHatnote.formatPages(unpack(list)) end |
|||
-- Set the separator; if any item contains it, use the alternate separator |
-- Set the separator; if any item contains it, use the alternate separator |
||
local separator = options.separator |
local separator = options.separator |
||
Line 58: | Line 61: | ||
-- Stringifies a list with "and" |
-- Stringifies a list with "and" |
||
function p.andList (list) |
function p.andList (list, formatted) |
||
return stringifyList(list, {conjunction = "and"}) |
return stringifyList(list, {conjunction = "and", formatted = formatted}) |
||
end |
end |
||
-- Stringifies a list with "or" |
-- Stringifies a list with "or" |
||
function p.orList (list) |
function p.orList (list, formatted) |
||
return stringifyList(list, {conjunction = "or"}) |
return stringifyList(list, {conjunction = "or", formatted = formatted}) |
||
end |
end |
||