Jump to content

Module:Portal-inline

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dreamy Jazz (talk | contribs) at 16:48, 6 January 2019 (start module). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local getImageName = require( 'Module:Portal' ).image

local p = {}

local function checkPortalExists(portal)
	return not (mw.title.makeTitle(100, portal).id == 0)
end

function p._main(portal)
	-- If no portals have been specified, display an error and add the page to a tracking category.
	if not portal then
		root:wikitext('<span style="font-size:100%;" class="error">error: missing portal name.</span></strong>[[Category:Portal templates without a parameter]]')
		return tostring(root)
	end
	
	if not pcall(checkPortalExists, portal) or not checkPortalExists(portal) then
		-- Getting here means a redlinked portal has been found
		if not ((args.redlinks == 'yes') or (args.redlinks == 'y') or (args.redlinks == 'true') or (args.redlinks == 'include')) then
			-- just return if redlinks is not "yes" or similar
			root:wikitext('[[Category:Portal templates all redlinked portals]]')
			return tostring(root)
		end
		root:wikitext('[[Category:Portal templates all redlinked portals]]')
	end
	
	-- display portal-inline content
	
end