For faster navigation, this Iframe is preloading the Wikiwand page for Modul:Portal-inline.

Modul:Portal-inline

Bu modul uchun Modul:Portal-inline/doc nomli hujjat sahifasini yaratishingiz mumkin

-- determine whether we're being called from a sandbox
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true)
local sandbox = isSandbox and '/sandbox' or ''

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local portalModule = require('Module:Portal'..sandbox)
local getImageName = portalModule._image
local checkPortals = portalModule._checkPortals
local processPortalArgs = portalModule._processPortalArgs

local p = {}

-- Function to format error message and tracking category
-- Arguments:
--   errMsg: string, or nil/false if no error
--   trackingCat: string for tracking category (or empty string)
local function formatError(errMsg, trackingCat)
	local result = trackingCat or ''
	if errMsg then
		local errTag = mw.html.create('span')
		errTag:addClass("error")
		errTag:css("font-size",'100%')
		errTag:wikitext("Error: "..errMsg)
		result = tostring(errTag)..result
	end
	return result
end

local function image(portal, args)
	local size = args.size == "tiny" and "16x16px" or "32x28px"
	return string.format('[[File:%s|class=noviewer|%s]]',getImageName(portal,true), size)
end

local function link(portal, args)
	local displayName = ""
	if not (args.text == "" or args.text == nil) then
		displayName = args.text
	elseif args.short then
		displayName = portal
	else
		displayName = portal .. " portal"
	end
	return string.format('[[Portal:%s|%s]]',portal,displayName)
end

function p._main(portals, args)
	mw.logObject(args)
	
	-- Normalize all arguments
	if args.redlinks == 'include' then args.redlinks = true end
	for key, default in pairs({tracking=true,redlinks=false,short=false}) do
		if args[key] == nil then args[key] = default end
		args[key] = yesno(args[key], default)
	end
	
	local trackingCat = ''
	local errMsg = nil
	
	-- Check for existing categories, drop if not. 
	-- Possible generate tracking category & error message if needed
	args.minPortals = args.minPortals or 1
	args.maxPortals = args.maxPortals or 1
	portals, trackingCat, errMsg = checkPortals(portals,args)
	-- use more specific tracking cat for inline portal
	trackingCat = mw.ustring.gsub(trackingCat,"Portal templates","Portal-inline template")
	-- either too many/few portals, or no portals left after filtering, then return
	if errMsg or #portals == 0 then
		return formatError(errMsg, trackingCat)
	end
	return image(portals[1],args)..' '..link(portals[1],args)..(trackingCat or '')
end

function p.main(frame)
	local origArgs = getArgs(frame)
	local portals, args = processPortalArgs(origArgs)
	return p._main(portals, args)
end

return p
{{bottomLinkPreText}} {{bottomLinkText}}
Modul:Portal-inline
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?