모듈:인터위키: 두 판 사이의 차이
보이기
편집 요약 없음 |
편집 요약 없음 |
||
| 18번째 줄: | 18번째 줄: | ||
end | end | ||
local replacedDoc = ustring. | local replacedDoc = ustring.sub(frame.args[3], ' ', '%%20') | ||
baseText = ustring.gsub(baseText, '$2', replacedDoc ) | baseText = ustring.gsub(baseText, '$2', replacedDoc ) | ||
2021년 10월 26일 (화) 00:01 판
{{#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;
}
}}
사용방법
{{#invoke:인터위키|wiki|(위키명)|(언어명)|(문서명)|(표현명)}}
20번째 줄에서 Lua 오류: bad argument #2 to 'sub' (number expected, got string).위 설명은 모듈:인터위키/설명문서의 내용을 가져와 보여주고 있습니다.
연습장이나 사용자 문서에서 틀의 사용이나 수정을 연습할 수 있습니다.
local getArgs = require('Module:Arguments').getArgs
local ustring = mw.ustring
local wikiData = mw.loadData('Module:인터위키/data')
local p = {}
--[[
{{#invoke:wiki|(wiki name)|(codename)|(article)|(outer text)}}
]]
function p.wiki(frame)
if wikiData[frame.args[1]]~=nil then
local baseText = wikiData[frame.args[1]]
if frame.args[2] ~=nil then
baseText = ustring.gsub(baseText, '$1', frame.args[2])
else
baseText = ustring.gsub(baseText, '$1', 'en')
end
local replacedDoc = ustring.sub(frame.args[3], ' ', '%%20')
baseText = ustring.gsub(baseText, '$2', replacedDoc )
local exText = ''
if frame.args[4]~=nil then
exText = frame.args[4]
else
exText = frame.args[3]
end
return '<span class="plainlinks">['..baseText..' '..exText..']</span>'
end
end
return p