Module:Sandbox/Erutuon/author citation: Difference between revisions

Content deleted Content added
try array-based output (efficiency difference not noticeable), reject input if two author citations are found in a row (if that's possible)
add some names, standardize abbreviations after IPNI convention
Line 75:
end
 
-- Currently using IPNI convention of no spaces after initials.
local author_abbrevs = {
["L."] = "Carl Linnaeus",
["Schldl."] = "Diederich Franz Leonhard von Schlechtendal",
["Cham."] = "Adelbert von Chamisso",
["B.Boivin"] = "Joseph Robert Bernard Boivin",
["A.J.Eames"] = "Arthur Johnson Eames",
}
 
function p.standardize_abbrev(abbrev)
return (abbrev:gsub("%.%s+", "."))
end
 
function p.link_author_citation(citation)
Line 85 ⟶ 92:
citation,
function (author)
iflocal full_name = author_abbrevs[p.standardize_abbrev(author)] then
if full_name then
return "[[" .. author_abbrevs[author]full_name .. "|" .. author .. "]]"
end
end)