Module:Asbox: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Codehydro mNo edit summary |
meta>Codehydro save |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function addTag(tag, innerHTML) | |||
output = output .. '<' .. tag .. '>' .. innerHTML .. '</' .. tag .. '>' | |||
end | |||
function p.main(frame) | function p.main(frame) | ||
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Asbox'}) | |||
local output = ' | local output = mw.html.create('table') | ||
if | output | ||
output = | :addClass('metadata plainlinks stub') | ||
:css('background','transparent') | |||
:attr('role','presentation') | |||
if args.icon or args.image then | |||
output | |||
:tag('td'):wikitext(args.icon or string.format('[[File:%s|%spx|alt=%s]]',args.image, args.pix and ('|' .. args.pix) or '',args.imagealt or 'Stub icon')) | |||
--'[[File:' .. args.image .. '|' .. (args.pix and ('|' .. args.pix .. 'px') or '') .. '|' .. (args.imagealt or 'Stub icon') .. ']]' | |||
end | end | ||
output | |||
:tag('td'):wikitext('\'\'This ' .. (args.subject and args.subject .. ' ' or '') .. (args.article or 'article') .. ' ' .. (args.qualifier and args.qualifier .. ' ' or '') .. '[[Wikipedia:stub|stub]]. You can help Wikipedia by [{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it].\'\'') | |||
return output | return output | ||
end | end | ||
return p | return p |
Revision as of 00:04, 24 December 2014
Documentation for this module may be created at Module:Asbox/doc
local p = {}
function addTag(tag, innerHTML)
output = output .. '<' .. tag .. '>' .. innerHTML .. '</' .. tag .. '>'
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Asbox'})
local output = mw.html.create('table')
output
:addClass('metadata plainlinks stub')
:css('background','transparent')
:attr('role','presentation')
if args.icon or args.image then
output
:tag('td'):wikitext(args.icon or string.format('[[File:%s|%spx|alt=%s]]',args.image, args.pix and ('|' .. args.pix) or '',args.imagealt or 'Stub icon'))
--'[[File:' .. args.image .. '|' .. (args.pix and ('|' .. args.pix .. 'px') or '') .. '|' .. (args.imagealt or 'Stub icon') .. ']]'
end
output
:tag('td'):wikitext('\'\'This ' .. (args.subject and args.subject .. ' ' or '') .. (args.article or 'article') .. ' ' .. (args.qualifier and args.qualifier .. ' ' or '') .. '[[Wikipedia:stub|stub]]. You can help Wikipedia by [{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it].\'\'')
return output
end
return p