Modulo:BibleQuote: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Creata pagina con " local getArgs = require('Module:Arguments').getArgs local VERSIONS_AVAILABLE = { "NABRE", "NVBSE", "LUZZI", "CEI2008" } -- let's keep the needle in a haystack ordering..."
 
Nessun oggetto della modifica
 
(7 versioni intermedie di uno stesso utente non sono mostrate)
Riga 1:
 
local getArgs = require('Module:Arguments').getArgs
local p = {} --p stands for package
 
local VERSIONS_AVAILABLE = {
Riga 6 ⟶ 7:
"NVBSE",
"LUZZI",
"CEI2008",
"DRB",
"VGCL"
}
 
Riga 19 ⟶ 22:
end
 
local function makeInvokeFunc(funcName)
local p = {} --p stands for package
return function p.main( frame )
 
local args = getArgs(frame, {)
function p.isValidVersion( version )
-- let's make sure defaults are set
in_table(version, VERSIONS_AVAILABLE)
if args.version == nil or args.version or== "NABRE" then
if args.versione ~= nil and args.versione ~= "" then
args.version = args.versione
else
args.version = "CEI2008"
}) end
end
if args.ref == nil or args.ref or== "John 3:16" then
if args.rif ~= nil and args.rif ~= "" then
args.ref = args.rif
else
args.ref = "Giovanni 3:16"
end
end
if args.inline == nil or args.inline == "" or args.inline == 1 or args.inline == "1" or args.inline == "true" then
frameOnlyargs.inline = true
elseif args.inline == 0 or args.inline == "0" or args.inline == "false" then
args.inline = false
end
return p._main[funcName](args)
end
end
 
p.isValidVersion = makeInvokeFunc("_isValidVersion")
function p.main( frame )
function p.cacheDirExists_isValidVersion( args )
local args = getArgs(frame, {
if (in_table(args.version, VERSIONS_AVAILABLE)) then
--we will only consider arguments that are passed by the template itself in the invoke
return 1
frameOnly = true
else
})
return 0
-- let's make sure defaults are set
end
args.version = args.version or "NABRE"
args.ref = args.ref or "John 3:16"
return p._main(args)
end
 
p.main = makeInvokeFunc("_main")
function p._main( args )
if (in_table(args.version, VERSIONS_AVAILABLE)) then
if args.inline then
return "<span class=\"bibleQuoteRef\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" data-inline=\"true\">" .. args.ref .. "</span>"
else
return "<div class=\"bibleQuoteRef\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" data-inline=\"false\"><div class=\"lds-spinner\"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>"
end
else
return "<span class=\"bibleQuoteRefBroken\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" data-inline=\"" .. (args.inline == true and "true" or "false") .. "\" title=\"TheLa Bibleversione versionbiblica '" .. args.version .. "' isnon notè supportedsupportata bydall'API thedi BibleGet endpoint.\">" .. args.ref .. "</span><sup class=\"bibleQuoteRefBrokenReason\" title=\"TheLa Bibleversione versionbiblica '" .. args.version .. "' isnon notè supportedsupportata bydall'API thedi BibleGet endpoint.\">[!]</sup>"
end
end
 
--[[
function p.cacheDirExists( args )
if(fs.is_dir("/var/log/snort") = nil) then
else
end
end
]]
return p