Module:BookSwitch

-- local p = {} local bookData = mw.loadData('Module:BookSwitch/data') function p.bookFormat(frame) local book= frame.args[1] local bold=frame.args[2] local length= mw.ustring.len(book) local par={} if mw.ustring.find(book,':',1,true)==nil then if mw.ustring.find(book,'-',1,true)==nil then par=1 else par=mw.ustring.find(book,'-',1,true)+2 end else par=mw.ustring.find(book,':',1,true)+2 end local subtitle=mw.ustring.sub(book,par,length) local show="Arrowverse Wiki" local year="Arrowverse Wiki" local mid={} if bookData[subtitle] then show=bookData[subtitle][1] year=bookData[subtitle][2] mid=bookData[subtitle][3] or ": " end local fulltitle = show ..mid ..subtitle if par>1 then local fakeShow=mw.ustring.sub(book,1,par-3) if show==fakeShow then year=year else fakeShow=mw.ustring.sub(book,1,par-4) if show==fakeShow then year=year else year="Arrowverse Wiki" end end end if show=="S.T.A.R. Labs" or show=="The Flash" then show="The Flash (The CW)" end local hoverInfo={} if year=="Arrowverse Wiki" then hoverInfo= ""                   ..subtitle                    .."" else if mw.ustring.len(bold)>0 then hoverInfo= "" else hoverInfo= "" end end return frame:preprocess(hoverInfo) end return p