local p = {}

function p.latin(frame)
	local latin = frame.args[1]
        if string.find(latin, "Candidatus") then
        latin = string.gsub(latin, "Candidatus(.+)", "<i>Candidatus</i>%1")
        return latin
        elseif string.find(latin, "%a+%.") then
        latin = string.gsub(latin, "(%a+%-?%a*%s*%a*%-?%a*%s)(%a+%.)(.+)", "<i>%1</i>%2<i>%3</i>")
        return latin
	else return "<i>" .. latin .. "</i>"
	end
end
function p.author(frame)
	local author= frame.args[1]
        if string.find(author, "%set al%.") then
        author = string.gsub(author, "(%[*%set al%.%]*)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%sex%s") then
        author = string.gsub(author, "(%sex%s)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%set%s") then
        author = string.gsub(author, "(%set%s)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%sin%s") then
        author = string.gsub(author, "(%sin%s)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%semend%.") then
        author = string.gsub(author, "(%semend%.)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%sapud%s") then
        author = string.gsub(author, "(%sapud%s)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%se%. a%.") then
        author = string.gsub(author, "(%[*%se%. a%.%]*)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "hort%.") then
        author = string.gsub(author, "(%[*hort%.%]*)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "auct%.") then
        author = string.gsub(author, "(%[*auct%.%]*%s?%a*%.?%]*)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "nom%.") then
        author = string.gsub(author, "(%[*nom%. %a+%.%]*)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "corrig%.") then
        author = string.gsub(author, "(corrig%.)", "<span style='font-variant:normal;'>%1</span>")
        end
        if string.find(author, "%sand%s") then
        author = string.gsub(author, "(%sand%s)", "<span style='font-variant:normal;'>%1</span>")
        end
return "<span style='font-variant:small-caps;'>" .. author .. "</span>"
end

return p