Module:AlbWlxId

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Lua
CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules

Documentation for this module may be created at Module:AlbWlxId/doc

Code

local str = {}
 
function str.isCorrect(frame)
	id = frame.args[1]
    _, _, a, b, c = mw.ustring.find(id, "^(%d%d)-(%d%d%d)-(%d%d%d%d)$")

	if (a==nil) or (b==nil) or (c==nil) then
		return "<div style='color:red'>wrong Id:" .. id .. "</div> [[Category:Natural heritage sites in Albania with wrong IDs]]"
	else
		return "[http://tools.wmflabs.org/wle/?id="..id.." "..id.."]"
	end
end

function str.isCorrectWLM(frame)
	id = frame.args[1]
    _, _, a, b, c = mw.ustring.find(id, "^(%d%d)-(%d%d%d)-(%d%d%d%d)$")

	if (a==nil) or (b==nil) or (c==nil) then
		return "<div style='color:red'>wrong Id:" .. id .. "</div> [[Category:Cultural heritage monuments in Albania with incorrect IDs]]"
	else
		return "[http://tools.wmflabs.org/heritage/api/api.php?action=search&format=html&srcountry=ua&srlang=uk&srid="..id.."&props=image%7Cname%7Caddress%7Cmunicipality%7Clat%7Clon%7Cid%7Ccountry%7Csource%7Cmonument_article%7Cregistrant_url "..id.."]" 	end
end

return str