Module:Sandbox/Gpmat/test

.mw-parser-output .documentation,.mw-parser-output .documentation-metadata{border:1px solid var(--border-color-base,#a2a9b1);background-color:#ecfcf4;color:inhe

Module:Sandbox/Gpmat/test
local p = {}
local getArgs = require('Module:Arguments').getArgs
local colori = {
["1"] = "FFFFBF",
["2"] = "DFDFDF",
["3"] = "FFDF9F",
Ret = "EFCFFF",
DNQ = "EFCFCF",
DNS = "FFFFFF",
punti = "DFFFDF",
nopunti = "CFCFFF",
[0] = ""
}
local soglia = {
[1] = 5,
[2] = 6,
[3] = 8,
[4] = 10 }


function p.tabella(frame)
local args = getArgs(frame)

local count = 0
for _ in pairs(args) do count = count + 1 end

local str = "{| class=\"wikitable\" style=\"text-align:center; font-size:85%; width:100%; margin-top:0em; margin-bottom:0em\"\n|-\n"

for i=1,count do
str = str .. "!" .. args[i]
if i~=count then
str = str .. "!"
end
end

str = str .. "\n|}"

return str
end


function p.main(frame)
local args = getArgs(frame)
local res = args[1]
local anno = tonumber(args[2])

if res == nil then
res = 0
end

local res2 = string.gsub(res,"'","")


if anno < 1960 then
 format = 1
elseif anno < 2003 then
 format = 2
elseif anno < 2010 then
 format = 3
else format = 4
end

if tonumber(res2) ~= nil and tonumber(res2) > 3 then
   if tonumber(res2) < soglia[format]+1 then
   res2 = "punti"
   else res2 = "nopunti"
   end
end

local colore = colori[res2]

if colore == nil then
colore = ""
end

return "style=\"padding-left:0px;padding-right:0px;background-color:#" .. colore .. "\""
end

function p.render(frame)
local args = getArgs(frame)
local res = args[1]
local apici = args[2]

if apici == "PG" or apici == "GV" then
res = "''" .. res .. "''"
end
if apici == "PG" or apici == "PP" then
res = "'''" .. res .. "'''"
end

return res

end

function p.pippo(frame)
local div = mw.html.create( 'td' )
div
     :attr( 'id', 'testdiv' )
     :css( 'width', '100%' )
     :wikitext( 'Some text' )
return tostring( div )
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.