Module:Good Articles: Difference between revisions

Content deleted Content added
Changing to use subsections. Problem: for some reason the new \n's want to come out as "\n", even though I had some already which appear as newline.
what is up with those newlines, hmmm...
Line 16:
header = frame:expandTemplate{ title = 'Wikipedia:Good articles/header', args = { shortcuts = shortcuts } }
end
local textintrotext = args.text or ''
replace = function(t)
local xxxx, links = mw.ustring.gsub(t, "(%[%[[^%[%]]-%]%])", "%1", nil) -- count how many links
Line 24:
return t .. "\n"
end
local sectionfooter = [===[\n
</div>\n
</div>\n
<!-- end of list -->]===]
-- comments in the text below are historical from the page's own markup
local output = header .. [===[<!-- only include header on this page -->
Line 37 ⟶ 40:
</div>
</div>
]===] .. textintrotext
local section = 0
local finaltext = ''
repeat
local wrap = true
section = section + 1
local text = (args['section' .. tostring(section)] or '')
if (not local title = args['title' .. tostring(section)]) then
if (not title) then
if (text == '') then break end -- no more sections
else
local wrap = false
finaltext = finaltext .. text -- sections without headers get spit out at end, unwrapped
output = output .. text
end
if wrap then
local image = args['image' .. tostring(section)]
local text = mw.ustring.gsub(text, "(==.-)\n%f[=]", replace)
 
if (image) then
local text = mw.ustring.gsub(text, "(==.-)\n%f[=]", replace)
if image = '[[' .. (image) then.. '|22px|left]]'
else
image = '[[' .. image .. '|22px|left]]'
image = '' -- make section without an image
end
output = output .. [===[<div style="clear:both;" class="NavFrame">
<span id="World history"/>
output = output .. [===[<div style="clear:both;" class="NavFrame">\n<span id="World history"/>\n <div class="NavHead" style="padding:2px 2px 2px 30px; background-color:#FFFAF0; text-align:left; font-size:larger;">]===] .. image .. title .. [===[</div>\n<div class="NavContent" style="text-align:left;">\n\n==&shy;&nbsp;==\n]===] .. text .. sectionfooter
<div class="NavContent" style="text-align:left;">
==&shy;&nbsp;==
]===] .. text .. sectionfooter
else
imageoutput = ''output .. text -- make sectionsections without anheaders go in imageunwrapped
end
output = output .. [===[<div style="clear:both;" class="NavFrame">\n<span id="World history"/>\n<div class="NavHead" style="padding:2px 2px 2px 30px; background-color:#FFFAF0; text-align:left; font-size:larger;">]===] .. image .. title .. [===[</div>\n<div class="NavContent" style="text-align:left;">\n\n==&shy;&nbsp;==\n]===] .. text .. sectionfooter
until false
return output .. finaltext
end