Anonymous user
Module:Delink: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Try parsing wikilinks and URLs on the same pass
(split the search algorithm out into its own function, add data type checks) |
(Try parsing wikilinks and URLs on the same pass) |
||
Line 115:
end
local function
▲ -- Iterate over the text string, and replace any matched text. using the
-- delink function. We need to iterate character by character rather
-- than just use gsub, otherwise nested links aren't detected properly.
local result = ""
while mw.ustring.len(
-- Replace text using one iteration of gsub.
-- Append the left-most character to the result string.
result = result .. mw.ustring.sub(
end
return result
▲ text = delinkLinkClass(text, "^%[.-%]", delinkURL) -- De-link URLs.
▲ text = mw.ustring.gsub(text, "%s+", " ") -- Remove extra whitespace.
end
Line 159 ⟶ 148:
args = frame
end
return _delink(args)
end
|