Module:PT graphics

Template:Module rating This module implements the topic of Periodic table graphics. As of November 2020: application is in development, no template(s) yet. Also, at the moment this module aims to analyse graphics used (like: checking color W3C contrasts re background colors). That is: not in mainspace.

When in use, the related WikiProject is WP:ELEMENTS (talk).

Usage

{{#invoke:PT graphics|function_name}}

See also



local p = {}
local dataPageName = 'Module:PT graphics/data' -- base from 'Module:Track gauge/data' -- 

local getArgs = require( 'Module:Arguments' ).getArgs
local datasetD = mw.loadData( dataPageName )
local setID = ''
local Dtable = nil
local theme = nil

-- set-theme-prop VALUE  ----------------------------------------------------
function p.value( frame )
local prop = '-'
local ret0 = {}
local ret1 = {}
local tArgs = getArgs(frame, {removeBlanks = false})

    setID = tArgs["setID"]
    theme = tArgs["theme"]
    prop  = tArgs["descr"] or tArgs["cat"] or tArgs["som"]
    Dtable = datasetD[setID]

	ret1= {theme, Dtable[theme][prop]}

return theme .. ' ' .. prop ..  ' = ' .. Dtable[theme][prop]


end

-- LIST ----------------------------------------------------
function p.list( frame )
local prop = '-'
local ret0 = {}
local ret1 = {}
local tArgs = getArgs( frame, {removeBlanks = false} )
local themeTable = {}

    setID = tArgs["setID"]
    theme = tArgs["theme"]
    prop  = tArgs["descr"] or tArgs["cat"] or tArgs["som"]
    Dtable = datasetD[setID]

themeTable = Dtable[theme]

	ret1= {}

table.insert( ret1, '*' .. setID .. ', ' .. theme )

    for v, k in pairs( themeTable ) do
        table.insert( ret1, v .. ': ' .. k )

    end

	return table.concat( ret1, '<br/>* ' )

end

return p