Module:Redirect hatnote: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add kerning for redir titles beginning or ending with apostrophes or quotation marks, as at Neighbourhood and Kurtis Blow
(Updated module from sandbox. Removes dependency on Module:Redirect, and introduces more fine-grained categorization for redirect problems.)
(add kerning for redir titles beginning or ending with apostrophes or quotation marks, as at Neighbourhood and Kurtis Blow)
Line 59:
local formattedRedirect = {}
for k,v in pairs(redirect) do
formattedRedirect[k] = '"' p.. _quote(v .. '"')
end
local text = {
Line 119:
 
return mHatnote._hatnote(text, mhOptions) .. category
end
 
function p._quote(title)
local quotationMarks = {["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true}
local style = ""
-- If string starts with anything in quotationMarks, kern to same degree {{-'}} does
if quotationMarks[string.sub(title, 1, 1)] then
style = "padding-left:0.15em;"
end
-- Likewise if it ends with any of them
if quotationMarks[string.sub(title, -1, -1)] then
style = style .. "padding-right:0.15em;"
end
return style ~= "" and '"<span style="' .. style .. '">' .. title .. '</span>"' or '"' .. title .. '"'
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu