모듈:Unicode: 두 판 사이의 차이
보이기
편집 요약 없음 |
편집 요약 없음 |
||
| 71번째 줄: | 71번째 줄: | ||
if args['이름'] == nil then charname = mw.title.getCurrentTitle().prefixedText | if args['이름'] == nil then charname = mw.title.getCurrentTitle().prefixedText | ||
else charname = args['이름'] end | else charname = args['이름'] end | ||
local eng = args['영어이름'] or '' | |||
local root = mw.html.create('table'):addClass('wikitable'):cssText('margin: 0 0.4em;max-width:100%;width: 21em;float: right; text-align: center; clear:both') | local root = mw.html.create('table'):addClass('wikitable'):cssText('margin: 0 0.4em;max-width:100%;width: 21em;float: right; text-align: center; clear:both') | ||
| 76번째 줄: | 77번째 줄: | ||
if args['이름'] ~= '없음' then | if args['이름'] ~= '없음' then | ||
tr = ustring.format('<tr><th><div>%s</div><small>%s</small></th></tr>', charname, | tr = ustring.format('<tr><th><div>%s</div><small>%s</small></th></tr>', charname, eng) | ||
else | else | ||
tr = ustring.format('<tr><th><small>%s</small></th></tr>', | tr = ustring.format('<tr><th><small>%s</small></th></tr>', eng) | ||
end | end | ||
root:node(tr) | root:node(tr) | ||
2021년 12월 22일 (수) 17:59 판
{{#css: .template-documentation {
clear: both; margin: 1em 0 0 0; padding: 1em
} /* 아래 상자 */ .mbox-text {
clear: both; background-color: #e8ffe8;
}
.template-documentation-template-data .mw-templatedata-doc-desc {
display: none;
}
}}
모듈:Unicode을 이용합니다.
스크립트 오류: 함수 "uni_char"가 존재하지 않습니다.
{{유니코드문자|[}}
스크립트 오류: 함수 "uni_char"가 존재하지 않습니다.
{{유니코드문자|이름=왼쪽 대괄호|[}}
아래는 가능한 모든 변수들을 나열한 것입니다.
스크립트 오류: 함수 "uni_char"가 존재하지 않습니다.
위 설명은 모듈:Unicode/설명문서의 내용을 가져와 보여주고 있습니다.
연습장이나 사용자 문서에서 틀의 사용이나 수정을 연습할 수 있습니다.
local ustring = mw.ustring
local getArgs = require('Module:Arguments').getArgs
local p = {}
------------------------- codepoint ------------------------------------------
function p.code( frame )
local char = getArgs(frame)[1] or nil
if char then
return p.code_(char)
else
return '입력값이 없습니다.'
end
end
function p.code_( char, base, offset )
if type(char) == 'string' then
if offset == nil then offset = 0 end
local baseformat, head
if base == '10' then
baseformat = '%d'; head = 'U+'
elseif base == 'x16' then
baseformat = '%x'; head = 0
return ustring.codepoint(char) + offset
else
baseformat = '%x'; head = 'U+'
end
return head..ustring.upper(ustring.format(baseformat, ustring.codepoint(char) + offset))
else
return 0
end
end
---------------------- next codepoint ---------------------------------------
function p.nextcode( frame )
local char = getArgs(frame)[1] or nil
if char then
return p.code_(char, '16', 1)
else
return '입력값이 없습니다.'
end
end
---------------------- prev codepoint ---------------------------------------
function p.prevcode( frame )
local char = getArgs(frame)[1] or nil
if char then
return p.code_(char, '16', -1)
else
return '입력값이 없습니다.'
end
end
---------------------- next char ---------------------------------------
function p.nextchar( frame )
local char = getArgs(frame)[1] or nil
if char then
return ustring.char(p.code_(char, 'x16', 1))
else
return '입력값이 없습니다.'
end
end
---------------------- prev char ---------------------------------------
function p.prevchar( frame )
local char = getArgs(frame)[1] or nil
if char then
return ustring.char(p.code_(char, 'x16', -1))
else
return '입력값이 없습니다.'
end
end
---------------------- {틀:유니코드문자} ---------------------------------------
function p.unicodechar( frame )
local args = getArgs(frame)
local charname
if args['이름'] == nil then charname = mw.title.getCurrentTitle().prefixedText
else charname = args['이름'] end
local eng = args['영어이름'] or ''
local root = mw.html.create('table'):addClass('wikitable'):cssText('margin: 0 0.4em;max-width:100%;width: 21em;float: right; text-align: center; clear:both')
local tr, td
if args['이름'] ~= '없음' then
tr = ustring.format('<tr><th><div>%s</div><small>%s</small></th></tr>', charname, eng)
else
tr = ustring.format('<tr><th><small>%s</small></th></tr>', eng)
end
root:node(tr)
tr = mw.html.create('tr')
local prev = args['이전'] or args['전문자'] or '?'
td = ustring.format('<td><div>%s</div>←</td>', prev)
tr:node(td)
local curr = args['기호'] or args['문자'] or '?'
td = ustring.format('<td style="width:4em"><div style="font-size: 1.8em;line-height: 1.2em;"><b>%s</b></div><small><span style="color: gray;">%s</span></small></td>', next, curr)
tr:node(td)
local next = args['이후'] or args['후문자'] or '?'
td = ustring.format('<td><div>%s</div>←</td>', next)
tr:node(td)
root:node(tr)
return tostring(root)
end
return p