Jump to content

We are doing some maintenance on the Timeless Skin, Please do not mind any changes to pages or CSS! Today is Sunday June 21, 2026!

Template:Quote: Difference between revisions

From Zee Bawx Wiki
No edit summary
No edit summary
Line 1: Line 1:
{| style="margin:auto; border-collapse:collapse; border-style:none;" class="cquote"
-- <nowiki>
| width="20" valign="top" style="color:#B2B7F2;font-size:{{#switch:{{{size|{{{2|{{{quotewidth|{{{width|20px}}}}}}}}}}}}
local Quote = {}
|10px=20px
local getArgs = require('Dev:Arguments').getArgs
|30px=60px
local i18n = require('Dev:I18n').loadMessages('Quote')
|40px=80px
 
|50px=100px
local function build(quote_contents, quote_source, options)
|60px=120px
    local quote_container = mw.html.create('blockquote')
|#default=35px}};font-family:'Times New Roman',serif;font-weight:bold;text-align:left;padding:10px 10px;" | “
        :addClass('pull-quote')
| valign="top" style="padding:4px 10px;" | {{{1|Insert the text of the quote here, without quotation marks. <noinclude>{{lorem ipsum}}</noinclude>}}}
        :addClass(options.align)
| width="20" valign="bottom" style="color:#B2B7F2;font-size:{{#switch:{{{size|{{{2|{{{quotewidth|{{{width|20px}}}}}}}}}}}}
        :addClass(options.extraclasses)
|10px=20px
        :css(options.styles)
|30px=60px
        :cssText(options.extrastyles)
|40px=80px
       
|50px=100px
    quote_container:node(quote_contents)
|60px=120px
       
|#default=36px}};font-family:'Times New Roman',serif;font-weight:bold;text-align:right;padding:10px 10px;" | ”
    if quote_source then
|-
    quote_container:tag('div')
{{#if:{{{4|}}}{{{5|}}}|
    :addClass('pull-quote__source')
{{!}} colspan="3" style="padding-right: 4%" {{!}} {{#if:{{{4|<noinclude>Origin</noinclude>}}}|<p style="font-size:smaller;text-align: right"><cite style="font-style:normal;">—{{{4}}}{{#if:{{{5|<noinclude>Source</noinclude>}}}|, {{{5}}}}}</cite></p>}}
        :tag('cite')
}}
        :wikitext(quote_source)
|}<!-- {{subst:FULLPAGENAME}} --><noinclude>
        :done()
{{documentation}}
        :done()
<templatedata>
    end
{
   
"params": {
    return quote_container
"1": {
end
"aliases": [
 
"text"
local function options(args)
]
    local options = {}
},
   
"4": {
    options.styles = {}
"aliases": [
    options.extraclasses = i18n:parameter('class', args)
"person"
    options.extrastyles = i18n:parameter('style', args)
]
    options.align = ''
},
    local align = i18n:parameter('align', args)
"5": {
    if align then
"aliases": [
        options.align = 'pull-quote--' .. align
"source"
        options.styles['width'] = i18n:parameter('width', args) or
]
                                  i18n:parameter('quotewidth', args) or
},
                                  '300px'
"size": {},
    end
"quotewidth": {},
   
"width": {}
    return options
}
end
}
 
</templatedata></noinclude>
-- let MediaWiki parser auto-generate <p> tags
local function paragraph(quotetext)
return '\n' .. quotetext .. '\n'
end
 
function Quote.quote(frame)
    local args = getArgs(frame)
 
    local options = options(args)
   
    local quotetext = args[1] or
                      i18n:parameter('quotetext', args) or
                      i18n:parameter('quote', args) or
                      i18n:parameter('text', args) or ''
    local person = args[2] or
                  i18n:parameter('person', args) or
                  i18n:parameter('speaker', args) or
                  i18n:parameter('personquoted', args) or nil
    local source = args[3] or
                  i18n:parameter('source', args) or
                  i18n:parameter('quote_source', args) or nil
 
    local quote_contents = mw.html.create('div')
        :addClass('pull-quote__text')
        :wikitext(paragraph(quotetext))
   
    local quote_source = person
   
    if person and source then
        quote_source = person .. ', ' .. source
    elseif source then
    quote_source = source
    end
   
    return build(quote_contents, quote_source, options)
end
 
function Quote.dialogue(frame)
    local args = getArgs(frame)
   
    local options = options(args)
   
    local quote_contents = mw.html.create('div')
        :addClass('pull-quote__text')
       
    local quote_source
 
    for i, v in ipairs(args) do
        local next_param = i + 1
       
        if i % 2 ~= 0 then
            quote_contents:tag('div')
                :addClass('pull-quote__line')
                :tag('strong')
                    :addClass('pull-quote__speaker')
                    :wikitext(v .. ':')
                    :done()
                :wikitext(' ' .. paragraph(args[next_param]))
                :done()
        end
    end
   
    local context = i18n:parameter('context', args)
    local source = i18n:parameter('source', args)
    if context and source then
        quote_source = context .. ', ' .. source
    elseif context and not source then
        quote_source = context
    elseif source and not context then
        quote_source = source
    end
   
    return build(quote_contents, quote_source, options)
   
end
 
return Quote
-- </nowiki>

Revision as of 18:17, 13 March 2026

-- local Quote = {} local getArgs = require('Dev:Arguments').getArgs local i18n = require('Dev:I18n').loadMessages('Quote') local function build(quote_contents, quote_source, options) local quote_container = mw.html.create('blockquote') :addClass('pull-quote') :addClass(options.align) :addClass(options.extraclasses) :css(options.styles) :cssText(options.extrastyles) quote_container:node(quote_contents) if quote_source then quote_container:tag('div') :addClass('pull-quote__source') :tag('cite') :wikitext(quote_source) :done() :done() end return quote_container end local function options(args) local options = {} options.styles = {} options.extraclasses = i18n:parameter('class', args) options.extrastyles = i18n:parameter('style', args) options.align = '' local align = i18n:parameter('align', args) if align then options.align = 'pull-quote--' .. align options.styles['width'] = i18n:parameter('width', args) or i18n:parameter('quotewidth', args) or '300px' end return options end -- let MediaWiki parser auto-generate <p> tags local function paragraph(quotetext) return '\n' .. quotetext .. '\n' end function Quote.quote(frame) local args = getArgs(frame) local options = options(args) local quotetext = args[1] or i18n:parameter('quotetext', args) or i18n:parameter('quote', args) or i18n:parameter('text', args) or '' local person = args[2] or i18n:parameter('person', args) or i18n:parameter('speaker', args) or i18n:parameter('personquoted', args) or nil local source = args[3] or i18n:parameter('source', args) or i18n:parameter('quote_source', args) or nil local quote_contents = mw.html.create('div') :addClass('pull-quote__text') :wikitext(paragraph(quotetext)) local quote_source = person if person and source then quote_source = person .. ', ' .. source elseif source then quote_source = source end return build(quote_contents, quote_source, options) end function Quote.dialogue(frame) local args = getArgs(frame) local options = options(args) local quote_contents = mw.html.create('div') :addClass('pull-quote__text') local quote_source for i, v in ipairs(args) do local next_param = i + 1 if i % 2 ~= 0 then quote_contents:tag('div') :addClass('pull-quote__line') :tag('strong') :addClass('pull-quote__speaker') :wikitext(v .. ':') :done() :wikitext(' ' .. paragraph(args[next_param])) :done() end end local context = i18n:parameter('context', args) local source = i18n:parameter('source', args) if context and source then quote_source = context .. ', ' .. source elseif context and not source then quote_source = context elseif source and not context then quote_source = source end return build(quote_contents, quote_source, options) end return Quote --