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

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

查看其他FANDOM

随机维基