模板:Portal/doc

維基教科書,自由的教學讀本

用法[編輯]

基本[編輯]

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

參見[編輯]