Content deleted Content added
improve comment, and don't transclude the parent title |
use title objects to make page-name parsing more robust |
||
Line 8:
local getContent = mock_title.getContent
function generate_transclusion(title)
local full_text = type(title) == 'table' and title.fullText or title
rawset(mock_title, 'fullText',
getContent(mock_title)
end
-- I can do the same thing without rawset.
end
local function make_wikitext_warning(msg)
return string.format('<strong class="warning">Warning: %s.</strong>\n', msg)
end
Line 48 ⟶ 53:
local parent_title = frame:getParent():getTitle()
if frame:preprocess("{{CASCADINGSOURCES:" .. parent_title .. "}}") == "" then
output[#output + 1] = make_wikitext_warning(string.format(
'the page "%s" is not cascade-protected',
parent_title
))
end
end
-- Generate transclusions to the templates, and build the output.
for
if title then
local ns = title.namespace
local prefixed_text = title.prefixedText
generate_transclusion('Template:' .. item)▼
output[#output + 1] = '* [[Template:' .. item .. ']]'▼
-- The item had no namespace text. If the item starts with a
-- colon, assume it is a mainspace page. Otherwise, assume it is
generate_transclusion(item)▼
-- a template.
output[#output + 1] = '* [[:' .. item .. ']]'▼
generate_transclusion(
output[#output + 1] = '* [[
else
▲ elseif rest ~= '' then
generate_transclusion(
output[#output + 1] = '* [[Template:' ..
end
elseif ns == 6 or ns == 14 then -- File or Category namespace
else
end
else
output[#output + 1] = make_wikitext_warning(string.format(
'invalid title "%s" in argument #%d',
frame.args[i],
i
))
end
end
|