Module:Infobox Language: Difference between revisions
Content added Content deleted
No edit summary |
(Made various fields optional for ease of use, clean up) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local headerStyle |
local headerStyle |
||
if args.headerstyle and args.headerstyle ~= '' then |
if args.headerstyle and args.headerstyle ~= '' then |
||
headerStyle = string.format('background-color:%s;', args.headerstyle) |
headerStyle = string.format('background-color:%s;', args.headerstyle) |
||
Line 11: | Line 12: | ||
headerStyle = 'background-color:grey;' |
headerStyle = 'background-color:grey;' |
||
end |
end |
||
local retval = capiunto.create( { |
local retval = capiunto.create( { |
||
title = args.title, |
title = args.title, |
||
headerStyle = headerStyle, |
headerStyle = headerStyle, |
||
} ) |
} ) |
||
⚫ | |||
if args.image then |
|||
⚫ | |||
⚫ | |||
else |
|||
retval:addImage(args.image) |
|||
⚫ | |||
end |
end |
||
retval:addRow( |
if args.dev then retval:addRow('Developer', args.dev) end |
||
:addRow( |
if args.rel then retval:addRow('Released', args.rel) end |
||
⚫ | |||
:addRow( 'Implementation Languages', args.implang) |
|||
:addRow( 'Numeric Types', args.ntype) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
:addRow( 'Website', args.url) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
if args.dialects then retval:addRow('Dialects', args.dialects) end |
|||
if args.dialect then retval:addRow('Dialect', args.dialect) end |
|||
⚫ | |||
if args.ttype then retval:addRow('Temporal types', args.ttype) end |
|||
if args.table then retval:addRow('Table support', args.table) end |
|||
if args.proto then retval:addRow('Prototypes', args.proto) end |
|||
-- if args.unicode then retval:addRow('Unicode support', args.unicode) end |
|||
⚫ | |||
if args.implang then retval:addRow('Implemented in', args.implang) end |
|||
if args.implangs then retval:addRow('Implemented in', args.implangs) end |
|||
⚫ | |||
⚫ | |||
⚫ | |||
retval:addWikitext( '<hr>' ) |
|||
if args.influenced then |
|||
if args.url then retval:addRow('Website', args.url) end |
|||
⚫ | |||
end |
|||
⚫ | |||
⚫ | |||
if args.influenced then retval:addRow('Influenced', args.influenced) end |
|||
if args.infby then retval:addRow('Influenced By', args.infby) end |
|||
if args.infby then |
|||
⚫ | |||
end |
|||
return retval |
return retval |
||
end |
end |
Latest revision as of 22:47, 8 July 2022
optional params have a * at the end. {{Infobox Language | title = The title | headerstyle = (defaults to background-color:grey) * | image = [[File:Logo.svg|200px]] * | caption = * | dev = developer | rel = release date | unknown | dialects = K(3|4|5|6|7|9) * | dialect = K(3|4|5|6|7|9) * | ttype = temporal types | none | table = yes | no tables | proto = yes | no | unicode = full|partial|no support | implang = single language * | implangs = multiple languages * | plats = platforms | oses = operating systems * | license = license | url = [https://website.com name] | docs = [https://docs.com name] | runurl = [https://run.com run online] | influenced = influenced languages * | infby = influenced by languages * }}
local capiunto = require 'capiunto'
local p = {}
function p.main(frame)
local args = frame:getParent().args
local headerStyle
if args.headerstyle and args.headerstyle ~= '' then
headerStyle = string.format('background-color:%s;', args.headerstyle)
else
headerStyle = 'background-color:grey;'
end
local retval = capiunto.create( {
title = args.title,
headerStyle = headerStyle,
} )
if args.image then
if args.caption then
retval:addImage(args.image, args.caption)
else
retval:addImage(args.image)
end
end
if args.dev then retval:addRow('Developer', args.dev) end
if args.rel then retval:addRow('Released', args.rel) end
retval:addWikitext( '<hr>' )
if args.dialects then retval:addRow('Dialects', args.dialects) end
if args.dialect then retval:addRow('Dialect', args.dialect) end
if args.ttype then retval:addRow('Temporal types', args.ttype) end
if args.table then retval:addRow('Table support', args.table) end
if args.proto then retval:addRow('Prototypes', args.proto) end
-- if args.unicode then retval:addRow('Unicode support', args.unicode) end
retval:addWikitext( '<hr>' )
if args.implang then retval:addRow('Implemented in', args.implang) end
if args.implangs then retval:addRow('Implemented in', args.implangs) end
if args.plats then retval:addRow('Platforms', args.plats) end
if args.oses then retval:addRow('Operating Systems', args.oses) end
if args.license then retval:addRow('License', args.license) end
retval:addWikitext( '<hr>' )
if args.url then retval:addRow('Website', args.url) end
if args.docs then retval:addRow('Documentation', args.docs) end
if args.runurl then retval:addRow('Run Online', args.runurl) end
if args.influenced or args.infby then retval:addWikitext( '<hr>' ) end
if args.influenced then retval:addRow('Influenced', args.influenced) end
if args.infby then retval:addRow('Influenced By', args.infby) end
return retval
end
return p