Module:BibleQuote: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 30: Line 30:
     -- let's make sure defaults are set
     -- let's make sure defaults are set
     args.version = args.version or "NABRE"
     args.version = args.version or "NABRE"
    -- also make sure it's not empty
    if args.version == "" then
    args.version = "NABRE"
    end
if (in_table(args.version, VERSIONS_AVAILABLE)) then
if (in_table(args.version, VERSIONS_AVAILABLE)) then
return 1
return 1
Line 44: Line 48:
     -- let's make sure defaults are set
     -- let's make sure defaults are set
     args.version = args.version or "NABRE"
     args.version = args.version or "NABRE"
    if args.version == "" then
    args.version = "NABRE"
    end
     args.ref = args.ref or "John 3:16"
     args.ref = args.ref or "John 3:16"
    if args.ref == "" then
    args.ref = "John 3:16"
    end
    args.inline = args.inline or "true"
    if args.inline == "" or args.inline == 1 or args.inline == "true" then
    args.inline = "true"
    elseif args.inline == 0 or args.inline == "false" then
    args.inline = "false"
    end
     return p._main(args)
     return p._main(args)
end
end
Line 50: Line 66:
function p._main( args )
function p._main( args )
if (in_table(args.version, VERSIONS_AVAILABLE)) then
if (in_table(args.version, VERSIONS_AVAILABLE)) 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=\"" .. args.inline .. "\">" .. args.ref .. "</span>"
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 .. "\" 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