模板: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,請檢查圖像數據是否遷移完畢):

參見

重定向