Module:Article stub box: Difference between revisions

Content deleted Content added
Attempt to fix tiny image at e.g. Template:SaxonyAnhalt-struct-stub
add templatestyles, add div role=note wrapper, move navbar position to prevent text overlap
Line 12:
--]]
local WRAPPER_TEMPLATE, args = 'Template:Asbox'
local templatestyles = 'Asbox/styles.css'
local p, Buffer, stubCats = {
--Prevents dupli-cats... get it? Maybe not?
Line 214 ⟶ 215:
function p.main(frame, page)
args, page = p:init(frame, page)
local output = mw.html.create'tablediv'
:attr{role = 'note'}
:addClass'metadata plainlinks asbox stub'
:css{background = 'transparent'}
:tag'table'
:attr{role = 'presentation'}
:tag'tr'
:addClass'noresize'
:node((args.icon or args.image) and
mw.html.create'td'
:wikitext(args.icon or ('[[File:%s|%spx|alt=%s]]'):format(
args.image or '',
args.pix or '40x30',
args.imagealt or 'Stub icon'
))
)
:tag'td'
:tag'i'
:wikitext(
Buffer'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'),
' expanding it].'
)
:done()
:node(args.name and
require'Module:Navbar'._navbar{
args.name,
mini = 'yes',
style = 'position: absolute; right: 15px; display: none;'
}
)
:node(args.note and
mw.html.create()
:tag'br':done()
:tag'span'
:css{['font-style'] = 'normal', ['font-size'] = 'smaller'}
:wikitext(args.note)
:done()
)
:tag'td'
:tag'ip'
:addClass'asbox-body'
:wikitext(
Buffer'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'),
' expanding it].'
} )
:done()
:node(args.note and
mw.html.create()
:tag'spanp'
:addClass'asbox-note'
:wikitext(args.note)
:tag'br' :done()
)
:allDone()
:node(args.name and
require'Module:Navbar'._navbar{
args.name,
mini = 'yes',
)}
)
--[[
Stub categories for templates include a sort key; this ensures that all stub tags appear at the beginning of their respective categories.
Line 283 ⟶ 284:
end
end
return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles} } .. tostring(output:wikitext(not p.demo and category{done = true} or nil))
end