Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Portal-inline

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
Thismodule is rated asready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox testing rather than repeated trial-and-error editing.
Page template-protectedThis module is currentlyprotected from editing.
See theprotection policy andprotection log for more details. Please discuss any changes on thetalk page; you maysubmit an edit request to ask anadministrator to make an edit if it isuncontroversial or supported byconsensus. You may alsorequest that this page be unprotected.
WarningThis Lua module is used onapproximately 249,000 pages.
To avoid major disruption and server load, any changes should be tested in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
This module depends on the following other modules:

This module implementsTemplate:Portal-inline. This module accepts one unnamed parameter which is the portal to link to and several named parameters:

  • size— optional; Specify|size=small to show a 23x20 image or|size=tiny for a 17×15 image instead of the usual size.
  • text— optional; Specify|text=(name) for a different associated name to appear.
  • short— optional; Specify|short=anything to removeportal from the output.
  • redlinks— optional; Specify|redlinks=yes to show the portal if it is redlinked.
  • nowrap— optional; Specify|nowrap=yes to prevent the entire output from wrapping.
The abovedocumentation istranscluded fromModule:Portal-inline/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Subpages of this module.

-- determine whether we're being called from a sandboxlocalisSandbox=mw.getCurrentFrame():getTitle():find('sandbox',1,true)localsandbox=isSandboxand'/sandbox'or''localgetArgs=require('Module:Arguments').getArgslocalyesno=require('Module:Yesno')localportalModule=require('Module:Portal'..sandbox)localgetImageName=portalModule._imagelocalcheckPortals=portalModule._checkPortalslocalprocessPortalArgs=portalModule._processPortalArgslocalp={}-- 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)localfunctionformatError(errMsg,trackingCat)localresult=trackingCator''iferrMsgthenlocalerrTag=mw.html.create('span')errTag:addClass("error")errTag:css("font-size",'100%')errTag:wikitext("Error: "..errMsg)result=tostring(errTag)..resultendreturnresultendlocalfunctionimage(portal,args)localsize=args.size=="small"and"21x19px"orargs.size=="tiny"and"17x15px"or"32x28px"returnstring.format('[[File:%s|%s]]',getImageName(portal,true),size)endlocalfunctionlink(portal,args)localdisplayName=""ifnot(args.text==""orargs.text==nil)thendisplayName=args.textelseifargs.shortthendisplayName=portalelsedisplayName=portal.."&#32;portal"endreturnstring.format('[[Portal:%s|%s]]',portal,displayName)endfunctionp._main(portals,args)-- Normalize all argumentsifargs.redlinks=='include'thenargs.redlinks=trueendforkey,defaultinpairs({tracking=true,redlinks=false,short=false})doifargs[key]==nilthenargs[key]=defaultendargs[key]=yesno(args[key],default)endlocaltrackingCat=''localerrMsg=nil-- Check for existing categories, drop if not.-- Possible generate tracking category & error message if neededargs.minPortals=args.minPortalsor1args.maxPortals=args.maxPortalsor1portals,trackingCat,errMsg=checkPortals(portals,args)-- use more specific tracking cat for inline portaltrackingCat=mw.ustring.gsub(trackingCat,"Portal templates","Portal-inline template")-- either too many/few portals, or no portals left after filtering, then returniferrMsgor#portals==0thenreturnformatError(errMsg,trackingCat)endfstring='<span class="nowrap">%s </span>%s%s'ifyesno(args.nowrapor'')thenfstring='<span class="nowrap">%s %s%s</span>'endreturnmw.ustring.format(fstring,image(portals[1],args),link(portals[1],args),(trackingCator''))endfunctionp.main(frame)localorigArgs=getArgs(frame)localportals,args=processPortalArgs(origArgs)returnp._main(portals,args)endreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Portal-inline&oldid=1292011912"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp