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:WebSwitch|function name|various parameters}} onto the template.[ Data ]
Functions | ||||
---|---|---|---|---|
Function name | Input value(s) | Output value | ||
getSeries | Media Title | Media Series Title or Type | ||
webFormat | Media Title, Optional Color | Format for Template:Web |
- For help on this module, please contact an administrator.
Visit Module:WebSwitch/doc to edit this text! (How does this work?)
--[[Category:Lua modules]]
local p = {}
local webData = mw.loadData('Module:WebSwitch/data')
--this function directly used on Template:DeadWeek--
function p.getSeries(frame)
local media= frame.args[1]
local seriesName={}
if webData[media]
then seriesName= webData[media][1]
else seriesName="Arrowverse Wiki"
end
return seriesName
end
function p.webFormat(frame)
local media=frame.args[1]
local color= frame.args[2]
local par = mw.ustring.len(media)
if mw.ustring.find(media,'(',1,true)==nil
then par = par
else par = mw.ustring.find(media,'(',1,true)-2
end
local mediaForm=mw.ustring.sub(media,1,par)
local fullForm="{{Hoverlink|"
..string.gsub(media,"#","")
.."|"
..mediaForm
.."|"
local env = "{{Q"
.."}}"
if webData[media]
then if webData[media][3]== nil
then if webData[media][4]==nil
then if webData[media][2]==nil
then fullForm=fullForm
..mediaForm
.." ("
..webData[media][1]
..")"
else fullForm=fullForm
..mediaForm
.." ("
..webData[media][1]
.." "
..webData[media][2]
..")"
end
else fullForm=fullForm
..mediaForm
.." ("
..webData[media][1]
..")"
env="''"
end
else fullForm=fullForm
..webData[media][3]
end
else fullForm="[[Category:"
.."Broken Web link|"
..media
.."]]"
..fullForm
..mediaForm
.." (Arrowverse Wiki)"
end
if mw.ustring.len(color)>0
then fullForm=fullForm
.."|color="
..color
end
fullForm="{{Environment|"
..env
.."|"
..fullForm
.."}}}}"
return frame:preprocess(fullForm)
end
return p