Fandom

Vocaloid Wiki

Module:Reciprocal link test

7,909pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

local export = {}
local replace = mw.ustring.gsub
local split = mw.text.split
local find = mw.ustring.find
local resolve_redirect = require("module:resolve redirect").show
 
 
local foobar = "title1 ?= ?"
 
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
-- Remember that the main copy of the code is not here!!!!
 
function export.show(frame)
	text = frame.args[1]
 
	text = replace(text, " ?<[Bb][Rr] ?%/?> ?", "\n") -- convert br to newline
	text = split(text, "\n")
	for i = 1, #text, 1 do
		if not find(text[i], "%[%[") then
			text[i] = "" -- dispose of lines that don't contain links
		else
			text[i] = replace(text[i], "%]%].+", "") -- remove stuff outside brackets (and the brackets too 'cos why not)
			text[i] = replace(text[i], ".+%[%[", "")
			text[i] = replace(text[i], "%|.+", "") -- remove stuff after pipes
			text[i] = replace(text[i], "%[%[", "") -- remove brackets
			text[i] = replace(text[i], "%]%]", "")
		end
	end
 
	output = ''
	song_page_title = mw.ustring.lower(mw.title.getCurrentTitle().text)
	song_page_title = replace(song_page_title, "([()*-.?%%])", "%%%1") -- escaping
	for i = 1, #text, 1 do
		local producer = text[i]
		if producer ~= "" and mw.title.new(producer).exists then
			page_content = mw.title.new(producer):getContent()
			page_content = resolve_redirect(page_content)
			page_content = replace(page_content, "_", " ")
			page_content = mw.ustring.lower(page_content)
			check = find(page_content, foobar .. song_page_title) or "failed"
			if check == "failed" then
				output = output .. '[[Category:Song pages not linked to from/' .. producer .. ']] '
			end
		end
	end
 
	return output
end
 
return export

Also on Fandom

Random Wiki