Module:BibleQuote: Difference between revisions
Content deleted Content added
Johnrdorazio (talk | contribs) No edit summary |
Johnrdorazio (talk | contribs) No edit summary |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local getArgs = require('Module:Arguments').getArgs |
local getArgs = require('Module:Arguments').getArgs |
||
⚫ | |||
local VERSIONS_AVAILABLE = { |
local VERSIONS_AVAILABLE = { |
||
Line 21: | Line 22: | ||
end |
end |
||
local function makeInvokeFunc(funcName) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
function p.isValidVersion( frame ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
--we will only consider arguments that are passed by the template itself in the invoke |
|||
args.version = "NABRE" |
|||
end |
|||
⚫ | |||
⚫ | |||
args.ref = "John 3:16" |
|||
⚫ | |||
if args.inline == nil or args.inline == "" or args.inline == 1 or args.inline == "1" or args.inline == "true" then |
|||
⚫ | |||
elseif args.inline == 0 or args.inline == "0" or args.inline == "false" then |
|||
args.inline = false |
|||
end |
|||
⚫ | |||
⚫ | |||
end |
end |
||
p.isValidVersion = makeInvokeFunc("_isValidVersion") |
|||
⚫ | |||
⚫ | |||
local args = getArgs(frame, { |
|||
⚫ | |||
--we will only consider arguments that are passed by the template itself in the invoke |
|||
return 1 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
return 0 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
p.main = makeInvokeFunc("_main") |
|||
function p._main( args ) |
function p._main( args ) |
||
if (in_table(args.version, VERSIONS_AVAILABLE)) then |
if (in_table(args.version, VERSIONS_AVAILABLE)) then |
||
if args.inline then |
|||
return "<span class=\"bibleQuoteRef\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\">" .. args.ref .. "</span>" |
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 |
else |
||
return "<span class=\"bibleQuoteRefBroken\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" title=\"The Bible version '" .. args.version .. "' is not supported by the BibleGet endpoint.\">" .. args.ref .. "</span><sup class=\"bibleQuoteRefBrokenReason\" title=\"The Bible version '" .. args.version .. "' is not supported by the BibleGet endpoint.\">[!]</sup>" |
return "<span class=\"bibleQuoteRefBroken\" data-ref=\"" .. args.ref .. "\" data-version=\"" .. args.version .. "\" data-inline=\"" .. (args.inline == true and "true" or "false") .. "\" title=\"The Bible version '" .. args.version .. "' is not supported by the BibleGet endpoint.\">" .. args.ref .. "</span><sup class=\"bibleQuoteRefBrokenReason\" title=\"The Bible version '" .. args.version .. "' is not supported by the BibleGet endpoint.\">[!]</sup>" |
||
end |
end |
||
end |
end |
||
--[[ |
|||
⚫ | |||
if(fs.is_dir("/var/log/snort") = nil) then |
|||
⚫ | |||
⚫ | |||
⚫ | |||
]] |
|||
return p |
return p |