Content deleted Content added
we need to trim the items for mw.title.new |
Jackmcbarn (talk | contribs) Avoid an unnecessary call to frame:preprocess |
||
(3 intermediate revisions by one other user not shown) | |||
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 45 ⟶ 44:
-- This creates an extaneous self-transclusion for all pages using the
-- module, but we treat that as a necessary evil.
do
mw.title.getCurrentTitle():getContent() -- Generate self-transclusion
local parent_title = frame:getParent():getTitle()
if
'the page "%s" is not cascade-protected',
parent_title
Line 60 ⟶ 55:
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 ⟶ 68:
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',
i
))
Line 95 ⟶ 90:
if frame.args.silent then
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
|