Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
move subst warning
Tag: Reverted
rv some
Line 264:
if demo then parameters.unknown = '' end
parameter_check = require('Module:Check for unknown parameters')._check(parameters, parent_args)
end
---------------------------
-- Location warning -------
---------------------------
iflocal show_namespace_warning = not (current_title.isTalkPage or demo) then
if show_namespace_warning then
local text = cfg.namespace_warning.text:format(
pagetype,
current_title.talkPageTitle.fullText,
parameter_format('category', 'no')
)
local sortkey = current_title.namespace==10 and cfg.namespace_warning.sortkey_on_template_page or cfg.namespace_warning.sortkey
if current_title.namespace==10 then -- on the Template namespace
text = text .. ' ' .. cfg.namespace_warning.on_template_page:format(
parameter_format('BANNER_NAME'),
current_title.prefixedText
)
end
return warning = mbox('ombox', {
image = '[[File:' .. cfg.subst_warningnamespace_warning.image .. '|40px]]',
type = cfg.namespace_warning.type_,
text = text
})
if not current_title.subjectPageTitle:inNamespace(2) then -- do not track errors in userspace
text = text .. wikilink add_category('Category:' .. cfg.namespace_warning.categorycategories, sortkey)
end
end
---------------------------
-- Substitution warning ---
---------------------------
if args.substcheck=='SUBST' then
local text = cfg.subst_warning.text:format(
project_name,
'<code>&#123;&#123;'..banner_name.prefixedText..'&#125;&#125;</code>'
)
return warning = warning .. mbox('ombox', {
image = '[[File:' .. cfg.namespace_warningsubst_warning.image .. '|' .. cfg.namespace_warning.size .. '40px]]',
type = cfg.subst_warning.type_,
text = text,
}) .. cfg.subst_warning.categories
end
---------------------------
Line 750 ⟶ 790:
frame:extensionTag ('templatestyles', '', {src = 'Module:WikiProject banner' .. (sandbox or '') .. '/styles.css'})
return parameter_check .. warning .. tstyle .. tostring(banner) .. table.concat(categories), note_count, #taskforce_output, assessment_link
end
 
local location_warning = function()
---------------------------
-- Location warning -------
---------------------------
local text = cfg.namespace_warning.text:format(
'page',
current_title.talkPageTitle.fullText,
parameter_format('category', 'no')
if current_title.namespace==10 then -- on the Template namespace
text = text .. ' ' .. cfg.namespace_warning.on_template_page:format(
parameter_format('BANNER_NAME'),
current_title.prefixedText
)
end
if not current_title.subjectPageTitle:inNamespace(2) then -- do not track errors in userspace
local sortkey = current_title.namespace==10 and cfg.namespace_warning.sortkey_on_template_page or cfg.namespace_warning.sortkey
text = text .. wikilink('Category:' .. cfg.namespace_warning.category, sortkey)
end
return mbox('ombox', {
image = '[[File:' .. cfg.namespace_warning.image .. '|' .. cfg.namespace_warning.size .. ']]',
type = cfg.namespace_warning.type_,
text = text
})
end
 
local substitution_warning = function(banner_name, project_name)
---------------------------
-- Substitution warning ---
---------------------------
local text = cfg.subst_warning.text:format(
project_name,
'<code>&#123;&#123;'..banner_name.prefixedText..'&#125;&#125;</code>'
)
return mbox('ombox', {
image = '[[File:' .. cfg.subst_warning.image .. '|40px]]',
type = cfg.subst_warning.type_,
text = text,
}) .. cfg.subst_warning.categories
end
 
Line 805 ⟶ 804:
return templatepage(args, raw_args, invoke, inactive)
else
return warning .. p._main(args, raw_args, demo or inactive, banner_name, invoke), nil -- nil to disregard subsequent returned values
local warning = ''
if not (current_title.isTalkPage or demo) then
warning = location_warning()
end
if args.substcheck=='SUBST' then
warning = warning .. substitution_warning(
banner_name,
args.PROJECT_NAME or 'WikiProject ' .. (args.PROJECT or 'PROJECT')
)
end
return warning .. p._main(args, raw_args, demo or inactive, banner_name, invoke), nil -- nil to disregard subsequent returned values
end
end