Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up| 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}} |