Module:grc-pronoun table

local export = {}

local U = require("Module:string/char") local macron = U(0x304) local breve = U(0x306)

local function make_edit_link(title) local URL = tostring(mw.uri.fullUrl(title, "action=edit")) return ' [' .. URL .. ' edit] ' end

local pronoun_table_templates = { [1] = -- [=[{| class="wikitable" style="font-size: smaller; float: right;" ! rowspan="2" | case !! colspan="2" | singular !! dual !! plural ! str. !! encl. !! str. !! str. ! nominative ! genitive ! dative ! accusative ! colspan="5" | ! adjective [2] = -- [=[{| class="wikitable" style="font-size: smaller; float: right;" ! rowspan="2" | case !! colspan="2" | singular !! dual !! plural ! str. !! encl. !! str. !! str. ! nominative ! genitive ! dative ! accusative ! colspan="5" | ! adjective }
 * + first person pronoun (]=] .. make_edit_link("Module:grc-pronoun table") .. [=[)
 * }]=],
 * }]=],
 * + second person pronoun (]=] .. make_edit_link("Module:grc-pronoun table") .. [=[)
 * }]=],
 * }]=],

function export.pronoun_table(frame) local person = tonumber(frame.args[1]) if not person then error('Parameter 1 should be a number.') end local template = pronoun_table_templates[person] or error('No template for person ' .. person .. '.') local ugsub, decompose = mw.ustring.gsub, mw.ustring.toNFD local function make_entry_name(text) text = ugsub(decompose(text), "[" .. macron .. breve .. "]", "") return text end local title = decompose(mw.title.getCurrentTitle.text) local function link(term) local entry_name = make_entry_name(term) if entry_name ~= title then return ' ' .. term .. ' ' else return '' .. term .. ' '		end end return (template:gsub('}', link)) end

return export