Jump to content

Module:Good Articles

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wnt (talk | contribs) at 22:19, 15 April 2014 (rm overwrought). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

p.main = function (frame)
	local args = require("Module:Arguments").getArgs(frame)
	-- 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 = ""
	local shortcuts = ""
	local type = args.type or "error: specify type = Good Articles type"
	local title = args.title or args.type
	if args and args.shortcut and subpage == type then
		shortcuts = frame:expandTemplate{ title = 'shortcut', args = { args.shortcut } }
		header = frame:expandTemplate{ title = 'Wikipedia:Good articles/header', args = { shortcuts = shortcuts } }
    end
    local text = args.text or args[1] or ""
    local image = args.image or "error: specify image"
    local footer = [===[
</div>
</div>
<!-- end of list -->]===]

    local output = header .. [===[<!-- only include header on this page -->
__NOTOC__
<div style="clear:both;">
<!-- DO NOT REMOVE THIS DIV, USED TO FORCE IE TO DISPLAY BACKGROUND FOR ARTS DIV -->
</div>
<div style="clear:both;">
<span id="]===] .. type .. [===[" />
<div style="padding:5px 5px 8px 5px; background-color:#66CC66; text-align:left; font-size:larger;">[[]===] .. image .. [===[|22px|left]]''']===] .. type .. [===['''</div>
<div style="text-align:left;">
</div>
</div>
<div style="clear:both;" class="NavFrame">
<span id="World history"/>
<div class="NavHead" style="padding:2px 2px 2px 30px; background-color:#FFFAF0; text-align:left; font-size:larger;">[[]===] .. image .. [===[|22px|left]]]===] .. title .. [===[</div>
<div class="NavContent" style="text-align:left;">

==&shy;&nbsp;==
]===] .. text .. footer
    return output
end

return p