Module:linkeach: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
for word in mw.ustring.gmatch(str, "(%S+)") do | for word in mw.ustring.gmatch(str, "(%S+)") do | ||
word = "[[ | word = "[[" .. mw.ustring.lower(word) .. "|" .. word .. "]]" | ||
table.insert(words, word) | table.insert(words, word) | ||
end | end |
Revision as of 15:51, 27 March 2021
- The following documentation is located at Module:linkeach/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
function export.link(frame)
local args = frame.args
local str = args[1]; local words = {}
local sep = args[2] or " "
for word in mw.ustring.gmatch(str, "(%S+)") do
word = "[[Contionary:" .. mw.ustring.lower(word) .. "|" .. word .. "]]"
table.insert(words, word)
end
return table.concat(words, sep)
end
function export.link_for_modules(str)
local words = {}
sep = sep or " "
for word in mw.ustring.gmatch(str, "(%S+)") do
word = "[[" .. mw.ustring.lower(word) .. "|" .. word .. "]]"
table.insert(words, word)
end
return table.concat(words, sep)
end
function export.exist(frame)
local args = frame.args
local str = args[1]; local words = {}
local sep = args[2] or " "
for word in mw.ustring.gmatch(str, "(%S+)") do
if mw.title.new(word, 'Contionary').exists == true then
word = "[[Contionary:" .. mw.ustring.lower(word) .. "|" .. word .. "]]"
table.insert(words, word)
else
table.insert(words, word)
end
end
return table.concat(words, sep)
end
return export