Content deleted Content added
m use single quotes for strings consistently |
always show warnings at the top, and use a more descriptive name than "output", seeing as it's not technically the output any more |
||
Line 2:
-- XXX: OUTRAGEOUS ABUSE OF SCRIBUNTO API
--
local generate_transclusion
do
Line 12:
getContent(mock_title)
end
end
local function make_wikitext_warning(msg)
return string.format('<strong class="warning">Warning: %s.</strong>
end
function export.lock(frame)
local
-- Check if the transcluding page is cascade-protected.
Line 53 ⟶ 52:
local parent_title = frame:getParent():getTitle()
if frame:preprocess('{{CASCADINGSOURCES:' .. parent_title .. '}}') == '' then
'the page "%s" is not cascade-protected',
parent_title
Line 60 ⟶ 59:
end
-- Generate transclusions to the templates, and build the output list.
for i, item in ipairs(frame.args) do
item = mw.text.trim(item)
Line 73 ⟶ 72:
if item:sub(1, 1) == ':' then
generate_transclusion(title)
else
generate_transclusion('Template:' .. prefixed_text)
end
elseif ns == 6 or ns == 14 then -- File or Category namespace
generate_transclusion(title)
else
generate_transclusion(title)
end
else
'invalid title "%s" in argument #%d',
frame.args[i],
Line 97 ⟶ 96:
return ''
else
-- If there were any warnings, show them at the top. Then show the list
return table.concat(output, '\n')▼
-- of transcluded pages.
local ret = ''
if #warnings > 0 then
if #warnings > 1 then
for i, warning in ipairs(warnings) do
warnings[i] = '* ' .. warning
end
end
ret = ret .. table.concat(warnings, '\n') .. '\n\n'
end
end
end
|