Editing Module:Hatnote list
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 96: | Line 96: | ||
} | } | ||
--Collapses duplicate punctuation | --Collapses duplicate punctuation | ||
local function punctuationCollapse (text) | local function punctuationCollapse (text) | ||
local replacements = { | |||
["%.%.$"] = ".", | |||
["%?%.$"] = "?", | |||
["%!%.$"] = "!", | |||
["%.%]%]%.$"] = ".]]", | |||
["%?%]%]%.$"] = "?]]", | |||
["%!%]%]%.$"] = "!]]" | |||
} | |||
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end | |||
return text | |||
end | end | ||
Line 141: | Line 150: | ||
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} | -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} | ||
while args[i + 2] == options.andKeyword do | while args[i + 2] == options.andKeyword do | ||
if args[i + 3] then | if args[i + 3] then | ||
table.insert(forRow.pages, args[i + 3]) | table.insert(forRow.pages, args[i + 3]) | ||
end | end | ||
Line 152: | Line 161: | ||
table.insert(forTable, forRow) | table.insert(forTable, forRow) | ||
until terminated or i > maxArg | until terminated or i > maxArg | ||
return forTable | return forTable | ||
end | end |