FANDOM


local p = {}
 
function p.HideWikiLinks(frame)
    StartText=frame.args[1]
    Color=frame.args[2] or "BLACK"
 
    CurrentText = StartText
 
    itsthere, _ = string.find(CurrentText, "%[%[.*%]%]")
 
    while itsthere do --While there are wikilinks found, keep going.
        _, _, short = string.find(CurrentText, "%[%[(.-)%]%]")
        ispipe, _ = string.find(short, "|")
        if ispipe then
            _, _, shorterTarget = string.find(short, "(.-)|")
            _, _, shorterText = string.find(short, "|(.*)")
        else
            shorterTarget = short
            shorterText = short
        end
        ReplacementLink = "STARTBRACKETS" .. shorterTarget .. "|<span style='color: " .. Color .. ";'>" .. shorterText .. "</span>ENDBRACKETS"
        CurrentText = string.gsub(CurrentText, "%[%[.-%]%]", ReplacementLink, 1)
        itsthere, _ = string.find(CurrentText, "%[%[.*%]%]")
    end --end of the while
 
    --Now put the proper brackets back.
    CurrentText = string.gsub(CurrentText, "STARTBRACKETS", "[[")
    CurrentText = string.gsub(CurrentText, "ENDBRACKETS", "]]")
 
    return CurrentText
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Inoltre su FANDOM

Wiki casuale