Module:WikiLink

require('Module:StrManip')

local p = {}

function p.main(strArg) local str = mw.getCurrentFrame.args[1] mw.logObject(str) local table = strSplit(str,",\n") mw.logObject(table)

local res = "" for i,ind in ipairs(table) do       local customLink = ind:match("%{.*%}") local wikiTerm = ind:match("%[.*%]") local indSub = ind:gsub("&#8203;", "") :gsub("&shy;", "") :gsub("&#8288;", "") :gsub("­","") :gsub(" - -","") :gsub(" - -","") :gsub(" -%(.*%) -","") local wikiString = " ".. ind .." " if (wikiTerm ~= nil) then mw.logObject("wikiterm: " .. wikiTerm) --indTemp = wikiTerm:gsub("[%[%]]","") --ind = ind:gsub(" ?%[.*%] ?","") wikiString = "wikipedia:".. wikiTerm:gsub("[%[%","") .."| ".. ind:gsub(" ?%[.*%] ?","") .." ]]" elseif (customLink ~= nil) then mw.logObject("customLink: " .. customLink) ind = ind:gsub(" ?%{.*%} ?",""):gsub(" ?%[.*%] ?","") wikiString = " [".. customLink:gsub("[%{%}]","") .." ".. ind:gsub("[%[%]]","") .." ] " end mw.logObject("wikistring: "..wikiString) if (i > 1) then res = res .. ", "       end res = res .. wikiString end mw.logObject("res: "..res) return res end

return p