모듈:License
보이기
| 위 설명은 모듈:License/설명문서의 내용을 가져와 보여주고 있습니다. (편집 | 역사) 연습장 (생성 | 복제) 및 시험장 (생성) 문서에서 이 모듈을 실험할 수 있습니다. 이 모듈에 딸린 문서. |
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
function p._license(args)
local frame = mw.getCurrentFrame()
-- Parameters
local text = frame:preprocess(args.text or args['설명'] or '{{{설명}}}')
local image = args.image or args['그림']
local image_r = args.image_r or args['image-r'] or args['그림2']
local image_size = args.image_size or args['image-size'] or args['그림크기'] or 'x48px'
local image_r_size = args.image_r_size or args['image-r-size'] or args['그림2크기'] or image_size
local warning = args.warning or args['경고']
local category = args.category or args['분류']
local category2 = args.category2 or args['분류2']
if category == '' then
category = nil
end
if category2 == '' then
category2 = nil
end
-- licenseContainer is the class that styles depend on
local class_param = 'class="' .. 'licenseContainer licenseBanner dynlayout-exempt ' .. (args.class or args['속성'] or '') .. '"'
local id_param = ''
if args.id then
id_param = 'id="' .. args.id .. '"'
end
-- opening div
local openDiv = '<div>'
-- closing div
local closeDiv = '</div>'
-- license banner
local leftField = '<span class="noimageLeft"></span>'
if image then
leftField = '<span class="imageLeft">[[File:' .. image .. '|' .. image_size .. '|alt=|link=]]</span>'
end
leftField = table.concat({openDiv, leftField, closeDiv}, '\n')
local centerField = table.concat({openDiv, openDiv, text, closeDiv}, '\n')
if warning then
centerField = centerField .. '\n' .. table.concat({
openDiv,
openDiv,
'[[File:OOjs UI icon alert destructive black-darkred.svg|35px]]',
closeDiv,
openDiv,
warning,
closeDiv,
closeDiv
}, '\n')
end
centerField = centerField .. '\n' .. closeDiv
local rightField = '<span class="noimageRight></span>'
if image_r then
rightField = '<span class="imageRight">[[File:' .. image_r .. '|' .. image_r_size .. '|alt=|link=]]</span>'
end
rightField = table.concat({openDiv, rightField, closeDiv}, '\n')
local licenseBanner = table.concat({
openDiv,
openDiv,
openDiv,
leftField,
centerField,
rightField,
closeDiv,
closeDiv,
closeDiv
})
-- Commons auto-detection
local commonsAutoDetection = table.concat({
'<div class="licensetpl">\n',
'<span class="licensetpl_short">Public domain</span>',
'<span class="licensetpl_long">Public domain</span>',
'<span class="licensetpl_link_req">false</span>',
'<span class="licensetpl_attr_req">false</span>',
'\n</div>'
})
-- Categorization
local namespace = args.namespace or mw.title.getCurrentTitle().nsText
local noCatNamespaces = {
['도움말'] = true,
['도움말토론'] = true,
['틀'] = true,
['틀토론'] = true,
['위키문헌'] = true,
['위키문헌토론'] = true,
['모듈'] = true,
['모듈토론'] = true,
['분류'] = true,
['분류토론'] = true,
['초안'] = true,
['초안토론'] = true
}
local categoryContent = ''
if not noCatNamespaces[namespace] then
if namespace == '저자' or namespace == '저자토론' then
if category then
category = '저자-' .. category
end
if category2 then
category2 = '저자-' .. category2
end
end
if category then
category = '[[분류:' .. category .. ']]'
end
if category2 then
category2 = '[[분류:' .. category2 .. ']]'
end
categoryContent = (category or '') .. (category2 or '')
end
local templateStyles = frame:extensionTag('templatestyles', '', {src = '틀:저작권/styles.css'})
return templateStyles .. table.concat({
'<div ' .. class_param .. ' ' .. id_param .. '>',
licenseBanner,
commonsAutoDetection,
categoryContent .. closeDiv
}, '\n')
end
function p.license(frame)
return p._license(getArgs(frame))
end
return p