모듈:Disambiguation
보이기
| 위 설명은 모듈:Disambiguation/설명문서의 내용을 가져와 보여주고 있습니다. (편집 | 역사) 연습장 (생성 | 복제) 및 시험장 (생성) 문서에서 이 모듈을 실험할 수 있습니다. 이 모듈에 딸린 문서. |
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
function p._disambiguation(argsWithBlanks)
local args = {}
for k, v in pairs(argsWithBlanks) do
if k == 'categories' or v ~= '' then
args[k] = v
end
end
local current_title = mw.title.getCurrentTitle()
local namespace = args.namespace or current_title.nsText
local title = args.title or current_title.text
local shared = yesno(args.shared)
args.title = nil
args.shared = nil
-- info text
local infoword1 = '문헌'
local infoword2 = '제목'
if namespace == '저자' then
infoword1 = '저자'
infoword2 = '이름'
elseif namespace == '포털' then
infoword1 = '포털'
infoword2 = '주제'
end
-- 조사 변경을 위한 더러운 코드
local suffix2
if infoword2 == '주제' then
suffix2 = '가'
else
suffix2 = '이'
end
local suffix1
if infoword1 == '저자' then
suffix1 = '가'
else
suffix1 = '이'
end
local info = tostring(mw.html.create('p'):wikitext(table.concat({
'이 문서는 [[위키문헌:동음이의어 문서|동음이의어 문서]]로, ',
infoword2,
suffix2,
' 같지만 가리키는 ',
infoword1,
suffix1,
' 다른 경우 사용합니다. 만약 어떤 링크가 [[특수:가리키는문서/',
current_title.fullText,
'|이 문서를 가리키고 있다면]], 그 링크를 알맞게 고쳐 주십시오.'
})))
if args.notes then
args.notes = info .. '<p>' .. args.notes .. '</p>'
elseif args['설명'] then
args.notes = info .. '<p>' .. args['설명'] .. '</p>'
else
args.notes = info
end
-- categories
local categories = args.category or args['분류']
local cat = namespace .. ' 동음이의어 문서'
args.category = nil
args.categories = nil
-- header
local disambig_text = ' <span style="font-weight:normal;">(동음이의)</span>'
local postheader = tostring(mw.html.create('div'):addClass('subNote'):css({['margin'] = '4px auto 4px auto'}):wikitext(
tostring(mw.html.create('span'):attr('id', 'nofooter'):wikitext(
args.intro
or '이름이 ' .. tostring(mw.html.create('span'):css({['font-weight'] = 'bold'}):wikitext(title)) .. '인 문서에는 다음이 있습니다.'
))
))
args.disambiguation = true
local header
if namespace == '저자' then
args.firstname = title .. disambig_text
args.use_initials = false
args.description = args.notes
args.nocat = true
header = require('Module:Author')._author(args)
elseif namespace == '포털' then
args.title = title .. disambig_text
args.class = 'none'
args.nocat = true
args.reviewed = 'n/a'
header = require('Module:Portal header')._portal_header(args)
elseif namespace == '' or namespace == '틀' then
args.pretitle = '문헌'
if shared then
args.pretitle = 'Works and pages in other namespaces'
end
args.pretitle = '다음의 이름을 가진 ' .. args.pretitle .. ' 목록:'
args.title = title
if shared and not current_title.isSubpage then
-- should be redundant as attached to header
args.notes = args.notes .. '[[Category:' .. 'Merged disambiguation pages' .. ']]'
end
args.header_class = 'ws-dynlayout-disable'
header = require('Module:Header')._header(args)
cat = '동음이의어 문서'
else
header = require('Module:Error')['error']({'[[Module:Disambiguation]] 오류: {{[[틀:동음이의어 머리말|동음이의어 머리말]]}}은 일반, 저자, 포털 이름공간에서만 사용해야 합니다.'})
postheader = ''
cat = '동음이의어 문서 이름공간 오류'
end
return header .. mw.getCurrentFrame():preprocess('__DISAMBIG__') .. postheader .. (categories or '[[분류:' .. cat .. ']]')
end
function p.disambiguation(frame)
return p._disambiguation(getArgs(frame, {removeBlanks = false}))
end
return p