local p =
local lang =
--Basic pattern function is used for names that wasn't detected by getnames as a name from specific country. It returns last word as a surname and other words as a name-- function basic_pattern(fullname) local name = string.match(fullname, "(.+) (%w+)") local surname = string.gsub(fullname, name .. " ", "") if #name_table > 3 then return one_name_pattern(fullname) end return "Given = " .. name .. " -- " .. "Family = " .. surnameend
function one_name_pattern(fullname) local name = name_table[1] local surname = string.gsub(fullname, name .. " ", "") if string.match(fullname, " del ") then end return "Given = " .. name .. " -- " .. "Family = " .. surnameend
function two_names_pattern(fullname) local name = name_table[1] .. " " .. name_table[2] local surname = string.gsub(fullname, name .. " ", "") return "Given = " .. name .. " -- " .. "Family = " .. surnameend
function p.getnames(frame) local fullname = frame.args.name or "" if fullname
"ez" then name_format = "es" end for _, v in pairs(lang.dutch_endings) do if string.sub(word, -#v)
polish_ending then name_format = "pl" end end for _, english_ending in pairs(lang.english_endings) do if string.sub(word, -#english_ending)
chinese_name then name_format = "zh" end end for _, ending in pairs(lang.chinese_endings) do if string.sub(word, -3)
"zh" then surname = string.match(fullname, "(.+) (%w+)") name = string.gsub(fullname, surname .. " ", "") if string.find(fullname,'%(') then local courtesy_name = fullname:match("%((%a+)%)") name = string.gsub(name, "%(" .. courtesy_name .. "%)", "") end return "Given = " .. name .. " -- " .. "Family = " .. surname end end
-- Loop through spain letters from array. for _, i in pairs(lang.spain_letters) do if string.match(fullname, i) then name_format = "es" break end end for _, i in pairs(lang.spanish_names) do if string.match(fullname, i) then name_format = "es" break end end if name_format
i then return two_names_pattern(fullname) end end return one_name_pattern(fullname) elseif name_format
"en" then for _, word in pairs(name_table) do for _, english_ending in pairs(lang.english_endings) do if string.sub(word, -#english_ending) then return one_name_pattern(fullname) end end end return basic_pattern(fullname) end
for counter, word in pairs(name_table) do if word
"de" then for i=1,counter - 1 do name = name .. name_table[i] end surname = string.gsub(fullname, name .. " ", "") return "Given = " .. name .. " -- " .. "Family = " .. surname end end -- If there is no format passed and code haven't detected where can be passed name from, it will return function basic_pattern return basic_pattern(fullname)
end
return p