|
|
| Line 1: |
Line 1: |
| local export = {} | | local p = {} |
| local pos_functions = {}
| |
|
| |
|
| local lang = require("Module:languages").getByCode("tln") | | function p.noun(frame) |
| | local args = frame:getParent().args |
|
| |
|
| local PAGENAME = mw.title.getCurrentTitle().text | | local title = mw.title.getCurrentTitle().text |
|
| |
|
| -- Nouns
| | local g = args.g or "?" |
| pos_functions.nouns = function(class, args, data)
| | local rom = args.rom or "" |
| local params = {
| |
| [1] = {required = true}, -- gender
| |
| ["pl"] = {},
| |
| ["head"] = {},
| |
| ["tr"] = {},
| |
| ["pltr"] = {},
| |
| }
| |
|
| |
|
| local args = require("Module:parameters").process(args, params)
| | local pl = args.pl or "" |
| | local plrom = args.plrom or "" |
|
| |
|
| local head = args.head or PAGENAME
| | local text = "'''" .. title .. "'''" |
|
| |
|
| data.lang = lang
| | if rom ~= "" then |
| data.heads = {head}
| | text = text .. " • (" .. rom .. ")" |
| data.genders = {args[1]}
| | end |
| data.inflections = {}
| |
|
| |
|
| -- plural handling
| | text = text .. " " .. g |
| if args.pl then
| |
| local infl = {
| |
| label = "plural",
| |
| { term = args.pl }
| |
| }
| |
|
| |
|
| if args.pltr then
| | if pl ~= "" then |
| infl[1].tr = args.pltr
| | text = text .. ", plural '''" .. pl .. "'''" |
| end
| |
|
| |
|
| table.insert(data.inflections, infl)
| | if plrom ~= "" then |
| end
| | text = text .. " (" .. plrom .. ")" |
| | end |
| | end |
|
| |
|
| if args.tr then
| | return text |
| data.translits = {args.tr}
| |
| end
| |
| end | | end |
|
| |
|
| -- Entry point
| | return p |
| function export.show(frame)
| |
| local parent_args = frame:getParent().args
| |
| | |
| local poscat = frame.args[1] or "nouns"
| |
| | |
| local data = {
| |
| inflections = {},
| |
| genders = {},
| |
| categories = {},
| |
| }
| |
| | |
| if pos_functions[poscat] then
| |
| pos_functions[poscat](nil, parent_args, data)
| |
| end
| |
| | |
| return require("Module:headword").full_headword(data)
| |
| end
| |
| | |
| return export
| |