Modul:WikiProject banner
Penampilan
![]() | Modul ini telah dinilai berada pada tahap beta, dan sedia untuk kegunaan secara luas. Ia masih baru dan patut digunakan dengan berhati-hati untuk memastikan bahawa hasil penggunaannya adalah seperti yang dijangkakan. |
![]() | Halaman ini punya modul Lua digunakan pada banyak laman dan perubahan besar-besaran mungkin akan ternampak. Sila uji perubahan di modul punya subhalaman kotak pasir atau laman uji kaji, atau pada module sandbox anda. Pertimbang untuk membincang perubahan pada laman perbincangan sebelum melaksanakannya. |
![]() | This module uses TemplateStyles: |
Modul:WikiProject banner/related This module implements Template:WPBannerMeta. Please refer to that template's documentation.
require('strict')
local p = {}
local sandbox-- = '/kotak pasir'
local cfg = mw.loadData('Modul:WikiProject banner/config' .. (sandbox or ''))
local args_module = require('Modul:Arguments')
local mbox = require('Modul:Message box').main
local yesno = require('Modul:Yesno')
local frame = mw.getCurrentFrame()
local lang = mw.getLanguage(cfg.language)
local current_title = mw.title.getCurrentTitle()
local parameter_format = function(parameter, value)
return frame:expandTemplate{title='para', args={parameter, value or ''}}
end
local wikilink = function(link, display)
if link then
return display and '[['..link..'|'..display..']]' or '[['..link..']]'
else
return display or ''
end
end
local image = function(args)
if args.image then
return string.format(
'[[Fail:%s%s%s%s%s]]',
args.image,
(args.size and args.size ~= '') and '|' .. args.size or '',
(args.location and args.location ~= '') and '|' .. args.location or '',
(args.alt and args.alt ~= '') and '|alt=' .. args.alt or '',
(args.link and args.link ~= '') and '|link=' .. args.link or ''
)
end
end
local if_exists = function(target, fallback) -- function to add wikilink if target exists
local title = mw.title.new(target)
if title and title.exists then
return wikilink(target)
else
return fallback or target
end
end
local isarticle = function(class)
local article = true
for _,v in ipairs(cfg.quality.non_article_classes) do
if class==v then -- class matches one of the non-article classes
article = false
break
end
end
return article
end
p.readarticleclass = function(options, page) -- used by _main and also Module:Banner shell
page = page or current_title.prefixedText
local get_parameter_value = require('Modul:Templat parameter value/kotak pasir').getValue
local success, result = get_parameter_value(page, cfg.WPBS_redirects, 'class', options)
return success and result
-- returns FALSE if banner shell template does not exist on page
-- returns BLANK if class parameter is not defined or is defined blank
-- otherwise returns class parameter
end
local importance_mask = function(raw_importance, class, scale, banner_name)
local importance
if scale=='inline' then -- pass importance without change
importance = raw_importance
elseif scale=='subpage' then
local custom_mask = banner_name:subPageTitle('importance')
if custom_mask.exists and #custom_mask:getContent()>1 then -- pass to custom importance mask
importance = mw.text.trim(frame:expandTemplate{
title=custom_mask.prefixedText,
args={importance=raw_importance or '¬', class=class}
})
end
else
importance = frame:expandTemplate{title='Templat:Importance mask', args={raw_importance or '¬', class=class}}
end
if importance=='¬' then
importance = nil
end
return importance
end
local page_assessment = function(project, class, importance) -- add PageAssessments parser function
local assessment = table.concat({project, class or '', importance or ''},'|')
frame:preprocess('{{#assessment:' .. assessment .. '}}')
end
local bubble = function(text, short_text, default_colour)
local colour = cfg.pale_colours[short_text] or default_colour
local out = mw.html.create('span')
:addClass('wpb-header-bubbles')
:css('background', colour)
:css('border', '0.075em solid ' .. colour)
:wikitext(text)
return tostring(out)
end
function p._main(args, raw_args, demo, banner_name, invoke)
---------------------------
-- Initialise parameters --
---------------------------
local project = args.PROJECT
local project_name = args.PROJECT_NAME or 'WikiProjek ' .. project
local project_link = mw.title.new(args.PROJECT_LINK or 'Wikipedia:' .. project_name)
local pagetype = demo and 'article' or require('Modul:Pagetype')._main({})
local rows, collapsed, nested_ratings, task_forces, notes, categories = {}, {}, {}, {}, {}, {}
local add_category = function(category, key)
if category and not demo then
local cat_link = wikilink('Kategori:' .. category, key)
table.insert(categories, cat_link)
end
end
local parse_text = function(text)
return text and string.gsub(text, '_PAGETYPE_', pagetype)
end
for arg_name, arg_value in pairs(args) do
local tf_match = mw.ustring.match(arg_name,'^tf (%d+)$')
if tf_match and yesno(arg_value, true) then
table.insert(task_forces, tf_match)
else
local note_match = mw.ustring.match(arg_name,'^note (%d+)$')
if note_match and yesno(arg_value, true) then
table.insert(notes, note_match)
end
end
end
table.sort(task_forces, function (x, y) return tonumber(x) < tonumber(y) end)
table.sort(notes, function (x, y) return tonumber(x) < tonumber(y) end)
local warning = ''
---------------------------
-- Unknown parameters -----
---------------------------
local parameter_check = ''
if invoke and banner_name.exists then
local parent_args = args_module.getArgs(frame, {parentOnly = true})
local template_code = banner_name:getContent()
local parameters = {}
for parameter in string.gmatch(template_code, '{{{([^|]+)') do
table.insert(parameters, parameter)
end
parameters.preview = string.format(
cfg.unknown_parameters.preview,
wikilink(banner_name.fullText)
)
local unknown_category = string.format(cfg.unknown_parameters.tracking, project_name)
parameters.unknown = mw.title.new(unknown_category).exists and '[[' .. unknown_category .. '|_VALUE_]]' or ''
if demo then parameters.unknown = '' end
parameter_check = require('Modul:Check for unknown parameters')._check(parameters, parent_args)
end
---------------------------
-- Location warning -------
---------------------------
local show_namespace_warning = not (current_title.isTalkPage or demo)
if show_namespace_warning then
local text = string.format(
cfg.namespace_warning.text .. '<br><span style="font-size:95%%">' .. cfg.namespace_warning.small .. '</span>',
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 .. string.format(
cfg.namespace_warning.on_template_page,
parameter_format('BANNER_NAME'),
current_title.prefixedText
)
end
warning = mbox('ombox', {
image = '[[Fail:' .. cfg.namespace_warning.image .. '|40px]]',
type = cfg.namespace_warning.type_,
text = text
})
if not current_title.subjectPageTitle:inNamespace(2) then
add_category(cfg.namespace_warning.categories, sortkey)
end
end
---------------------------
-- Substitution warning ---
---------------------------
if args.substcheck=='SUBST' then
local text = string.format(
cfg.subst_warning.text,
project_name,
'<code>{{'..banner_name.prefixedText..'}}</code>'
)
warning = warning .. mbox('ombox', {
image = '[[Fail:' .. cfg.subst_warning.image .. '|40px]]',
type = cfg.subst_warning.type_,
text = text,
}) .. cfg.subst_warning.categories
end
---------------------------
-- Primary image/text -----
---------------------------
local assessment_cat = args.ASSESSMENT_CAT or project .. ' articles'
local primary_image = function(image_name, image_size)
local cell = mw.html.create('td')
if image_name and image_name ~= '' then
cell:addClass('mbox-image wpb-image')
:wikitext(image({
image = image_name,
size = image_size,
alt = 'WikiProject icon'
}))
else
cell:addClass('mbox-empty-cell')
end
cell:done()
return cell
end
local topic = args.MAIN_ARTICLE and if_exists(args.MAIN_ARTICLE) or if_exists(project, project .. ' articles')
local portal = args.PORTAL
local portal_box = portal and frame:expandTemplate{title='Portal', args={portal}} or ''
local main_text = portal_box .. (parse_text(args.MAIN_TEXT) or string.format(
cfg.maintext,
pagetype,
wikilink(project_link.prefixedText, project_name),
topic,
wikilink(project_link.talkPageTitle.prefixedText, 'the discussion')
))
local image_left_size = args.IMAGE_LEFT_SIZE or args.IMAGE_LEFT_LARGE or '80px'
local primary_row = mw.html.create('tr')
primary_row
:node(primary_image(args.IMAGE_LEFT, image_left_size))
:tag('td')
:addClass('mbox-text')
:wikitext(main_text)
:tag('span')
:addClass('metadata wpb-metadata')
:tag('span'):addClass('wpb-project'):wikitext(project):done()
:tag('span'):addClass('wpb-project_link'):wikitext(project_link.prefixedText):done()
:tag('span'):addClass('wpb-banner_name'):wikitext(banner_name.prefixedText):done()
:tag('span'):addClass('wpb-assessment_cat'):wikitext(assessment_cat):done()
:done()
:done()
:node(primary_image(
args.IMAGE_RIGHT,
args.IMAGE_RIGHT_SIZE or args.IMAGE_RIGHT_LARGE or '80px'
))
:done()
table.insert(rows, primary_row)
---------------------------
-- Quality assessment -----
---------------------------
local assessment_link = args.ASSESSMENT_LINK
if not assessment_link then
local fallback = mw.title.new(project_link.prefixedText .. '/Penilaian')
assessment_link = fallback.exists and fallback.prefixedText
elseif assessment_link=='no' then
assessment_link = nil
end
local class_mask = require('Modul:Class mask' .. (sandbox or ''))._main
local class
if args.QUALITY_SCALE=='inline' then
class = raw_args.class
elseif args.QUALITY_SCALE=='subpage' then
local custom_mask = banner_name:subPageTitle('class')
if custom_mask.exists then
class = mw.text.trim(frame:expandTemplate{
title = custom_mask.prefixedText,
args = raw_args
})
end
else
local classmask_args = {
FQS = args.QUALITY_SCALE=='extended' and 'yes' or 'no',
[1] = raw_args.class,
b1 = raw_args.b1, b2 = raw_args.b2, b3 = raw_args.b3, b4 = raw_args.b4, b5 = raw_args.b5, b6 = raw_args.b6
}
class = class_mask(classmask_args, current_title)
end
local show_quality = true
if class=='¬' then
class = nil
end
if class then -- banner gives quality ratings
if args.QUALITY_CRITERIA~='custom' then -- project uses standard scale and will inherit article class if needed
local article_class = p.readarticleclass({ignore_subtemplates=true}, current_title.prefixedText)
article_class = article_class and class_mask({article_class}, current_title)
if article_class then -- banner shell exists
if article_class=='' then -- no article class defined
if class=='' then -- local class also does not exist, check whether any other class parameters are defined inside the shell
local classparam = p.readarticleclass({ignore_blank=true, only_subtemplates=true}, current_title.prefixedText)
if classparam=='' then -- no class parameters defined, display as globally unassessed
show_quality = false -- hide quality class in project banner
end
end
elseif class=='' or class==article_class then -- local class matches article class or is blank
show_quality = false -- hide quality class in project banner
class = article_class
elseif (article_class=='NA') and not isarticle(class) then -- article class and local class are both non-article classes
show_quality = false
else -- article class exists and differs from local class
add_category('Articles with conflicting quality ratings')
end
end
if not isarticle(class) then
local cat = mw.title.new('Kategori: Rencana kelas ' .. class .. '' .. ' ' .. assessment_cat)
if not (cat.exists and #cat:getContent()>0) then --check if category exists and is not blank
class = 'NA' -- automatically use NA for non-article pages if category does not exist
end
end
end
if show_quality then -- quality rating shown in banner
local class_module = require('Modul:Class')._class
local rating
if pagetype=='article' then
rating = class=='' and cfg.quality.not_yet or string.format(cfg.quality.rated, class)
else
rating = cfg.quality.not_required
end
local scale = args.QUALITY_CRITERIA=='custom' and assessment_link and string.format(
cfg.quality.project_scale,
wikilink(assessment_link..'#'..lang:ucfirst(cfg.quality.name), cfg.quality.name)
) or cfg.quality.default_scale
local quality_rating = string.format(
cfg.quality.rating,
pagetype,
rating,
scale
)
local class_row = mw.html.create('tr')
:node(class_module{class, category = assessment_cat})
:tag('td'):addClass('mbox-text'):attr('colspan', '2'):wikitext(quality_rating)
:allDone()
table.insert(rows, class_row)
if class~='' then
local new_bubble = bubble(
class .. '‑class',
class,
frame:expandTemplate{ title = 'Class/colour', args = {class} }
)
table.insert(nested_ratings, 1, new_bubble)
end
end
add_category((class=='' and 'belum dinilai' or class..'') .. ' ' .. assessment_cat)
end
if args.HOOK_ASSESS then
table.insert(rows, args.HOOK_ASSESS)
end
if (raw_args.b1 or raw_args.b2 or raw_args.b3 or raw_args.b4 or raw_args.b5 or raw_args.b6) then
local b_checklist = require('Modul:WikiProject banner/auxiliary' .. (sandbox or '')).b_checklist(args, raw_args, class, demo, assessment_link)
table.insert(rows, b_checklist)
end
---------------------------
-- Importance assessment --
---------------------------
local importance = importance_mask(raw_args.importance or raw_args.priority, class, args.IMPORTANCE_SCALE, banner_name)
local importance_name = args.IMPN or (raw_args.priority and 'priority' or cfg.importance.default_name)
if importance and importance~='NA' then -- display importance rating
local rating = importance=='Unknown' and cfg.importance.not_yet or string.format(cfg.importance.rated, importance, importance_name)
local scale_name = string.format(cfg.importance.scale, importance_name)
local scale = assessment_link and string.format(
cfg.importance.project_scale,
wikilink(assessment_link..'#'..lang:ucfirst(scale_name), scale_name)
) or cfg.importance.default_scale
local importance_rating = string.format(
cfg.importance.rating,
pagetype,
rating,
scale
)
local importance_row = mw.html.create('tr')
importance_row
:node(frame:expandTemplate{title='Importance', args={importance, category=assessment_cat, impn=importance_name}})
:tag('td'):addClass('mbox-text'):attr('colspan', '2'):wikitext(importance_rating)
:allDone()
table.insert(rows, importance_row)
if importance~='Unknown' then -- importance is not NA or Unknown
local new_bubble = bubble(
importance .. '‑' .. importance_name,
importance,
frame:expandTemplate{ title = 'Importance/colour', args = {importance} }
)
table.insert(nested_ratings, new_bubble)
end
end
if importance then --add importance category
add_category((importance=='' and 'tidak diketahui' or importance..'-' .. importance_name) .. ' ' .. assessment_cat)
end
if class or importance then
page_assessment(project, class, importance)
end
if args.HOOK_IMPORTANCE then
table.insert(rows, args.HOOK_IMPORTANCE)
end
if args.QII_FORMAT then
add_category(require('Modul:WikiProject banner/auxiliary' .. (sandbox or '')).quality_importance_insection(args, class, importance, importance_name))
end
---------------------------
-- Task forces ------------
---------------------------
local nested_tf = {}
local tf_default_size = args.TF_SIZE or args.TF_1_SIZE or 'x25px'
for _, k in ipairs(task_forces) do
local tf_prefix = 'TF_' .. k .. '_'
local tf_assessment_cat = args[tf_prefix..'ASSESSMENT_CAT'] or (args[tf_prefix..'NAME'] or '')..' articles'
local tf_importance
if raw_args['tf '..k..' importance'] then
tf_importance = importance_mask(raw_args['tf '..k..' importance'], class, args.IMPORTANCE_SCALE, banner_name)
if tf_importance=='Unknown' and yesno(args.INHERIT_IMPORTANCE) then
tf_importance = importance
end
end
if args[tf_prefix .. 'TEXT']~='none' then
local portal = args[tf_prefix..'PORTAL'] and frame:expandTemplate{title='Portal', args={args[tf_prefix .. 'PORTAL'], height='15', margin='0'}} or ''
local text = ''
if args[tf_prefix..'TEXT'] then
text = portal .. parse_text(args[tf_prefix..'TEXT'])
else
local tf_importance_text = tf_importance and tf_importance~='NA' and tf_importance~='Unknown' and ' '..string.format(
cfg.task_force.importance,
wikilink(':Kategori:' .. tf_importance .. '-' .. importance_name .. ' ' .. tf_assessment_cat, tf_importance .. '-' .. importance_name)
) or ''
text = portal .. string.format(
cfg.task_force.text,
pagetype,
wikilink(args[tf_prefix .. 'LINK'], args[tf_prefix .. 'NAME']),
tf_importance_text
)
end
local tf_size = args[tf_prefix..'SIZE'] or tf_default_size
local tf_image = ''
if args[tf_prefix..'IMAGE'] then
tf_image = image{
image = args[tf_prefix..'IMAGE'],
size = tf_size,
location = 'center',
alt = 'Taskforce icon',
}
end
local taskforce = mw.html.create('tr')
:tag('td'):wikitext(tf_image):done()
:tag('td'):addClass('mbox-text'):attr('colspan','2'):wikitext(text):allDone()
table.insert(rows, taskforce)
end
if args[tf_prefix..'HOOK'] then
table.insert(rows, args[tf_prefix..'HOOK'])
end
if yesno(args[tf_prefix..'QUALITY']) and class then
add_category((class=='' and 'belum dinilai' or class..'') .. ' ' .. tf_assessment_cat)
end
if tf_importance then
add_category(tf_importance .. '-' .. importance_name .. ' ' .. tf_assessment_cat)
end
if args[tf_prefix..'NAME'] then
page_assessment(project..'/'..args[tf_prefix..'NAME'], class, tf_importance)
end
if args[tf_prefix..'MAIN_CAT'] then
add_category(args[tf_prefix..'MAIN_CAT'])
end
if args[tf_prefix..'NESTED'] then
table.insert(nested_tf, wikilink(args[tf_prefix..'LINK'], args[tf_prefix..'NESTED']))
end
end
if args.HOOK_TF then
table.insert(rows, args.HOOK_TF)
end
---------------------------
-- Notes ------------------
---------------------------
local note_default_size = args.NOTE_SIZE or args.NOTE_1_SIZE or 'x25px'
local render_note = function(note_args)--text, image_name, size, category, sort_prefix
if note_args.category and note_args.category~='none' then
local sort = note_args.sort_prefix and note_args.sort_prefix .. current_title.text
add_category(note_args.category, sort)
end
if note_args.text then
local note_image = note_args.image_name and image{
image = note_args.image_name,
size = note_args.size or note_default_size,
location = 'center',
alt = 'Note icon',
link = ''
} or ''
local new_note = mw.html.create('tr')
:tag('td'):wikitext(note_image):done()
:tag('td'):addClass('mbox-text'):attr('colspan', '2'):wikitext(note_args.text):allDone()
table.insert(collapsed, new_note)
end
end
local auto = false
local auto_arg = args.auto and string.lower(args.auto)
if (auto_arg=='yes' or auto_arg=='stub') and class=='Stub' then
auto = 'stub'
elseif (auto_arg=='inherit' or auto_arg=='length') and class and class~='' then
auto = auto_arg
end
if auto then
local auto_cat = args.AUTO_ASSESS_CAT or string.format(cfg.auto.default_cat, project)
local auto_text = string.format(
cfg.auto.assessed,
pagetype,
cfg.auto[auto], -- method of automatic assessment
parameter_format('auto')
)
local sort_prefix
if auto=='stub' then
sort_prefix = 'S'
elseif auto=='length' then
sort_prefix = 'L'
elseif auto=='inherit' then
local sort_codes = cfg.auto.sort_codes
sort_prefix = sort_codes[class] or cfg.auto.default_sort_code
end
render_note{
text = auto_text,
image_name = cfg.auto.icon,
category = auto_cat,
sort_prefix = sort_prefix
}
end
if yesno(args.attention, true) then
local attention_cat = args.ATTENTION_CAT or string.format(cfg.attention.default_cat, project)
render_note{
text = string.format(cfg.attention.text, pagetype),
image_name = cfg.attention.icon,
category = attention_cat
}
end
if yesno(args.infobox, true) then
local infobox_cat = args.INFOBOX_CAT or string.format(cfg.infobox.default_cat, project)
render_note{
text = string.format(cfg.infobox.text, pagetype),
image_name = cfg.infobox.icon,
category = infobox_cat
}
end
for _, k in ipairs(notes) do
local note_prefix = 'NOTE_' .. k .. '_'
render_note{
text = parse_text(args[note_prefix..'TEXT']),
image_name = args[note_prefix..'IMAGE'],
size = args[note_prefix..'SIZE'],
category = args[note_prefix..'CAT']
}
end
local note_count = #collapsed
if args.HOOK_NOTE then
table.insert(collapsed, args.HOOK_NOTE)
local hook_collapsed = 0
if args.HOOK_COLLAPSED then
local success, result = pcall(mw.ext.ParserFunctions.expr, args.HOOK_COLLAPSED)
hook_collapsed = success and tonumber(result) or 0
if args.HOOK_COLLAPSED=='auto' then
hook_collapsed = 1
end
end
note_count = note_count + hook_collapsed
end
---------------------------
-- Collapsed secton -------
---------------------------
if note_count > (tonumber(args.COLLAPSED) or 2) then -- collapse note section
local collapsed_section = mw.html.create('tr')
local collapsed_rows = collapsed_section:tag('td')
:attr('colspan','3')
:addClass('wpb-collapsed-notes')
:tag('table')
:addClass('mw-collapsible mw-collapsed')
:tag('tr')
:tag('th')
:attr('colspan','3')
:addClass('wpb-collapsed-head')
:wikitext(args.COLLAPSED_HEAD or 'Maklumat lanjut:')
:done()
:done()
:tag('tr')
:tag('td')
:addClass('mbox-image wpb-gutter')
:css('min-width',image_left_size)
:tag('span'):addClass('wpb-iefix'):wikitext('/ '):done() --TO FIX IE
:done()
:tag('td'):done()
:tag('td'):done()
:done()
for _, row in ipairs(collapsed) do
collapsed_rows:node(row)
end
collapsed_rows:allDone()
table.insert(rows, collapsed_section)
else
for _, row in ipairs(collapsed) do
table.insert(rows, row)
end
end
---------------------------
-- Bottom text ------------
---------------------------
if args.HOOK_BOTTOM then
table.insert(rows, args.HOOK_BOTTOM)
end
if args.TODO_LINK or args.TODO_TEXT then
local todolist = require('Modul:WikiProject banner/auxiliary' .. (sandbox or '')).todo_list(args, frame)
table.insert(rows, todolist)
end
if args.BOTTOM_TEXT then
local bottom_text = mw.html.create('tr')
bottom_text
:tag('td')
:attr('colspan','3')
:wikitext(parse_text(args.BOTTOM_TEXT))
:allDone()
table.insert(rows, bottom_text)
end
if args.MAIN_CAT then
add_category(args.MAIN_CAT)
end
---------------------------
-- Nested display ---------
---------------------------
if args.HOOK_NESTED then
local hook_nested = string.gsub(args.HOOK_NESTED, '^ / ', '')-- remove initial slash, will be added later
table.insert(nested_tf, hook_nested)
end
local nested_tf_str = ''
if #nested_tf>0 then
nested_tf_str = tostring(mw.html.create('span')
:css('font-weight', 'normal')
:wikitext(': ' .. table.concat(nested_tf, ' / '))
)
end
local nested_ratings_str = #nested_ratings>0 and table.concat(nested_ratings, ' ') or ''
if args.HOOK_NESTED_ASSESS then
nested_ratings_str = nested_ratings_str .. tostring(mw.html.create('span')
:addClass('wpb-header-bubbles')
:wikitext(args.HOOK_NESTED_ASSESS)
)
end
local header_row = mw.html.create('tr')
:addClass('wpb-header')
:tag('td')
:addClass('wpb-header-icon')
:attr('width', '50px')
:css('text-align', 'center')
:wikitext(image({
image = args.IMAGE_LEFT,
size = '35x25px',
alt = 'WikiProject icon'
}))
:done()
:tag('td')
:addClass('wpb-header-combined')
:wikitext(wikilink(project_link.prefixedText, project) .. nested_tf_str .. ' ' .. nested_ratings_str)
:allDone()
---------------------------
-- Make banner ------------
---------------------------
local status_class = (cfg.status[args.PROJECT_STATUS] or cfg.status.default) .. '-WikiProject'
local banner = mw.html.create('table')
local banner_rows = banner
:addClass('tmbox tmbox-notice mw-collapsible innercollapse wpb ' .. status_class)
:css('table-layout', 'fixed')
:node(header_row)
:tag('tr')
:tag('td')
:addClass('mbox-text wpb-main')
:attr('colspan','2')
:tag('table')
for _, row in ipairs(rows) do
banner_rows:node(row)
end
if args.listas then
frame:preprocess('{{DEFAULTSORT:' .. args.listas .. '}}')
end
local tstyle = frame:extensionTag ('templatestyles', '', {src='Modul:Message box/tmbox.css'}) ..
frame:extensionTag ('templatestyles', '', {src = 'Modul:WikiProject banner' .. (sandbox or '') .. '/styles.css'})
return parameter_check .. warning .. tstyle .. tostring(banner) .. table.concat(categories)
end
function p.main(frame)
local args = args_module.getArgs(frame, {wrappers = {'Templat:WPBannerMeta/kotak pasir'}})
local raw_args = args_module.getArgs(frame, {removeBlanks = false, wrappers = {'Templat:WPBannerMeta/kotak pasir'}})
local banner_name = mw.title.new(args.BANNER_NAME or 'Templat:WikiProjek ' .. (args.PROJECT or 'PROJECT'))
local demo = not yesno(args.category or true, true)
local on_template_page = not demo and (
current_title.rootPageTitle==banner_name.rootPageTitle
or (current_title.rootPageTitle and current_title.rootPageTitle.prefixedText=='Templat:WPBannerMeta/kotak pasir')
)
local invoke = frame.args.PROJECT and frame.args.PROJECT~='' and true or false--checks whether banner template is using {{#invoke:WikiProject banner}}
if on_template_page then
local templatepage = require('Modul:WikiProject banner/templatepage' .. (sandbox or '')).templatepage
return templatepage(args, raw_args, invoke)
else
return p._main(args, raw_args, demo, banner_name, invoke)
end
end
return p