Changes
Jump to navigation
Jump to search
← Older edit
Module:Hatnote list
(view source)
Revision as of 21:20, 1 April 2025
126 bytes removed
,
21:20, 1 April 2025
m
1 revision imported
Line 96:
Line 96:
}
}
−
--Collapses duplicate punctuation
+
--Collapses duplicate punctuation
at end of string, ignoring italics and links
local function punctuationCollapse (text)
local function punctuationCollapse (text)
−
local replacements = {
+
return text:match(
"[.?!]
('
?
)
%
1(
%]?
)
%
2
%.$")
and
text
:sub
(
1
,
-2
)
or
text
−
["%.%.$
"
] = ".",
−
[
"%?%
.
$"] = "
?
",
−
["%
!
%.$"
]
= "!",
−
["%.%]%]%.$"] = ".]]",
−
["%
?%
]
%]
%.$"] = "
?
]]",
−
["%!%]
%
]
%.$"
] = "!]]"
−
}
−
for k, v in pairs(replacements
)
do
text
= string.gsub
(
text
,
k, v
)
end
−
return
text
end
end
Line 150:
Line 141:
-- 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 161:
Line 152:
table.insert(forTable, forRow)
table.insert(forTable, forRow)
until terminated or i > maxArg
until terminated or i > maxArg
−
+
return forTable
return forTable
end
end
Krizar
confirmed, superuser,
Administrators
838
edits
Navigation menu
Personal tools
Create account
Log in
Namespaces
Module
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
About
Main page
Recent changes
Random page
WikiData entry
WineDB entry
IGDB entry
Chocolatey Package
Help about MediaWiki
Tools
Special pages
Printable version