Module:Infobox Language: Difference between revisions

From The K Language Wiki
Content added Content deleted
(Created page with "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, } ) :addImage( args.image, args.caption ) :addRow( 'Developer', args.dev ) :a...")
 
No edit summary
Line 15: Line 15:
headerStyle = headerStyle,
headerStyle = headerStyle,
} )
} )
:addImage( args.image, args.caption )
if args.image and args.caption then
:addRow( 'Developer', args.dev )
retval:addImage( args.image, args.caption )
end

retval:addRow( 'Developer', args.dev )
:addRow( 'Released', args.rel )
:addRow( 'Released', args.rel )
:addRow( 'Released', args.rel )
:addWikitext( '<hr>' )
:addWikitext( '<hr>' )
:addRow( 'Implementation Languages', args.implang)
:addRow( 'Numeric Types', args.ntype)
:addRow( 'Platforms', args.plats)
:addRow( 'Operating Systems', args.oses)
:addRow( 'License', args.license)
:addWikitext( '<hr>' )
:addRow( 'Website', args.url)
:addRow( 'Documentation', args.docs)
:addRow( 'Run Online', args.runurl)

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
return retval
end
end

Revision as of 11:26, 7 January 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 and args.caption then
	    retval:addImage( args.image, args.caption )
    end

	retval:addRow( 'Developer', args.dev )
	:addRow( 'Released', args.rel )
    :addWikitext( '<hr>' )
    :addRow( 'Implementation Languages', args.implang)
    :addRow( 'Numeric Types', args.ntype)
    :addRow( 'Platforms', args.plats)
    :addRow( 'Operating Systems', args.oses)
    :addRow( 'License', args.license)
    :addWikitext( '<hr>' )
    :addRow( 'Website', args.url)
    :addRow( 'Documentation', args.docs)
    :addRow( 'Run Online', args.runurl)

    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