10,735
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 33: | Line 33: | ||
if mw.ustring.match(head, "%*[^%*%[%]]*%[[^%*%]]+%][^%*]*%*") then | if mw.ustring.match(head, "%*[^%*%[%]]*%[[^%*%]]+%][^%*]*%*") then | ||
for linker in mw.ustring.gmatch(head, "%*([^%*%[%]]*%[[^%*%[%]]+%][^%*]*)%*") do | for linker in mw.ustring.gmatch(head, "%*([^%*%[%]]*%[[^%*%[%]]+%][^%*]*)%*") do | ||
local | local with = mw.ustring.gsub(linker, "[%[%]]", "") | ||
local escaped = mw.ustring.gsub(linker, "([%[%]%*])", "% | local without = mw.ustring.gsub(linker, "%[[^%*%[%]]+%]", "") | ||
head = mw.ustring.gsub(head, "%*" .. escaped .. "%*", "*" .. | local escaped = mw.ustring.gsub(linker, "([%[%]%*])", "%%%1") | ||
mw.log(escaped) | |||
head = mw.ustring.gsub(head, "%*" .. escaped .. "%*", "*" .. with .. ":" .. without .. "*") | |||
end | end | ||
end | end -- *word[s]* → *words:word* | ||
head = mw.ustring.gsub(head, "%*([^%*:]+):([^%*:]+)%*", "[[%2#" .. data.language.name .. "|%1]]") -- *word:link* | head = mw.ustring.gsub(head, "%*([^%*:]+):([^%*:]+)%*", "[[%2#" .. data.language.name .. "|%1]]") -- *word:link* | ||
head = mw.ustring.gsub(head, "%*([^%*]+)%*", "[[%1#" .. data.language.name .. "|%1]]") -- *word* | head = mw.ustring.gsub(head, "%*([^%*]+)%*", "[[%1#" .. data.language.name .. "|%1]]") -- *word* |