소개
낙엽의 노가다 작업을 도와줄 봇입니다.
Auto Wiki Browser를 쓰고 있습니다.
Pywikibot도 쓰기 시작했습니다.
메모
이 글을 보려면 오른쪽 '펼치기' 버튼 클릭
|
뉴스 레퍼런스 헤더와 푸터
|
[[{{풀기:#invoke:string|match|{{풀기:PAGENAME}}|%d%d%d%d}}년]] [[{{풀기:#invoke:string|match|{{풀기:PAGENAME}}|[^/]+$}}]] [[{{풀기:#invoke:string|match|{{풀기:PAGENAME}}|/([^/]+)}}]] 관련 뉴스 모음.
{{분류|문서 성격/레퍼런스, 연도/{{풀기:#invoke:string|match|{{풀기:PAGENAME}}|%d%d%d%d}}년, {{풀기:#ifeq:{{풀기:#invoke:string|find|{{풀기:PAGENAME}}|월}}|0|{{#ifeq:{{풀기:#invoke:string|find|{{풀기:PAGENAME}}|분기}}|0|반기|분기}}|월}}/{{풀기:#invoke:string|match|{{풀기:PAGENAME}}|[^/]+$}}}}
|
날짜 문서 자동 생성
|
local p = {}
function p.main(frame)
local month = string.sub(frame.args[1],string.find(frame.args[1],'%d+'))
local day = string.sub(string.sub(frame.args[1],3),string.find(string.sub(frame.args[1],3),'%d+'))
if month=='1' then
month = 'January'
elseif month == '2' then
month = 'February'
elseif month == '3' then
month = 'March'
elseif month == '4' then
month = 'April'
elseif month == '5' then
month = 'May'
elseif month == '6' then
month = 'June'
elseif month == '7' then
month = 'July'
elseif month == '8' then
month = 'August'
elseif month == '9' then
month = 'September'
elseif month == '10' then
month = 'October'
elseif month == '11' then
month = 'November'
elseif month == '12' then
month = 'December'
end
return month .. ' ' .. day
end
return p
{{달력|year={{#time:Y}}|month={{풀기:#time:n|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}}}}}
'''{{풀기:FULLPAGENAME}}'''은 [[그레고리력]]으로 {{풀기:#expr:{{풀기:#time:z|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}, 2001}}+1}}번째{{풀기:#ifexpr:{{풀기:#time:n|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}}}<3||([[윤년]]일 경우 {{풀기:#expr:{{풀기:#time:z|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}, 2000}}+1}}번째)}} 날이다.
{{분류|월|{{풀기:#time:n|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}}}월|일|{{풀기:#time:j|{{풀기:#invoke:연습장/렌즈/분류 틀|main|{{풀기:PAGENAME}}}}}}일}}
|
분류 문법 통일
|
local p = {}
local function _recategorize(categoryBundles)
local returnText = '{{분류'
for k, v in pairs(categoryBundles) do
if k == 1 then returnText = returnText .. '|'
else returnText = returnText .. ', '
end
returnText = returnText .. v[1] .. '/' .. v[2]
end
returnText = returnText .. '}}'
return returnText
end
--틀에서 호출되거나 바로 모듈이 호출되거나 상관없이 매개변수에 접근할 수 있도록 합니다.
local function safeArgs(frame)
if frame.args[1] ~= nil then --frame은 metatable이라 next(frame.args)가 안 된다고 하여 이리 되었습니다.
return frame.args
else
return frame:getParent().args
end
end
--패싯과 패싯 멤버를 묶습니다.
local function bundle(args)
--{{분류|성격/단체, 성향/페미니즘}} 식으로 호출되었으면 적당히 분리합니다.
local temp = {}
if string.match(args[1],',') ~= nil then
for word in string.gmatch(args[1],'%s*([^,]+)%s*') do
temp[#temp+1] = word
end
args = temp
end
--매개변수들이 '성격/단체', '성향/페미니즘'식으로 오지 않았는가 검사하고 번들로 만듭니다.
local bundles = {}
if string.find(args[1],'/') ~= nil then
for i, v in ipairs(args) do
bundles[#bundles + 1] = { string.match(v,"([^/]+)/"), string.match(v, "/(.+)") }
end
else
for i, v in ipairs(args) do
if i % 2 ~= 0 then
bundles[#bundles+1] = {string.match(v,"^%s*(.-)%s*$")}
else
bundles[#bundles][2] = string.match(v,"^%s*(.-)%s*$")
end
end
end
return bundles
end
function p.recategorize(frame)
return _recategorize(bundle(safeArgs(frame)))
end
return p
{{분류|([^}]+)}}
{{풀기:#invoke:연습장/렌즈|recategorize|$1}}
|
|