Modulo:BibleQuote: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 29: | Riga 29: | ||
}) |
}) |
||
-- let's make sure defaults are set |
-- let's make sure defaults are set |
||
args.version = args.version or " |
args.version = args.version or "CEI2008" |
||
if (in_table(args.version, VERSIONS_AVAILABLE)) then |
if (in_table(args.version, VERSIONS_AVAILABLE)) then |
||
return 1 |
return 1 |
||
Riga 43: | Riga 43: | ||
}) |
}) |
||
-- let's make sure defaults are set |
-- let's make sure defaults are set |
||
args.version = args.version or " |
args.version = args.version or "CEI2008" |
||
args.ref = args.ref or "John 3:16" |
args.ref = args.ref or "John 3:16" |
||
return p._main(args) |
return p._main(args) |
Versione delle 21:45, 22 set 2020
La documentazione per questo modulo può essere creata in Modulo:BibleQuote/man
local getArgs = require('Module:Arguments').getArgs
local VERSIONS_AVAILABLE = {
"NABRE",
"NVBSE",
"LUZZI",
"CEI2008",
"VGCL",
"DRB"
}
-- let's keep the needle in a haystack ordering typical of PHP
local function in_table (val, tab)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
local p = {} --p stands for package
function p.isValidVersion( frame )
local args = getArgs(frame, {
--we will only consider arguments that are passed by the template itself in the invoke
frameOnly = true
})
-- let's make sure defaults are set
args.version = args.version or "CEI2008"
if (in_table(args.version, VERSIONS_AVAILABLE)) then
return 1
else
return 0
end
end
function p.main( frame )
local args = getArgs(frame, {
--we will only consider arguments that are passed by the template itself in the invoke
frameOnly = true
})
-- let's make sure defaults are set
args.version = args.version or "CEI2008"
args.ref = args.ref or "John 3:16"
return p._main(args)
end
function p._main( args )
if (in_table(args.version, VERSIONS_AVAILABLE)) then
return "<span class=\"bibleQuoteRef\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\">" .. args.ref .. "</span>"
else
return "<span class=\"bibleQuoteRefBroken\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" title=\"La versione '" .. args.version .. "' della Bibbia non è supportata dall'API di BibleGet.\">" .. args.ref .. "</span><sup class=\"bibleQuoteRefBrokenReason\" title=\"The Bible version '" .. args.version .. "' is not supported by the BibleGet endpoint.\">[!]</sup>"
end
end
--[[
function p.cacheDirExists( args )
if(fs.is_dir("/var/log/snort") = nil) then
else
end
end
]]
return p