Module:Reciprocal link test

local export = {} local replace = mw.ustring.gsub local split = mw.text.split local itersplit = mw.text.gsplit local find = mw.ustring.find

function export.reciprocal(frame) text = frame.args[1]

text = replace(text,"%[%[([^|<]+)%|([^|<]+)%]%]","%1") -- see module:song@utaulyrics.wikia text = replace(text,"%[%[([^|<]+)%]%]","%1") -- **** \n changed to < and wikilink brackets preserved text = replace(text,"%[([^| ]+) ([^|<]+)%]","%2") text = replace(text," %(([^)]+)%)","") -- don't need the stuff in the parentheses

text = replace(text,"%]%]([^[]+)","]]") -- get rid of everything outside wikilink brackets

text = replace(text,"%]%]%[%[","䶵") text = replace(text,"%[%[","") text = replace(text,"%]%]","")

output = '' song_page_title = mw.ustring.lower(mw.title.getCurrentTitle.text) song_page_title = replace(song_page_title,"([])","䶴%1") -- i have to escape parentheses... song_page_title = replace(song_page_title,"䶴","%") -- Lua error: invalid capture index %1 for producer in itersplit(text,"䶵") do		page_content = mw.title.new(producer):getContent page_content = replace(page_content,"_"," ") -- underscore to space page_content = mw.ustring.lower(page_content) check = find(page_content,song_page_title) or "failed" if check == "failed" then output = output .. ' '		end end

return output end

return export