편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.
최신판 | 당신의 편집 | ||
36번째 줄: | 36번째 줄: | ||
and subpage ~= "sandbox" | and subpage ~= "sandbox" | ||
and subpage ~= "testcases" | and subpage ~= "testcases" | ||
then | then | ||
return subpage | return subpage | ||
50번째 줄: | 43번째 줄: | ||
end | end | ||
--[[Get the last subpage of | --[[Get the last subpage of the current page if it is a translation. | ||
]] | ]] | ||
function this. | function this.getLanguageSubpage() | ||
--[[This code does not work in all namespaces where the Translate tool works. | --[[This code does not work in all namespaces where the Translate tool works. | ||
-- It works in the main namespace on Meta because it allows subpages there | -- It works in the main namespace on Meta because it allows subpages there | ||
84번째 줄: | 58번째 줄: | ||
-- bug of Meta-Wiki. The work-around is to split the full title and then | -- bug of Meta-Wiki. The work-around is to split the full title and then | ||
-- get the last titlepart. | -- get the last titlepart. | ||
local subpage = title.subpageText | local subpage = mw.title.getCurrentTitle().subpageText | ||
--]] | --]] | ||
local titleparts = mw.text.split(mw.title.getCurrentTitle().fullText, '/') | |||
local subpage = titleparts[#titleparts] | |||
return this.checkLanguage(subpage, '') | |||
end | end | ||
100번째 줄: | 68번째 줄: | ||
]] | ]] | ||
function this.getMainLanguageSubpage() | function this.getMainLanguageSubpage() | ||
parts = mw.text.split( this. | parts = mw.text.split( this.getLanguageSubpage(), '-' ) | ||
return parts[1] | return parts[1] | ||
end | end | ||
108번째 줄: | 76번째 줄: | ||
]] | ]] | ||
function this.getFrameLanguageSubpage(frame) | function this.getFrameLanguageSubpage(frame) | ||
local titleparts = mw.text.split(frame:getParent():getTitle(), '/') | |||
local subpage = titleparts[#titleparts] | |||
return this.checkLanguage(subpage, '') | |||
end | end | ||
189번째 줄: | 159번째 줄: | ||
if (subpage == '') | if (subpage == '') | ||
then | then | ||
subpage = this. | subpage = this.getLanguageSubpage() | ||
end | end | ||
if (subpage == '') | if (subpage == '') | ||
283번째 줄: | 253번째 줄: | ||
TemplateSandbox; mocking it with this method means templates won't be | TemplateSandbox; mocking it with this method means templates won't be | ||
localized but at least TemplateSandbox substitutions will work properly. | localized but at least TemplateSandbox substitutions will work properly. | ||
]] | ]] | ||
function this.mockTNT(frame) | function this.mockTNT(frame) | ||
301번째 줄: | 270번째 줄: | ||
end | end | ||
end | end | ||
return frame:expandTemplate{title = pargs[1], args = arguments} | |||
return frame:expandTemplate{title = | |||
end | end | ||
return this | return this |