FANDOM


--USER:KOCKAADMIRALAC
 
--<nowiki>
local p = {}
 
function p.vocadb(frame)
    local args = frame:getParent().args
    local sorted = {}
    local ret = {}
    local title = mw.title.getCurrentTitle()
    local found
    if args.vocadb == 'ok' then
        return '[[Category:Tracking/VocaDB link not applicable]]'
    end
    for k, v in pairs(args) do
        if mw.ustring.sub(k, 0, 6) == 'vocadb' then
            found = true
            local n = mw.ustring.sub(k, 7)
            if n == '' then
                args.p1 = args.p
                args.a1 = args.a
                n = '1'
            end
            sorted[tonumber(n)] = v
        end
    end
    if not found then
        if title.namespace == 0 then
            return '[[Category:Tracking/No VocaDB link]]'
        else
            return ''
        end
    end
    for k, v in ipairs(sorted) do
        local suffix
        if args['p' .. k] then
            suffix = 'Ar'
        elseif args['a' .. k] then
            suffix = 'Al'
        else
            suffix = 'S'
        end
        table.insert(ret, '* [https://vocadb.net/')
        table.insert(ret, suffix)
        table.insert(ret, '/')
        table.insert(ret, v)
        table.insert(ret, ' VOCALOID Database]\n')
    end
    return table.concat(ret)
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.