Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Portal image banner

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 semi-protectedEditing of this module bynew orunregistered users is currentlydisabled.
See theprotection policy andprotection log for more details. If you cannot edit this module and you wish to make a change, you cansubmit an edit request, discuss changes on thetalk page,request unprotection,log in, orcreate an account.
This module depends on the following other modules:

This module implements{{Portal image banner}}; see documentation there for usage instructions. This module will not work when used directly (as {{#invoke:Portal image banner|main}}). Rather it is advisable that the main template Portal image banner is used.

See also

Portal templates
Layout and formatting
Content transclusion
Content slideshows
Content randomisation
General
Linking templates
Talk pages / Maintenance
Images
Modules
Usage
The abovedocumentation istranscluded fromModule:Portal image banner/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Subpages of this module.

localp={}localrandomModule=require('Module:Random')p.main=function(frame)localparent=frame.getParent(frame)localparentArgs=parent.argslocalargs=cleanupArgs(parentArgs)localoutput=p._main(args)returnframe:preprocess(output)endfunctioncleanupArgs(argsTable)localcleanArgs={}forkey,valinpairs(argsTable)doiftype(val)=='string'thenval=val:match('^%s*(.-)%s*$')ifval~=''thencleanArgs[key]=valendelsecleanArgs[key]=valendendreturncleanArgsendp._main=function(args)ifnotargs[1]thenreturnerror('No page specified',0)endlocallines=makeGalleryLinesTable(args)returnmakeOutput(lines,args.overflow,args.maxheight,args.mode,args.croptop)endfunctionmakeGalleryLine(file,caption,link)localtitle=mw.title.new(file,"File")locallinktext=(linkand'{{!}}link='..linkor'')localmaxImageWidth='{{!}}800px'return'[['..title.prefixedText..(captionand'{{!}}'..captionor'')..maxImageWidth..linktext..']]'..(captionand'\n<div style="text-align:center;">'..caption..'</div>'or'\n')endfunctionmakeGalleryLineSlideshow(file,caption)localtitle=mw.title.new(file,"File")localcaptiontext='[[File:OOjs_UI_icon_info-progressive.svg|link=:'..title.prefixedText..']]&nbsp;<span style="font-size:110%;">'..(captionor'')..'</span>'returntitle.prefixedText..'{{!}}'..captiontextendfunctionmakeGalleryLinesTable(args)localgalleryLinesTable={}locali=1whileargs[i]doifnotargs.modethentable.insert(galleryLinesTable,makeGalleryLine(args[i],args[i+1],args.link))elseifargs.mode=='slideshow'thentable.insert(galleryLinesTable,makeGalleryLineSlideshow(args[i],args[i+1],args.link))elseerror('Mode not supported')endi=i+2endreturngalleryLinesTableendfunctionmakeOutput(imageLines,overflow,maxHeight,mode,croptop)localrandomiseArgs={['t']=imageLines}localrandomisedLines=randomModule.main('array',randomiseArgs)localoutput,galleryContentifnotmodethengalleryContent=table.concat(randomisedLines,'\n',1,1)seperate=mw.text.split(galleryContent,'\n')output='<div class="portal-banner-image" style="max-height:'..(maxHeightor'initial')..'; overflow:'..(overflowor'auto')..';"><div class="portal-banner-image-crop" style="position:relative; margin-top:-'..(croptopor'0')..'%;">'..seperate[1]..'</div></div>'..seperate[2]elseifmode=='slideshow'thengalleryContent=table.concat(randomisedLines,'\n')output='<div class="portal-banner-image-slideshow nomobile" style="max-height:'..(maxHeightor'initial')..'; overflow:'..(overflowor'auto')..';"><div class="portal-banner-image-crop" style="position:relative; margin-top:-'..(croptopor'0')..'%;">'..'{{#tag:gallery|'..galleryContent..'|mode=slideshow}}'..'</div></div>'elseerror('Mode not supported')endreturnoutputendreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Portal_image_banner&oldid=1147890667"
Category:
Hidden category:

[8]ページ先頭

©2009-2026 Movatter.jp