Content deleted Content added
m dumb bug |
Wikipedia:Good articles/Summary |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 6:
-- expect args.shortcut e.g. GA/H, args.type e.g. History, args.text a long list
local subpage = frame:preprocess("{{SUBPAGENAME}}") -- I never did look up if there's a better way to do this...
local header, shortcuts =
local type = args.type or "error: specify type = Good Articles type"
local image = args.image and '[[' .. args.image .. '|22px|left]]' or ''
local sectioncount = 0
if (subpage == type or args.override) then -- I haven't figured out how to deal with missing shortcut so why pretend
shortcuts = frame:expandTemplate{ title = 'shortcut', args = { args.shortcut } }
header = frame:expandTemplate{ title = 'Wikipedia:Good articles/
end
local introtext = args.text or ''
Line 35 ⟶ 33:
</div>
<div style="clear:both;">
<span id="]===] .. type .. [===[" ></span>
<div style="padding:5px 5px 8px 5px; background-color:#66CC66; text-align:left; font-size:larger;">]===] .. image .. [===[''']===] .. type .. [===['''</div>
<div style="text-align:left;">
Line 46 ⟶ 44:
local wrap = true
section = section + 1
local text = (args['section' .. tostring(section)] or args[section] or '')
local title = args['title' .. tostring(section)]
if (not title) then
if (text == '') then
else
local wrap = false▼
output = output .. text -- sections without headers go in unwrapped▼
end▼
else
▲ local wrap = false
▲ end
if wrap then ▼
local image = args['image' .. tostring(section)]
text = mw.ustring.sub(text,1,-2) -- ditching "=" mark from line above
if (image) then
image = '[[' .. image .. '|22px|left]]'
Line 62:
image = '' -- make section without an image
end
output = output .. [===[<div class="mw-collapsible" style="clear:both;
▲ output = output .. text -- sections without headers go in unwrapped
▲ end
until false
return output
end
function p.subsection(frame)
if not mw.ustring.find( (frame.args[1] or frame:getParent().args[1] or '') ,'[[',1,true) then
return '<small>(0 articles)</small>'
else
local linkList, count = mw.ustring.gsub(mw.text.trim(frame.args[1] or frame:getParent().args[1]), '\n', ' –\n')
return linkList .. '<small> (' .. (count + 1) .. ' article' .. ( (count ~= 0) and 's' or '') .. ')</small>'
end
end
|