モジュール:Moyune Category

提供:人工言語学Wiki

このモジュールについての説明文ページを モジュール:Moyune Category/doc に作成できます

local p = {}

function p.category( frame )
    local moyune = {
        INT = true,
        ART = true,
        EXP = true,
        PHI = true,
        HYP = true,
        NAT = true,
        REA = true,
        IMG = true,
        CIN = true,
        CDE = true,
        GEN = true,
        SPE = true,
        SON = true,
        LIT = true,
        KIN = true,
        SER = true,
        JOK = true,
        PAV = true,
        AAV = true,
        PWL = true,
        AWL = true,
        TOL = true,
        PRI = true,
        PUB = true,
        FIX = true
    }

    local splitted = Split(frame.args[1], "/")
    local join = ""
    for i = 1, #splitted do
        if moyune[splitted[i]] then
            join = join.." [[Category:モユネ分類 "..splitted[i].."]]"
        end
    end
    return join
end

function Split(str, sp)
    if sp == nil then return {} end

    local t = {} ; 
    local i = 1
    for s in string.gmatch(str, "([^"..sp.."]+)") do
        t[i] = s
        i = i + 1
    end

    return t
end

return p