Jump to content

Module:Nl-inflection

Unchecked
From Wikipedia

Documentation for this module may be created at Module:Nl-inflection/doc

local bodge = require "Module:mw"

local verbmap = {
    {  -- The first numbered field is for the default.
        "",
        "Dutch uncategorised verbs"
    }
}
verbmap["st-1"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 1",
    "Dutch class 1 strong verbs"
}
verbmap["st-2"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 2",
    "Dutch class 2 strong verbs"
}
verbmap["st-3"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 3",
    "Dutch class 3 strong verbs"
}
verbmap["st-4"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 4",
    "Dutch class 4 strong verbs"
}
verbmap["st-5"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 5",
    "Dutch class 5 strong verbs"
}
verbmap["st-6"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 6",
    "Dutch class 6 strong verbs"
}
verbmap["st-7"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] class 7",
    "Dutch class 7 strong verbs"
}
verbmap["st-i"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|strong]] non-standard",
    "Dutch non-standard strong verbs"
}
verbmap["wk-d"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|weak]] in -d",
    "Dutch weak verbs (-d)"
}
verbmap["wk-t"]   = {
    "[[Appendix:Dutch parts of speech#Verbs|weak]] in -t",
    "Dutch weak verbs (-t)"
}
verbmap["wk-cht"] = {
    "[[Appendix:Dutch parts of speech#Verbs|weak]] in -cht",
    "Dutch weak verbs (-cht)"
}
verbmap["mix"]    = {
    "[[Appendix:Dutch parts of speech#Verbs|mixed]]",
    "Dutch mixed verbs"
}
verbmap["pp"]     = {
    "[[Appendix:Dutch parts of speech#Verbs|preterite-present]]",
    "Dutch preterite-present verbs"
}
verbmap["irr"]    = {
    "[[Appendix:Dutch parts of speech#Verbs|irregular]]",
    "Dutch irregular verbs"
}
verbmap["def"]    = {
    "[[defective verb|defective]]",
    "Dutch defective verbs"
}

local z = {}

local simple = function(frame, map, classes)
    local pframe = frame:getParent()
    local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
    local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
    local result = {}
    local pagename = args.head or config.pagename
    table.insert(result, "'''" .. pagename .. "'''")
    local index = 1
    while true do
        local arg = args[index]
        if nil == arg then break end
        if index == 2 then
            table.insert(result, "[[Category:Dutch verbs with two conjugations]]")
        end
        local m = map[arg] or map[1]
        table.insert(result, " (" .. m[1] .. ")")
        table.insert(result, "[[Category:" .. m[2] .. "]]")
        index = index + 1
    end
    if args.refl then
        table.insert(result, "[[Category:Dutch reflexive verbs]]")
    end
    if args.sep then
        table.insert(result, "[[Category:Dutch separable verbs]]")
    end
    local text=table.concat(result)
    return mw.text.tag({name="span",contents=text,params={class=classes}})
end

-- This is invoked by {{nl-verb}}.
function z.verb(frame)
    return simple(frame, verbmap, "nl-verb-info")
end

-- This is invoked by {{nl-noun}}.
function z.noun(frame)
    return simple(frame, nounmap, "nl-noun-info")
end

-- This is invoked by {{nl-adj}}.
function z.adj(frame)
    return simple(frame, adjmap, "nl-adj-info")
end

return z