Editing Module:Ref

From The Wandering Inn Wiki
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 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 793: Line 793:
}
}


function cleanChapterID(chapterID)
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 808: Line 809:
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
return chapterID
end
function p.getChapterName(frame)
    local chapterID = frame.args[1]
chapterID = cleanChapterID(chapterID)


Line 825: Line 820:
function p.getChapterLink(frame)
function p.getChapterLink(frame)
     local chapterID = frame.args[1]
     local chapterID = frame.args[1]
chapterID = cleanChapterID(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
Please note that all contributions to The Wandering Inn Wiki are considered to be released under the Creative Commons attribution – non commercial – share alike (see The Wandering Inn Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: