Use table instead of string concat for ret3
starcitizen>Alistair3149 Немає опису редагування |
starcitizen>Alistair3149 (Use table instead of string concat for ret3) |
||
| Рядок 14: | Рядок 14: | ||
local opts = frame.args; | local opts = frame.args; | ||
-- subpage header | -- subpage header | ||
| Рядок 38: | Рядок 37: | ||
ret2 = '' | ret2 = '' | ||
end | end | ||
return tostring( ret ) .. ret2 .. cats | return tostring( ret ) .. ret2 .. cats | ||
| Рядок 76: | Рядок 71: | ||
:done() | :done() | ||
ret3 = dependencyList._main(nil, args.category, args.isUsed) | ret3 = {} | ||
table.insert( ret3, dependencyList._main( nil, args.category, args.isUsed ) ) | |||
if args.fromWikipedia then | if args.fromWikipedia then | ||
ret3 | table.insert( ret3, | ||
mbox( | |||
string.format( | |||
'This %s is imported from [https://en.wikipedia.org/wiki/%s %s] on Wikipedia.', | |||
onModule and 'module' or 'template', | |||
page, | |||
page | |||
), | |||
'This template is imported from the English Wikipedia. Although the visual appearance might be different, the functionality is identical. Please refer to the Wikipedia page for detailed documentation.', | |||
{ icon = 'WikimediaUI-Logo-Wikipedia.svg' } | |||
) | |||
) | |||
end | end | ||
| Рядок 94: | Рядок 92: | ||
-- Testcase page | -- Testcase page | ||
if title.subpageText == 'testcases' then | if title.subpageText == 'testcases' then | ||
table.insert( ret3, | |||
hatnote( | |||
string.format( 'This is the test cases page for the module [[Module:%s]].', title.baseText ), | |||
{ icon='WikimediaUI-LabFlask.svg' } | |||
) | |||
) | |||
end | |||
table.insert( ret3, '<div class="documentation-modulestats">' ) | |||
-- Function list | |||
table.insert( ret3, require( 'Module:Module toc' ).main() ) | |||
-- Unit tests | |||
local testcaseTitle = title.baseText .. '/testcases' | |||
if mw.title.new( testcaseTitle, 'Module' ).exists then | |||
-- There is probably a better way :P | |||
table.insert( ret3, frame:preprocess( '{{#invoke:' .. testcaseTitle .. '|run}}' ) ) | |||
end | end | ||
ret3 | table.insert( ret3, '</div>' ) | ||
end | end | ||
return ret1 .. tostring( ret2 ) .. '<div class="documentation-content">' .. ret3 | return ret1 .. tostring( ret2 ) .. '<div class="documentation-content">' .. table.concat( ret3 ) | ||
end | end | ||