Module:headword doc

local export = {}

local data = mw.loadData("Module:headword/data")

--[=[ Generate a table of part-of-speech aliases and their canonical forms. ]=] function export.pos_alias_table(frame) local alldata_list = {}

-- Create list for alias, canonical in pairs(data.pos_aliases) do		table.insert(alldata_list, {alias, canonical}) end table.sort(alldata_list, function(fs1, fs2) return fs1[1] < fs2[1] end)

-- Convert to wikitable local parts = {} table.insert(parts, '{|class="wikitable"') table.insert(parts, "! Alias !! Canonical form") for _, alias_data in ipairs(alldata_list) do		local alias, canonical = unpack(alias_data) table.insert(parts, "|-") local sparts = {} table.insert(sparts, " ") table.insert(sparts, " ") table.insert(parts, "| " .. table.concat(sparts, " || ")) end table.insert(parts, "|}") return table.concat(parts, "\n") end

return export