Module documentation
This module has various functions described below and should only be utilized on templates. To call a module in a template, insert {{#invoke:ComicSwitch|function name|various parameters}} onto the template.[ Data ]
Functions | ||||
---|---|---|---|---|
Function name | Input value(s) | Output value | ||
getSeries | Comic Issue Title | Comic Series Title | ||
comFormat | Comic Issue Title, Optional Color | Format for Template:Com |
- For help on this module, please contact an administrator.
Visit Module:ComicSwitch/doc to edit this text! (How does this work?)
--[[Category:Lua modules]]
local p = {}
local comicData = mw.loadData('Module:ComicSwitch/data')
function p.getSeries(frame)
local issue= frame.args[1]
local seriesName={}
if comicData[issue]
then seriesName= comicData[issue][1]
else seriesName="Arrowverse Wiki"
end
if seriesName=="Arrow"
then seriesName="Arrow (comic book series)"
end
return seriesName
end
function p.comFormat(frame)
local issue= frame.args[1] --page title--
local color= frame.args[2]
local par = mw.ustring.len(issue)
if issue=="Sistery Mystery (Reprise)"
then par=par
else if mw.ustring.find(issue,'(',1,true)==nil
then par = par
else par = mw.ustring.find(issue,'(',1,true)-2
end
end
local issueReal= mw.ustring.sub(issue,1,par)
if issueReal=="Crisis on Infinite Earths Giant 1"
then issueReal="Crisis on Infinite Earths Giant #1"
end
if issueReal=="Crisis on Infinite Earths Giant 2"
then issueReal="Crisis on Infinite Earths Giant #2"
end
local hoverInfo ={}
local issueForm ={}
if comicData[issue]
then if comicData[issue][2]==nil
then hoverInfo=comicData[issue][3]
..")"
else hoverInfo=comicData[issue][1]
.." #"
..comicData[issue][2]
..")"
end
if comicData[issue][4] == nil
then issueForm = issueReal
else if issue=="REC."
then issueForm="[REC.]"
issueReal="[REC.]"
else local par2=comicData[issue][4]
local par3=mw.ustring.len(issueReal)
issueForm="''"
..mw.ustring.sub(issueReal,1,par2)
.."''"
..mw.ustring.sub(issueReal,par2+1,par3)
end
end
else hoverInfo="Arrowverse Wiki)"
issueForm=issueReal
end
local fullForm="{{Hoverlink|"
..issue
.."|"
..issueForm
.."|"
..issueReal
.." ("
..hoverInfo
if mw.ustring.len(color)>0
then fullForm=fullForm
.."|color="
..color
end
fullForm=fullForm
.."}}"
if issueReal==issueForm
then fullForm="{{Environment|"
.."{{Q"
.."}}|"
..fullForm
.."}}"
end
if hoverInfo == "Arrowverse Wiki)"
then fullForm=fullForm
.."[[Category:"
.."Broken Com link|"
..issue
.."]]"
end
return frame:preprocess(fullForm)
end
return p