Module:Quote: Difference between revisions
Jump to navigation
Jump to search
m 1 revision imported |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | |||
local | |||
-- | function p.main(frame) | ||
return | -- Grab the arguments passed to the template | ||
local args = frame:getParent().args | |||
if args[1] == nil and args.quote == nil and args.text == nil then | |||
args = frame.args | |||
end | |||
local text = args.quote or args.text or args[1] or "" | |||
local author = args.author or args.sign or args[2] or "" | |||
local source = args.source or args[3] or "" | |||
-- Build the HTML wrapper styled for jcraft-eoe.com | |||
local container = mw.html.create('div') | |||
container:cssText("border-left: 4px solid #a862ea; background-color: #1e1f22; padding: 15px 20px; margin: 15px 0; border-radius: 0 8px 8px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4);") | |||
-- Add the Quote Text | |||
container:tag('div') | |||
:cssText("font-style: italic; font-size: 1.1em; color: #e6e6e6;") | |||
:wikitext(text) | |||
-- Add the Author and Source (if they were provided) | |||
if author ~= "" or source ~= "" then | |||
local citation = container:tag('div') | |||
:cssText("margin-top: 10px; font-size: 0.95em; color: #bbbbbb; font-weight: 500;") | |||
if author ~= "" then | |||
citation:wikitext("— " .. author) | |||
end | |||
if source ~= "" then | |||
if author ~= "" then | |||
citation:wikitext(", ") | |||
end | |||
citation:tag('i'):wikitext(source) | |||
end | |||
end | |||
return tostring(container) | |||
end | |||
-- Map common function names so the template doesn't get confused | |||
p.quote = p.main | |||
return p | |||
Revision as of 18:13, 26 April 2026
Documentation for this module may be created at Module:Quote/doc
local p = {}
function p.main(frame)
-- Grab the arguments passed to the template
local args = frame:getParent().args
if args[1] == nil and args.quote == nil and args.text == nil then
args = frame.args
end
local text = args.quote or args.text or args[1] or ""
local author = args.author or args.sign or args[2] or ""
local source = args.source or args[3] or ""
-- Build the HTML wrapper styled for jcraft-eoe.com
local container = mw.html.create('div')
container:cssText("border-left: 4px solid #a862ea; background-color: #1e1f22; padding: 15px 20px; margin: 15px 0; border-radius: 0 8px 8px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4);")
-- Add the Quote Text
container:tag('div')
:cssText("font-style: italic; font-size: 1.1em; color: #e6e6e6;")
:wikitext(text)
-- Add the Author and Source (if they were provided)
if author ~= "" or source ~= "" then
local citation = container:tag('div')
:cssText("margin-top: 10px; font-size: 0.95em; color: #bbbbbb; font-weight: 500;")
if author ~= "" then
citation:wikitext("— " .. author)
end
if source ~= "" then
if author ~= "" then
citation:wikitext(", ")
end
citation:tag('i'):wikitext(source)
end
end
return tostring(container)
end
-- Map common function names so the template doesn't get confused
p.quote = p.main
return p