439
edits
(add renderCells(), needs testing) |
m (87 revisions imported from wikipedia:Module:Template_test_case) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 94: | Line 94: | ||
function Template:getFullPage() | function Template:getFullPage() | ||
if self.template then | if not self.template then | ||
return self.title.prefixedText | |||
elseif self.template:sub(1, 7) == '#invoke' then | |||
return 'Module' .. self.template:sub(8):gsub('|.*', '') | |||
else | |||
local strippedTemplate, hasColon = self.template:gsub('^:', '', 1) | local strippedTemplate, hasColon = self.template:gsub('^:', '', 1) | ||
hasColon = hasColon > 0 | hasColon = hasColon > 0 | ||
Line 106: | Line 110: | ||
return mw.site.namespaces[10].name .. ':' .. strippedTemplate | return mw.site.namespaces[10].name .. ':' .. strippedTemplate | ||
end | end | ||
end | end | ||
end | end | ||
Line 211: | Line 213: | ||
generalOptions.showcaption = yesno(generalOptions.showcaption) ~= false | generalOptions.showcaption = yesno(generalOptions.showcaption) ~= false | ||
generalOptions.collapsible = yesno(generalOptions.collapsible) | generalOptions.collapsible = yesno(generalOptions.collapsible) | ||
generalOptions.notcollapsed = yesno(generalOptions.notcollapsed) | |||
generalOptions.wantdiff = yesno(generalOptions.wantdiff) | generalOptions.wantdiff = yesno(generalOptions.wantdiff) | ||
obj.options = generalOptions | obj.options = generalOptions | ||
Line 346: | Line 349: | ||
if self.options.wantdiff then | if self.options.wantdiff then | ||
root | root | ||
:addClass('mw-collapsible mw-collapsed') | :addClass('mw-collapsible') | ||
if self.options.notcollapsed == false then | |||
root | |||
:addClass('mw-collapsed') | |||
end | |||
root | |||
:css('background-color', 'transparent') | :css('background-color', 'transparent') | ||
:css('width', '100%') | :css('width', '100%') | ||
Line 364: | Line 372: | ||
root | root | ||
:addClass('mw-collapsible') | :addClass('mw-collapsible') | ||
:addClass(isEqual and 'mw-collapsed' or nil) | if self.options.notcollapsed == false then | ||
root | |||
:addClass('mw-collapsed') | |||
end | |||
if self.options.notcollapsed ~= true or false then | |||
root | |||
:addClass(isEqual and 'mw-collapsed' or nil) | |||
end | |||
root | |||
:css('background-color', 'transparent') | :css('background-color', 'transparent') | ||
:css('width', '100%') | :css('width', '100%') | ||
Line 729: | Line 745: | ||
function TableInvocation:getOutput(options) | function TableInvocation:getOutput(options) | ||
if (options.template:sub(1, 7) == '#invoke') then | |||
local moduleCall = mw.text.split(options.template, '|', true) | |||
local args = mw.clone(self.invokeArgs) | |||
table.insert(args, 1, moduleCall[2]) | |||
return mw.getCurrentFrame():callParserFunction(moduleCall[1], args) | |||
end | |||
return mw.getCurrentFrame():expandTemplate{ | return mw.getCurrentFrame():expandTemplate{ | ||
title = options.template, | title = options.template, |