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

Content deleted Content added
Undid revision 646105924 by Codehydro (talk) - edit seems to be preventing articles from showing up in stub categories; will revert if this doesn't seem to be the problem
imported>Codehydro
repatch with patched patch; amazing how a single misplaced line can break everything :\
വരി 1:
--[[
This module was created by User:CodeHydro (Alexander Zhikun He).
User:Jackmcbarn and User:Mr._Stradivarius provided a great deal of assistance in writting p.main()
 
p.main() draw heavily from the following version of Template:Asbox of the English Wikipedia, authored primarily by User:Rich_Farmbrough
https://en.wikipedia.org/w/index.php?title=Template:Asbox&oldid=619510287
 
p.templatepage() is derived from the following revision of Template:Asbox/templatepage, authored primarily by User:MSGJ
https://en.wikipedia.org/w/index.php?title=Template:Asbox/templatepage&oldid=632914791
 
Both templates had significant contributions from numerous others listed in the revision history tab of their respective pages.
--]]
local WRAPPER_TEMPLATE = 'Template:Asbox'
local args, stubCats
local p = {}
local bufferBuffer = require('Module:Buffer')
--initializes variables required by both p.main and p.templatepage
function p:init(frame, page)
Line 82 ⟶ 94:
for k, v in ipairs(stubCats) do
--Get category names and, if called by p.templatepage, the optional sort key
local cattsort, tsortcat = args['categorytempsort' .. v], mw.ustring.gsub(args['tempsortcategory' .. v], '[^%w%p%s]', '')--remove all hidden unicode chars
--Do not place in main category if |tempsort = 'no'; For example, if stub template merely
--adds |qualifier= to a meta stub and |category#= to a sub-category of meta's main category
Line 94 ⟶ 106:
--Check category existance only if on the template page (i.e. stub documentation)
if page then
cat = mw.ustring.gsub(cat, '[^%w%p%s]', '')--remove hidden unicode chars before checks
if not mw.title.new('Category:' .. cat).exists then
code = code or mw.html.create'code':wikitext'|category'
Line 146 ⟶ 157:
--Reorganization note: Original Asbox alternates between outputting categories and checking on params |category#=.
--Rather than checking multiple times and switching tasks, all stub category param operations have been rolled into catStub()
return bufferBuffer(
ombox{--Show ombox warnings for missing args.
ifNot = args.category,
Line 173 ⟶ 184:
:_((not p.demo or p.demo == 'doc') and--Add standard stub template documentation
require('Module:Documentation').main{
content = bufferBuffer(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 191 ⟶ 202:
:_(frame:expandTemplate{title = tStubDoc.text})
:_'\n\n'(),
['link box'] = bufferBuffer'This documentation is automatically generated by [[Module:Asbox]].'
:_in'The general information is transcluded from [[Template:Stub documentation]]. '
:_(mw.html.create'span'
Line 229 ⟶ 240:
:tag'i'
:wikitext(
bufferBuffer'This':_(args.subject):_(args.article or 'article'):_(args.qualifier)' ',--space
' is a [[Wikipedia:stub|stub]]. You can help Wikipedia by [',
page:fullUrl('action=edit', 'relative'),
Line 255 ⟶ 266:
Otherwise, any non-nil p.demo will emulate article space categories (plus any error cats unless set to 'art')
]]
if p.demo ~= 'doc' then
catStub()
end
if page.namespace == 0 then -- Main namespace
category'All stub articles'
catStub()
elseif p.demo then
if p.demo ~= 'doc' then catStub() end
--Unless p.demo is set to 'art', it will also include error categories normally only shown on
--the template but not in the article. The elseif after namespace == 0 means demo cats will never show in article space.
p.demodoc = p.demo ~= 'art' and p.templatepage(frame, page) or nil
output:wikitext(
string.format('<small>Demo categories: %s</small>', category{done = true})),
p.demo == 'doc' and p.demodoc or nil
)
else
--Checks for valid name; emulates original template's check using {{FULLPAGENAME:{{{name|}}}}}
Line 274 ⟶ 287:
end
end
return output:wikitext(category{done = not p.demo})
category{done = not p.demo},
p.demo == 'doc' and p.demodoc or nil
)
end
 
"https://ml.wikipedia.org/wiki/ഘടകം:Asbox" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്