モジュール:サンドボックス/しまあじ/前後年月カテゴリ

local objLINKYMCAT = {};
objLINKYMCAT.ifexist = function( frame )
local page = frame.args1
if not page then return "" end
if mw.title.new(page).exists then return "1" end
return ""
end
objLINKYMCAT.divdateCore = function( ymm ) 
local tbl = {}
local len = mw.ustring.len( ymm )
local c = ""
tbl'y'  = ""
tbl'm1' = ""
tbl'm2' = ""
if 5 " .. objLINKYMCAT.catlinkCore( catinfo'catU2', "", "", "→ " .. catinfo'catU2' ) .. ""
else
strU = objLINKYMCAT.catlinkCore( catinfo'catU1', "", "", "→ " .. catinfo'catU1' ) .. ""
end
elseif catinfo'catU2' ~= "" then
strU = objLINKYMCAT.catlinkCore( catinfo'catU2', "", "", "→ " .. catinfo'catU2' ) .. ""
end
-- 下段
if catinfo'catL1' ~= "" then
if catinfo'catL2' ~= "" then
strL = objLINKYMCAT.catlinkCore( catinfo'catL1', "", "", "→ " .. catinfo'catL1' ) .. "" .. objLINKYMCAT.catlinkCore( catinfo'catL2', "", "", "→ " .. catinfo'catL2' ) .. ""
else
strL = objLINKYMCAT.catlinkCore( catinfo'catL1', "", "", "→ " .. catinfo'catL1' ) .. ""
end
elseif catinfo'catL2' ~= "" then
strL = objLINKYMCAT.catlinkCore( catinfo'catL2', "", "", "→ " .. catinfo'catL2' ) .. ""
end
-- 中段
strM = objLINKYMCAT.catlinkCore( cat, "", "", "→ " .. cat )
if ym ~= nil and ym ~= "" then
strM = strM .. " " .. sep .. " "
if ymL ~= nil and ymL ~= "" then
if mw.ustring.sub( ym, tonumber("6"), tonumber("7") ) ~= "以前" then
if ymLL ~= nil and ymLL ~= "" then
if mw.ustring.sub( ymL, tonumber("6"), tonumber("7") ) ~= "以前" then
strM = strM .. objLINKYMCAT.catlinkCore( cat, sep, ymLL, mw.ustring.sub(ymLL, tonumber("1"), tonumber("5")) ) .. " " .. objLINKYMCAT.catlinkCore( cat, sep, ymY, ym ) .. ""
else
strM = strM .. "" .. ym .. ""
end
if ymR ~= nil and ymR ~= "" then
strM = strM .. " > " .. objLINKYMCAT.catlinkCore( cat, sep, ymR, ymR )
if ymRR ~= nil and ymRR ~= "" then
strM = strM .. " > " .. objLINKYMCAT.catlinkCore( cat, sep, ymRR, mw.ustring.sub(ymRR, tonumber("1"), tonumber("5")) )
end
end
end
strM = strM .. ""
return strU .. strM ..strL
end
objLINKYMCAT.catlink = function( frame ) 
return objLINKYMCAT.catlinkCore( frame.args1, frame.args2, frame.args3, frame.args4 )
end
objLINKYMCAT.catlinkCore = function( cat, sep, ym, show ) 
local linkstr = ""
local showstr = ""
if ym == nil or ym == "" then
linkstr = cat
else
linkstr = cat .. sep .. ym
end
if show == nil or show == "" then
showstr = linkstr
else
showstr = show
end
return "" .. showstr.. ""   
end
objLINKYMCAT.mboxmsg = function( frame ) 
local tag
local msg
if frame.args'説明' ~= nil and frame.args'説明' ~= "" and frame.args'説明' ~= "1" then
msg = frame.args'説明'
else
if frame.args'タグ' ~= nil and frame.args'タグ' ~= "" then
tag = frame.args'タグ'
else
tag = objLINKYMCAT.taglink( frame )
end
msg = tag .. "が貼り付けられた月順に並んでいます。A は 10月、B は 11月、C は 12月 です。各同一月内については、タグにソートキーが設定されている場合を除きページ名順です。このカテゴリの期間内で異なる月の2つ以上のタグが貼られている場合、どのタグの月に分類されているかは各タグのページ内での位置によります。"
end
return msg
end
objLINKYMCAT.taglink = function( frame ) 
local catinfo = objLINKYMCAT.getcatinfo ( frame )
return catinfo'tag'
end
objLINKYMCAT.getcatinfo = function( frame ) 
local catinfo = {};
local cat = frame.args1
local cat2 = ""
local catU0 = "修正が必要なページ"
local catU1 = "出典を必要とする記事"
local catU2 = ""
local catL1 = ""
local catL2 = ""
local tag = "タグ"
catinfo'catU1' = ""
catinfo'catU2' = ""
catinfo'catL1' = ""
catinfo'catL2' = ""
catinfo'tag' = tag
if cat == nil or cat == "" then
return catinfo
end
cat2 = mw.ustring.sub(cat, tonumber("1"), tonumber("1"));
if cat2 == "W" then
tag = "Wikify"
catU1 = catU0
elseif cat2 == "外" then
tag = "リンク切れ"
catU1 = catU0
elseif cat2 == "検" then
local catRI  = "検証が求められている記事"
local catRID = "検証が求められている記述のある記事"
if cat == catRI then
tag = "未検証"
catL1 = catRID
elseif cat == catRID then
tag = "要検証・要検証範囲"
catU2 = catRI
end
elseif cat2 == "国" then
tag = "国際化"
catU1 = catU0
elseif cat2 == "言" then
local catWS  = "言葉を濁した記述のある記事"
if cat == catWS then
tag = "言葉を濁さない"
elseif cat == catWS .. " (誰)" then
tag = "誰・誰範囲"
catU2 = catWS
elseif cat == catWS .. " (誰2)" then
tag = "誰2・誰2範囲・誰範囲2"
catU2 = catWS
elseif cat == catWS .. " (いつ)" then
tag = "いつ・いつ範囲"
catU2 = catWS
elseif cat == catWS .. " (どこ)" then
tag = "どこ・どこ範囲"
catU2 = catWS
end
elseif cat2 == "雑" then
tag = "雑多な内容の箇条書き"
catU1 = catU0
elseif cat2 == "字" then
tag = "字引"
catU1 = catU0
elseif cat2 == "出" then
local catCN  = catU1
local catCNS = "出典を必要とする節のある記事"
local catCND = "出典を必要とする記述のある記事"
local catBS  = "出典を必要とする存命人物記事"
local catBU  = "出典皆無な存命人物記事"
if cat == catCN then
tag = "出典の明記"
catU1 = catU0
catL1 = catCNS
catL2 = catCND
elseif cat == catCNS then
tag = "section=1"
elseif cat == catCND then
tag = "要出典・要出典範囲"
elseif cat == catBS then
tag = "存命人物の出典明記"
catL1 = catBU
elseif cat == catBU then
tag = "BLP unsourced"
catU2 = catBS
end
elseif cat2 == "情" then
tag = "更新"
catU1 = catU0
elseif cat2 == "宣" then
tag = "宣伝"
catU1 = catU0
elseif cat2 == "独" then
local catOR  = "独自研究の除去が必要な記事"
local catORS = "独自研究の除去が必要な節のある記事"
local catORD = "独自研究の除去が必要な記述のある記事"
if cat == catOR then
tag = "独自研究"
catL1 = catORS
catL2 = catORD
elseif cat == catORS then
tag = "section=1"
catU2 = catOR
elseif cat == catORD then
tag = "独自研究範囲"
catU2 = catOR
end
elseif cat2 == "特" then
tag = "特筆性"
elseif cat2 == "翻" then
tag = "翻訳中途"
catU1 = ""
elseif cat2 == "無" then
tag = "出典無効"
end
catinfo'catU1' = catU1
catinfo'catU2' = catU2
catinfo'catL1' = catL1
catinfo'catL2' = catL2
catinfo'tag' = tag
return catinfo
end
return objLINKYMCAT