The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 828: | Line 828: | ||
} | } | ||
function | function p.getChapterName(frame) | ||
local chapterID = frame.args[1] | |||
chapterID = string.gsub(chapterID, "%s+", "") --collapse white space | chapterID = string.gsub(chapterID, "%s+", "") --collapse white space | ||
chapterID = string.upper(chapterID) --Uppercase | chapterID = string.upper(chapterID) --Uppercase | ||
Line 843: | Line 844: | ||
chapterID = chapterID.gsub(chapterID,"INTERLUDE","") --Interlude handling | chapterID = chapterID.gsub(chapterID,"INTERLUDE","") --Interlude handling | ||
chapterID = chapterID.gsub(chapterID,"MINISTORIES","") -- Mini stories handling | chapterID = chapterID.gsub(chapterID,"MINISTORIES","") -- Mini stories handling | ||
Line 860: | Line 855: | ||
function p.getChapterLink(frame) | function p.getChapterLink(frame) | ||
local chapterID = frame.args[1] | local chapterID = frame.args[1] | ||
chapterID = | chapterID = string.gsub(chapterID, "%s+", "") --collapse white space | ||
chapterID = string.upper(chapterID) --Uppercase | |||
chapterID = chapterID.gsub(chapterID,"-","–") --handle hyphens | |||
chapterID = chapterID.gsub(chapterID,"‒","–") --handle figure dashes | |||
chapterID = chapterID.gsub(chapterID,"—","–") --handle em dashes | |||
chapterID = chapterID.gsub(chapterID,"–","") --handle en dashes | |||
chapterID = chapterID.gsub(chapterID,"%(","") --paranthesis handling | |||
chapterID = chapterID.gsub(chapterID,"%)","") | |||
chapterID = chapterID.gsub(chapterID,"PT%.","PT") --Pt periods | |||
if (chapterID == "INTERLUDEARCHIVED") or (chapterID =="INTERLUDE1ARCHIVED") then return chapterList["INTERLUDE1ARCHIVED"]["link"] --For the old Archived Interlude from Volume 1 | |||
end | |||
chapterID = chapterID.gsub(chapterID,"CHAPTER","") --Chapter handling | |||
chapterID = chapterID.gsub(chapterID,"INTERLUDE","") --Interlude handling | |||
chapterID = chapterID.gsub(chapterID,"MINISTORIES","") -- Mini stories handling | |||
if chapterID == nil or chapterID == '' or not(chapterList[chapterID] ~= nil) then return "Invalid Chapter Reference (".. chapterID .. ") see [[Template:Ref]] or [[Template:Chl]]" --invalid chapter, output message in Reference box with warning and help doc to user. | if chapterID == nil or chapterID == '' or not(chapterList[chapterID] ~= nil) then return "Invalid Chapter Reference (".. chapterID .. ") see [[Template:Ref]] or [[Template:Chl]]" --invalid chapter, output message in Reference box with warning and help doc to user. | ||
else | else |