Jump to content

Module:Sandbox/Kephir: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
add page count
test strip marker
Line 5: Line 5:
do_it = function (frame)
do_it = function (frame)
local output = {}
local output = {}
for link in mw.text.unstrip(frame:preprocess("{{Special:PrefixIndex/User:Mr. Stradivarius}}")):gmatch([[<a href="/wiki/(.-)"]]) do
local strip_marker = frame:preprocess("{{Special:PrefixIndex/User:Mr. Stradivarius}}")
for link in mw.text.unstrip(strip_marker):gmatch([[<a href="/wiki/(.-)"]]) do
table.insert(output, "* [[" .. mw.uri.decode(link, "WIKI") .. "]]")
table.insert(output, "* [[" .. mw.uri.decode(link, "WIKI") .. "]]")
end
end
return #output .. " pages.\n" .. table.concat(output, "\n")
return #output .. " pages.\n" .. table.concat(output, "\n") ..
"\nstrip marker:<pre>" .. strip_marker:gsub("UNIQ", "&#x55;&#x4e;&#x59;&#x51;") .. "</pre>" ..
end
"strip marker contents:<pre>" .. mw.text.unstrip(strip_marker) .. "</pre>"
end,
}
}

Revision as of 08:10, 2 January 2014

-- [[User:Kephir]]'s Scribunto sandbox
-- do not expect anything to stay here in place

return {
	do_it = function (frame)
		local output = {}
		local strip_marker = frame:preprocess("{{Special:PrefixIndex/User:Mr. Stradivarius}}")
		for link in mw.text.unstrip(strip_marker):gmatch([[<a href="/wiki/(.-)"]]) do
			table.insert(output, "* [[" .. mw.uri.decode(link, "WIKI") .. "]]")
		end
		return #output .. " pages.\n" .. table.concat(output, "\n") ..
			"\nstrip marker:<pre>" .. strip_marker:gsub("UNIQ", "&#x55;&#x4e;&#x59;&#x51;") .. "</pre>" ..
			"strip marker contents:<pre>" .. mw.text.unstrip(strip_marker) .. "</pre>"
	end,
}