模組:沙盒/魔琴/CPTLEM/LEM
外观
local p={}
local c=""
local rc=""
local valid_proj = { 'w', 'wikt', 'b', 'n', 'q', 'voy', 's', 'v' }
local inc_pref = {
w = 'incubator:wp/',
wikt = 'incubator:wt/',
b = 'incubator:wb/',
n = 'incubator:wn/',
q = 'incubator:wq/',
voy = 'incubator:wy/',
s = 'oldwikisource:Main Page/',
v = false
}
local noinc = {
s = ".wikisource.org",
v = ".wikiversity.org"
}
function findinc(l, pj)
if inc_pref[pj] then
return string.format('[' .. '[:' .. inc_pref[pj] .. l .. '|' .. pj .. ']' .. '] ')
else
return string.format('[' .. '[:betawikiversity:Category:' .. string.upper(l) .. '|' .. pj .. ']' .. '] ')
end
end
function checkproj(l, pj)
if noinc[pj] then
return string.format('[https://' .. l .. noinc[pj] .. ' ' .. pj .. ']')
else
return ""
end
end
function p.input(frame)
if frame.args.parent then
args = frame:getParent().args
else
args = frame.args
end
local lang = args[1]
local provided = {}
local count = 0
for k,_ in pairs(args) do
count = count + 1
end
for i = 2, count do
provided[args[i]] = true
end
local parts = {}
local present = ""
local absent = ""
local check = ""
for _, pc in ipairs(valid_proj) do
if provided[pc] then
present = present .. string.format('[' .. '[:' .. pc .. ':' .. lang .. '|' .. pc .. ']' .. '] ')
if pc=="w" then
rc = "[https://" .. lang .. ".wikipedia.org/w/index.php?hidebots=1&hidecategorization=1&hideWikibase=1&hidelog=1&limit=70&days=8&title=Special:RecentChanges&urlversion=2 RC]"
end
else
absent = absent .. findinc(lang, pc)
check = check .. checkproj(lang, pc)
if pc== "w" then
c='||style="text-align:center;background-color:#fdd"|<b>C</b>'
end
end
end
table.insert(parts, present .. '||' .. absent .. '||' .. check .. '||' .. rc .. c)
return lang .. '||' .. table.concat(parts, '\n')
end
return p