"ഘടകം:Asbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

Content deleted Content added
imported>Codehydro
(ചെ.) fix preview categories
imported>Codehydro
(ചെ.) streamlining code
വരി 4:
}
local WRAPPER_TEMPLATE = 'Template:Asbox'
local attention = 'Stub message templates needing attention'
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, '[[' string.. demo(':', '') .. 'Category:' .. format(#v > 2 and
'[[%sCategory:%s]]',
v
or demo(not v[2] and':', v[1]''),
:wikitext(#v > 2 and v or string.format(
or ((#v[1] > 1 and v[1] or attention) .. '|' .. demo('Category:' .. (#v[1] > 1 and v[1] or attention) .. mw.text.nowiki('|'), '') .. (#v[1] == 1 and v[1] or '') .. v[2])
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]
v)
))
end
return cat.done and (demo('Demo categories: ', '') .. table.concat(p.cats, demo(' | ', ''))) or ''
end
 
Line 37 ⟶ 41:
function catStub(page, pageDoc)--p.templatepage passes page; p.main does not
stubCats = {
hasDoc = nil,
missing = {},
text = '',
Line 57 ⟶ 60:
table.insert(stubCats.missing, 'category' .. v)
end
hasDoc = v == '' and pageDoc.exists or false
stubCats.text = stubCats.text
.. (hasDocv == '' and pageDoc.exists and
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.mtextmissed = ''{}
for k, meowFeedMe in ipairs(stubCats.missing) do
table.insert(stubCats.missed, '<code class="nowrap">|' .. meowFeedMe .. '</code>')
stubCats.mtext = stubCats.mtext
.. (k == #stubCats.missing and #stubCats.missing > 1 and 'and ' or '')
.. '<code class="nowrap">|' .. meowFeedMe .. '</code>'
.. (k == #stubCats.missing and '.' or (#stubCats.missing < 3 and ' ' or ', '))
end
stubCats.text = stubCats.text .. ombox{
--Changed from, original: One or more of the stub categories defined in this template do not seem to exist! Please double-check the parameters {{para|category}}, {{para|category1}} and {{para|category2}}.
'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.mtextmissed),
{'N', page.text}
}
Line 106 ⟶ 105:
'Exclude in print'
}
--Changed from original:. Original Asbox/templatepage checksdoes categoriesits forfirst validof names3 andchecks whetheron theyparams exist|category#= here.
--Rather than checking multiple times, all operations involving those params have been rolled into catStub()
--This has been moved to the end of this function
.. (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]]. <br/>The general information is transcluded from [[Template:Stub documentation]]. <span style="font-size:smaller;font-style:normal;line-height:130%%">([%s edit] | [%s history])</span>',
.. tostring(mw.html.create'span'
tStubDoc:fullUrl('action=edit', 'relative'),
:cssText('font-size:smaller;font-style:normal;line-height:130%')
tStubDoc:fullUrl('action=history', 'relative')
:wikitext(string.format(
'([%s edit] | [%s history])',
tStubDoc:fullUrl('action=edit', 'relative'),
tStubDoc:fullUrl('action=history', 'relative')
))
)
.. ((page.protectionLevels.edit[1] == 'sysop' and
" <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)
output:wikitext(string.format(args.demo and '<small>Demo categories: %s</small>' or '%s', category{done = true}))
else
local normalizedName = mw.title.new(args.name or '')
Line 231 ⟶ 225:
category{{args.name and 'E' or 'W', page.text}}
end
end
output:wikitext(string.format(args.demo and '<small>%s</small>' or '%s', category{done = true}))
if args.demo == 'doc' then
output:wikitext(p.templatepage(frame, page))
end
return output
:wikitext(
category{done = not args.demo},
output:wikitext( args.demo == 'doc' and p.templatepage(frame, page)) or nil
)
end
 
"https://ml.wikipedia.org/wiki/ഘടകം:Asbox" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്