Matrix Wiki
Explore
Main Page
Discuss
All Pages
Community
Interactive Maps
Recent Blog Posts
Franchise
Films
The Matrix
Reloaded
Revolutions
Resurrections
Video games
Enter the Matrix
Path of Neo
The Matrix Online
The Matrix Awakens
Other media
The Animatrix
Animatrix 2.0
The Matrix Comics
Books
Overview
Canon
Timeline
Admin noticeboard
Characters
Resistance (M1-M3)
Neo
Trinity
Morpheus
Niobe
Ghost
Cypher
Switch
Neb crew
Mjolnir crew
More...
Resistance (M4)
Bugs
Morpheus (program)
Sequoia
Berg
Lexy
Ellster
Sheperd
Sati
Cybebe
Mnemosyne crew
Programs
Program
Agent
Agent Smith
Agent Johnson
The Architect
The Analyst
Seraphs
Bots
Bug programs
Black cat
Exiles
Exile
The Merovingian
Persephone
The Twins
The Keymaker
The Trainman
The Oracle
Seraph
Rama Kandra
Matrix Beta Versions
Zionites
Zion
Zion Council
Commander Lock
Tank
Link
Zee
Charra
Mifune
Kid
Councillor Hamann
Synthients
Synthients (Machines)
B1-66ER
Deus Ex Machina
Sentinels
Docbots
Harvesters
Kujaku
Lumin8
Octacles
Machine Ambassador
MxO characters
The Assassin
The General
Agent Gray
Agent Pace
E Pluribus Neo
Cypherites
Ookami
Malphas
Veil
Tyndall
Locations
Real World
Real World
Zion
IO
01, the Synthient City
Power plant
Fetus fields
Anomaleum
New Zion
The Dock
Earth
Hovercraft
Nebuchadnezzar
Logos
Osiris
Mjolnir
Vigilant
Mnemosyne
Icarus
Gnosis
Brahma
Caduceus
Simulations
The Matrix
Matrix Beta Versions
The Construct
Other constructs
Mobile Ave
Neo's Modal
Within the Matrix
Heart O' The City Hotel
Neo's apartment, Room 101
MetaCortex
Lafayette Hotel
Backdoor
Le Vrai restaurant
Chateau
Club Hel
101 Freeway
Simulatte
MxO locations
Mega City
Downtown
International (Asian) district
Richland (the Slums)
Westview (the Barrens)
"Stalingrad" base
Ashencourte
Widow's Moor
Blackwood prison
Sakura
More locations...
Universe
Terminology
Simulated reality
Artificial Intelligence
The One
Redpill
Bluepill (Coppertops)
DΓ©jΓ vu
Bullet Time
Potential
Residual Self Image (RSI)
Culture
Food
Beverages
Cultural references
Alice's Adventures in Wonderland
Simulacra and Simulation
Plato
Technology
Matrix code
Operator
Exit
Headjack
Portals
Hoverpad
Armored Personnel Unit
Electromagnetic pulse (EMP)
Lightning rifle
More firearms...
Events
Matrix history
Machine War
Operation Dark Storm
Hotel Ambush
Rescue of Morpheus
Chateau Showdown
The Freeway Chase
Battle of Zion
Super Burly Brawl
Machine Civil War
More articles...
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
The Matrix Wiki
1,619
pages
Explore
Main Page
Discuss
All Pages
Community
Interactive Maps
Recent Blog Posts
Franchise
Films
The Matrix
Reloaded
Revolutions
Resurrections
Video games
Enter the Matrix
Path of Neo
The Matrix Online
The Matrix Awakens
Other media
The Animatrix
Animatrix 2.0
The Matrix Comics
Books
Overview
Canon
Timeline
Admin noticeboard
Characters
Resistance (M1-M3)
Neo
Trinity
Morpheus
Niobe
Ghost
Cypher
Switch
Neb crew
Mjolnir crew
More...
Resistance (M4)
Bugs
Morpheus (program)
Sequoia
Berg
Lexy
Ellster
Sheperd
Sati
Cybebe
Mnemosyne crew
Programs
Program
Agent
Agent Smith
Agent Johnson
The Architect
The Analyst
Seraphs
Bots
Bug programs
Black cat
Exiles
Exile
The Merovingian
Persephone
The Twins
The Keymaker
The Trainman
The Oracle
Seraph
Rama Kandra
Matrix Beta Versions
Zionites
Zion
Zion Council
Commander Lock
Tank
Link
Zee
Charra
Mifune
Kid
Councillor Hamann
Synthients
Synthients (Machines)
B1-66ER
Deus Ex Machina
Sentinels
Docbots
Harvesters
Kujaku
Lumin8
Octacles
Machine Ambassador
MxO characters
The Assassin
The General
Agent Gray
Agent Pace
E Pluribus Neo
Cypherites
Ookami
Malphas
Veil
Tyndall
Locations
Real World
Real World
Zion
IO
01, the Synthient City
Power plant
Fetus fields
Anomaleum
New Zion
The Dock
Earth
Hovercraft
Nebuchadnezzar
Logos
Osiris
Mjolnir
Vigilant
Mnemosyne
Icarus
Gnosis
Brahma
Caduceus
Simulations
The Matrix
Matrix Beta Versions
The Construct
Other constructs
Mobile Ave
Neo's Modal
Within the Matrix
Heart O' The City Hotel
Neo's apartment, Room 101
MetaCortex
Lafayette Hotel
Backdoor
Le Vrai restaurant
Chateau
Club Hel
101 Freeway
Simulatte
MxO locations
Mega City
Downtown
International (Asian) district
Richland (the Slums)
Westview (the Barrens)
"Stalingrad" base
Ashencourte
Widow's Moor
Blackwood prison
Sakura
More locations...
Universe
Terminology
Simulated reality
Artificial Intelligence
The One
Redpill
Bluepill (Coppertops)
DΓ©jΓ vu
Bullet Time
Potential
Residual Self Image (RSI)
Culture
Food
Beverages
Cultural references
Alice's Adventures in Wonderland
Simulacra and Simulation
Plato
Technology
Matrix code
Operator
Exit
Headjack
Portals
Hoverpad
Armored Personnel Unit
Electromagnetic pulse (EMP)
Lightning rifle
More firearms...
Events
Matrix history
Machine War
Operation Dark Storm
Hotel Ambush
Rescue of Morpheus
Chateau Showdown
The Freeway Chase
Battle of Zion
Super Burly Brawl
Machine Civil War
More articles...
Editing
Module:Quote
Back to page
Edit source
View history
Talk (0)
Edit Page
Module:Quote
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
-- this module implements {{quote}} -- follows customization guidelines of Dev:Quote local Quote = {} -- this module can add actual quote marks instead of relying on CSS styling local addQuoteMarks = true local isSrcPrinted = false local isDialog = false local tracking, preview local function trim(s) return mw.ustring.gsub(mw.ustring.gsub(s, '%s+', ' '), '^%s*(.-)%s*$', '%1') end local function convertNewLines(s) return mw.ustring.gsub(mw.ustring.gsub(s, '^\n*(.-)\n*$', '%1'), '\n', '<br />') end local function checkArg(k,v) local validArgs = { 'Quote', 'quotetext', 'quote', 'text', 'Name', 'name', 'person', 'speaker', 'personquoted', 'context', 'Source', 'source', 'quotesource', 'class', 'style', 'align', 'width', 'quotewidth', 'float', 'fstyle', --float style 'lstyle', --text style 'pstyle', --source style 'hideqmarks' --ignored in module but valid } if isDialog == true then validArgs = { 'description', 'context', 'source', 'class', 'style', 'align', 'width', 'float', 'pstyle', 'lstyle', 'fstyle' } end if k and type(k) == 'string' then if k:match('^speaker%d+$') then hasSpeaker = true return true end local lookup = {} for k, v in ipairs(validArgs) do lookup[v] = true end if lookup[k] or k:match('^%d+$') then return true else local vlen = mw.ustring.len(k) k = mw.ustring.sub(k, 1, (vlen < 25) and vlen or 25) k = mw.ustring.gsub(k, '[^%w\-_ ]', '?') table.insert(tracking, '[[Category:Pages using ' .. (isDialog and 'dialog' or 'quote') .. ' with unknown parameters|' .. k .. ']]') table.insert(preview, '"' .. k .. '"') end else if k and type(k) == 'number' then return true end end return false end local function build(quoteContents, context, source, options) local quoteSource if context ~= '' then local quoteStr if source ~= '' then quoteStr = '― ' .. context .. tostring(mw.html.create('sup') :css('white-space', 'nowrap') :css('margin-left', '2px') :wikitext('[[' .. source .. '|[src]]]')) else quoteStr = '― ' .. context end quoteSource = mw.html.create('cite') :addClass('pull-quote__source') :cssText(options.contextstyle or '') :wikitext(quoteStr) end local quoteContainer = mw.html.create('blockquote') :addClass('pull-quote') :addClass(options.align) :addClass(options.extraclasses) :css(options.styles) :css('text-align', options.textAlign) :cssText(options.extrastyles) if not addQuoteMarks then quoteContainer:wikitext([[ {| role="presentation" style= "border-spacing: 0; min-width: ]] .. options.styles['min-width'] .. [["]] .. (options.isTableCentered and ' align="center"; ' or '') .. [[ |- | style= "width: 100%; " |]] .. tostring(quoteContents) .. (quoteSource and ([[ |- | style= "line-height: 1; " |]] .. tostring(quoteSource)) or '') .. [[ |}]]) else quoteContainer:wikitext([[ {| role="presentation" style= "border-spacing: 0; min-width: ]] .. options.styles['min-width'] .. [["]] .. (options.isTableCentered and ' align="center"; ' or '') .. [[ |- | style= "vertical-align: top; margin: 0; padding: 0; " |]] .. tostring(mw.html.create('span') :addClass('pull-quote__qmarks') :css('font-family', "'Times New Roman', serif") :css('padding-right', '2px') :wikitext('β')) .. [[ | style= "width: 100%; " |]] .. tostring(quoteContents) .. (quoteSource and ([[ |- | colspan= "2" style= "line-height: 1; " |]] .. tostring(quoteSource)) or '') .. [[ |}]]) end return tostring(quoteContainer) end local function options(args) local options = {} options.styles = {} options.extraclasses = args.class options.extrastyles = args.style options.contextstyle = args.pstyle options.align = '' options.styles['min-width'] = args.width or args.quotewidth or '100px' options.styles['width'] = args.width or args.quotewidth or 'auto' local float = args.float if float then options.align = 'pull-quote--' .. float options.styles['min-width'] = args.width or args.quotewidth or '100px' options.styles['width'] = args.width or args.quotewidth or 'max(37.5%, 100px)' options.styles['float'] = float if args.fstyle then options.extrastyles = (options.extrastyles or '') .. ';' .. args.fstyle end end if string.lower(trim(args.align or '')) == 'center' then options.textAlign = 'center' if not float then options.isTableCentered = true end else if string.lower(trim(args.align or '')) == 'right' then options.textAlign = 'right' else if string.lower(trim(args.align or '')) == 'left' then options.textAlign = left else options.textAlign = nil end end end return options end function Quote.quotebox(frame) addQuoteMarks = false return Quote.quote(frame) end function Quote.quote(frame) -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. local origArgs = (type(frame.getParent) == 'function') and frame:getParent().args or frame local args = {} tracking, preview = {}, {} for k, v in pairs(origArgs) do if checkArg(k,v) == true then args[k] = v end end local options = options(args) local origText = convertNewLines(args[1] or args.quotetext or args.quote or args.Quote or args.text or '') local quoteText = (origText ~= '' and origText or [[Type in text without quote marks here. (Second line of text will appear as such with all spaces preserved.)]]) local person = trim(args[2] or args.name or args.Name or args.person or args.speaker or args.personquoted or '') if person == '' and origText == '' then person = 'Name' end local source = trim(args[3] or args.source or args.Source or args.quotesource or '') local block = mw.html.create('div') :addClass('pull-quote__box') local quoteContents if addQuoteMarks then if options.textAlign == 'center' then quoteContents = mw.html.create('p') :addClass('pull-quote__text') :css('display', 'inline') :css('white-space', 'pre-wrap') :css('margin', '0') :css('padding', '0') :cssText(args.lstyle or '') :done() :tag('span') :addClass('pull-quote__qmarks') :css('font-family', "'Times New Roman', serif") :css('padding-right', '2px') :css('vertical-align', 'top') :wikitext('β') :done() :wikitext(quoteText) :tag('span') :css('font-family', "'Times New Roman', serif") :css('white-space', 'nowrap') :css('padding-left', '2px') :css('vertical-align', 'top') :wikitext('β') :done() block:wikitext(tostring(quoteContents)) addQuoteMarks = false else quoteContents = mw.html.create('p') :addClass('pull-quote__text') :css('display', 'inline') :css('white-space', 'pre-wrap') :css('margin', '0') :css('padding', '0') :cssText(args.lstyle or '') :wikitext(quoteText) :allDone() block:wikitext(tostring(quoteContents)) :tag('span') :css('font-family', "'Times New Roman', serif") :css('white-space', 'nowrap') :css('padding-left', '2px') :css('vertical-align', 'top') :wikitext('β') end else quoteContents = mw.html.create('div') :addClass('pull-quote__box') :tag('p') :addClass('pull-quote__text') :css('white-space', 'pre-wrap') :css('margin', '0') :css('padding', '0') :cssText(args.lstyle or '') :wikitext(quoteText) block:wikitext(tostring(quoteContents)) end local buildStr = build(block, person, source, options) local trackStr = (#tracking > 0) and table.concat(tracking, '') or '' if #preview > 0 and frame:preprocess( "{{REVISIONID}}" ) == "" then local hatnote = require('Dev:Hatnote') trackStr = hatnote.makeWikitextError('Unknown parameters: ' .. table.concat(preview, '; ')) end return buildStr .. trackStr .. (isSrcPrinted and ('<br />Source:' .. tostring(mw.html.create('pre'):wikitext(mw.text.nowiki(buildStr)))) or '') end function Quote.dialog(frame) isDialog = true addQuoteMarks = false -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. local origArgs = (type(frame.getParent) == 'function') and frame:getParent().args or frame local args, dialog, speakers = {}, {}, {} tracking, preview = {}, {} for k, v in pairs(origArgs) do if checkArg(k,v) == true then args[k] = v end end local options = options(args) local block = mw.html.create('div') :addClass('pull-quote__box') :tag('div') :addClass('pull-quote__text') :cssText('display: block; white-space: pre-wrap; margin: 0; padding: 0; ') local lineCount = #args if hasSpeaker == true then for i = 1, lineCount do local speaker = trim(args['speaker' .. i] or '') if speaker ~= '' then speaker = tostring(mw.html.create('strong') :addClass('pull-quote__speaker') :cssText('text-align: left; ' .. (args.pstyle or '')) :wikitext(speaker .. ':')) table.insert(speakers, speaker) end end local speakerCount, j = #speakers, 1 for i = 1, lineCount do local line = convertNewLines(args[i] or '') if line ~= '' then local speaker = speakers[j] or '' line = mw.html.create('span') :addClass('pull-quote__line') :cssText('text-align: left; ' .. (args.lstyle or '')) :wikitext(speaker .. ' ' .. (line ~= '' and line or '')) table.insert(dialog, tostring(line)) j = (j % speakerCount) + 1 end end else lineCount = math.ceil(lineCount / 2) for i = 1, lineCount do local speaker = trim(args[i * 2 - 1] or '') local line = convertNewLines(args[i * 2] or '') line = (line ~= '' and line or '') if speaker ~= '' then speaker = tostring(mw.html.create('strong') :addClass('pull-quote__speaker') :cssText('text-align: left; ' .. (args.pstyle or '')) :wikitext(speaker .. ':')) line = speaker .. ' ' .. line end table.insert(dialog, tostring(mw.html.create('span') :addClass('pull-quote__line') :cssText('text-align: left; ' .. (args.lstyle or '')) :wikitext(line))) end end local context = trim(args.description or args.context or '') if #dialog == 0 then table.insert(dialog, tostring(mw.html.create('span') :addClass('pull-quote__line') :cssText('text-align: left; ' .. (args.lstyle or '')) :tag('strong') :addClass('pull-quote__speaker') :cssText('text-align: left; ' .. (args.pstyle or '')) :wikitext('{{{speaker1}}}:') :done() :wikitext(" ''{{{1}}}''"))) table.insert(dialog, tostring(mw.html.create('span') :addClass('pull-quote__line') :cssText('text-align: left; ' .. (args.lstyle or '')) :tag('strong') :addClass('pull-quote__speaker') :cssText('text-align: left; ' .. (args.pstyle or '')) :wikitext('{{{speaker2}}}:') :done() :wikitext(" ''{{{2}}}''"))) if context == '' then context = 'describe the context of the dialog' end end local source = trim(args.source or '') local dialogContents = block:wikitext(table.concat(dialog, '<br />')) local buildStr = build(dialogContents, context, source, options) local trackStr = (#tracking > 0) and table.concat(tracking, '') or '' if #preview > 0 and frame:preprocess( "{{REVISIONID}}" ) == "" then local hatnote = require('Dev:Hatnote') trackStr = hatnote.makeWikitextError('Unknown parameters: ' .. table.concat(preview, '; ')) end return buildStr .. trackStr -- .. '<br />Source:' .. tostring(mw.html.create('pre'):wikitext(mw.text.nowiki(buildStr))) end function Quote.debugQuote(frame) isSrcPrinted = true return Quote.quote(frame) end function Quote.debugQuotebox(frame) isSrcPrinted = true return Quote.quotebox(frame) end function Quote.debugDialog(frame) isSrcPrinted = true return Quote.dialog(frame) end return Quote
Summary:
Please note that all contributions to the Matrix Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Templates used on this page:
Module:Quote
(
edit
)
Module:Quote/doc
(
edit
)
Follow on IG
TikTok
Join Fan Lab