模組:Portal/doc
这是Module:Portal的文档页面
![]() | 此模块的文档不存在、不全面或不能详细描述其功能及/或其代码中的参数。请帮助扩充并改进其文档。 |
![]() | 此模块文档已被保护。此为高度可见模块文档,其已用于大量条目或被频繁替换引用。由于破坏或失误会影响诸多页面,即便细小的改动也可能导致大量服务器负载,因此已被保护,不可编辑。 |
This module has two functions, portal
and image
. The portal
produces a box with links to a portal or to multiple portals, and is used by the {{portal}} template. It is most often used in the "See also" section of an article. The image
function produces the name of the image used by the specified portal.
Portal function
The portal function produces a box of portal links.
![]() | 此模块文档被引用於約773,000個頁面,佔全部頁面的10%。 為了避免造成大規模的影響,所有對此模块文档的編輯應先於沙盒或測試樣例上測試。 測試後無誤的版本可以一次性地加入此模块文档中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
![]() | 此模块使用Lua语言: |
用法
基本
{{#invoke:Portal|portal |Portal 1 |Portal 2 |Portal 3 |... }}
所有参数
{{#invoke:Portal|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 |
---|---|
{{#invoke:Portal|portal|科学}}
|
|
{{#invoke:Portal|portal|1=科学|2=弹维基|image2=New-Bouncywikilogo.gif|3=默认图片}}
|
TemplateData
TemplateData
| ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A template to create a list of portals
|
图片
自动配图模块(取代Template:Portal/Images,请检查图像数据是否迁移完毕):
- Module:Portal/images/letter,以字母开头
- Module:Portal/images/chinese,以汉字开头
- Module:Portal/images/other,以其他字符开头
- Module:Portal/images/aliases,文字別名,可用于地区词及英文转换
参见
- {{Portals}},该模板提供现有主题的一个列表。
- {{Portal bar}},该模板可一次性添加数个主题链接,并横向显示。
- {{Portal-inline}},该模板可添加一个不带边框的主题链接。
- 排错分类:
重定向
Image function
The image function produces the name of the image used by the specified portal.
Usage
{{#invoke:Portal|image|portal}}
Example
{{#invoke:Portal|image|Art}}
→ Portal-puzzle.svg
Image dupes function
The image dupes function returns a list of all images that are being used by more than one portal (aliases are not included). This can be helpful in identifying image entries that should be changed to use aliases.
Usage
{{#invoke:Portal|imageDupes}}
Display all function
The display all function returns a box containing all portals that have images. This is used for maintenance, and should not be displayed in articles, because a) there are around 1500 portals with images, and displaying 1500 images on one page takes up a lot of server resources, and b) the module has no way to know the correct capitalisation of a portal name, so some links to portals will be broken.
Usage
{{#invoke:Portal|displayAll}}