"ഘടകം:Asbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
imported>Codehydro (ചെ.) fix preview categories |
imported>Codehydro (ചെ.) streamlining code |
||
വരി 4:
}
local WRAPPER_TEMPLATE = 'Template:Asbox'
local args, msgBox, stubCats
Line 11 ⟶ 12:
function category(cat)--{{'cat', 'sort'}, 'cat2'} or 'cat'
▲ local attention = 'Stub message templates needing attention'
for _, v in ipairs(type(cat) == type'' and {cat} or cat) do
table.insert(p.cats,
'[[%sCategory:%s]]',
v▼
demo('%s|Category:%s|%s', '%s|%s%s'),
#v[1] < 2 and attention or v[1],
)▼
#v[1] < 2 and attention or v[1],
#v[1] < 2 and table.concat(v) or v[2]
))
end
return cat.done and
end
Line 37 ⟶ 41:
function catStub(page, pageDoc)--p.templatepage passes page; p.main does not
stubCats = {
missing = {},
text = '',
Line 57 ⟶ 60:
table.insert(stubCats.missing, 'category' .. v)
end
stubCats.text = stubCats.text
.. (
category'Stub message templates with documentation subpages'
or (not string.match(cat, ' stubs$') and table.insert(stubCats.v, {'S', page.text}))
Line 67 ⟶ 69:
end
if #stubCats.missing > 0 then
stubCats.
for k, meowFeedMe in ipairs(stubCats.missing) do
▲ .. '<code class="nowrap">|' .. meowFeedMe .. '</code>'
end
stubCats.text = stubCats.text .. ombox{
--Changed
'The following parameter' .. (#stubCats.missing == 1 and ' defines a stub category that does' or 's define stub categories that do') .. ' not exist: ' .. mw.text.listToText(stubCats.
{'N', page.text}
}
Line 106 ⟶ 105:
'Exclude in print'
}
--Changed
--Rather than checking multiple times, all operations involving those params have been rolled into catStub()
.. (args.icon and
category'Stub message templates using icon parameter'
Line 134 ⟶ 133:
.. catStub(page, pageDoc)
.. ((args.demo and args.demo ~= 'doc' and '') or (require('Module:Documentation').main{
content =
(page.text ~= 'Stub' and --This comparison performed in {{Asbox/stubtree}} before it invokes Module:Asbox stubtree
require('Module:Asbox stubtree').subtree{args = {pagename = page.text}}
Line 154 ⟶ 153:
.. '\n== General information ==\n'--Generic documentation
.. frame:expandTemplate{title = tStubDoc.text} .. '\n\n'
['link box'] =
string.format(
'This documentation is automatically generated by [[Template:Asbox/templatepage]].
▲ :wikitext(string.format(
▲ tStubDoc:fullUrl('action=edit', 'relative'),
▲ tStubDoc:fullUrl('action=history', 'relative')
▲ ))
)
..
" <br/>This template is [[WP:PROTECT|fully protected]] and any [[WP:CAT|categories]] should be added to the template's ["
.. pageDoc:fullURL('action=edit&preload=Template:Category_interwiki/preload', 'relative')
.. '| /doc] subpage, which is not protected.'
or ''
)
}
.. (args.demo ~= 'doc' and category{done = true} or '')))
Line 224 ⟶ 217:
p.templatepage(frame, page)
table.sort(p.cats)
else
local normalizedName = mw.title.new(args.name or '')
Line 231 ⟶ 225:
category{{args.name and 'E' or 'W', page.text}}
end
▲ output:wikitext(string.format(args.demo and '<small>%s</small>' or '%s', category{done = true}))
output:wikitext(p.templatepage(frame, page))▼
end
return output
:wikitext(
category{done = not args.demo},
▲ )
end
|