Skip to content
Permalink
03b9715b7c
Go to file
 
 
Cannot retrieve contributors at this time
35 lines (30 sloc) 764 Bytes
local lang_tag = nil
local and_dictionary = {
de = "und",
en = "and",
nl = "en",
es = "y"
}
function get_lang_tag (meta)
if meta.lang then
lang_tag = meta.lang[1].c:gsub("-%a+", "")
else
-- Default to English if not otherwise specified
lang_tag = "en"
end
-- Default to English if translation is unavailable
if not and_dictionary[lang_tag] then
and_dictionary[lang_tag] = "and"
end
end
function replace_ampersands (el)
if el.c[1][1].mode == "AuthorInText" then
for key,value in pairs(el.c[2]) do
for key2,value2 in pairs(value) do
if value2 == "&" then el.c[2][key][key2] = and_dictionary[lang_tag] end
end
end
end
return el
end
return {{Meta = get_lang_tag}, {Cite = replace_ampersands}}
You can’t perform that action at this time.