Template:Portal

被永久保护的模板
维基百科,自由的百科全书
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

用法

基本

{{Portal |Portal 1 |Portal 2 |Portal 3 |... }}

所有参数

{{Portal
 | Portal 1
 | Portal 2
 | Portal 3
 | ... 
 | left = <!-- yes -->
 | margin = <!-- CSS margin -->
 | break = <!-- yes -->
 | boxsize = <!-- custom box width in pixels -->
 | image1 = <!-- image override for Portal 1 -->
}}

兼容模式

中文维基百科旧portal模板的参数格式与Lua版本的多参数模式不尽相同。为保证兼容性,Lua模板中也增加了对这两种形式的支持。

name image

如果没有指定位置参数,则尝试将:

{{Portal|name=Portal 1|image=Image 1.png <!-- 可选 -->}}

解读为:

{{Portal|1=Portal 1|image1=Image 1.png <!-- 可选 -->}}

这一步骤并不会让模板运算变得十分复杂,因此基本无需修正到新格式。

2号位作图像

如果参数数量为2,且第二项按照文件名理解时扩展名长度为3或4,则尝试将:

{{Portal|Portal 1|Image 1.xyz}}

解读为:

{{Portal|1=Portal 1|image1=Image 1.xyz}}

为减少误报,模块会在扩展名不是常用图片格式(png、jpg、svg)时检查文件是否存在。检查步骤为“昂贵操作”,对服务器负担较重,因此请检查文档底部的追踪分类进行清理。

位置

在条目里面,本模板通常放置在条目底端的“参见”章节。

举例

Code Result
{{Portal|科学}}
{{Portal|1=科学|2=弹维基|image2=New-Bouncywikilogo.gif|3=默认图片}}

TemplateData

TemplateData
以下是该模板的模板数据,适用于可视化编辑器等工具。

Portal模板数据

A template to create a list of portals

模板参数[编辑模板数据]

参数描述类型状态
Portal (1)1

Inserts the portal image and text. Further portals can be added to the template by increasing the number

字符串必需
Portal (2)2

Insert the portal image and text

字符串可选
Portal (3)3

Insert the portal image and text

字符串可选
Sideleft

If set to yes, the portal appears on the left side of the page instead of the right.

默认值
no
字符串可选
Margin sizemargin

Alters the margin size. Any valid CSS margin is accepted

数字可选
Line breakbreak

If set to yes, a line break is inserted after the portal name and before the word portal

字符串可选
Box sizeboxsize

This sets a custom box width in pixels.

数字可选

图片

自动配图模块(取代Template:Portal/Images,请检查图像数据是否迁移完毕):

参见

重定向