手册:创建包含预加载文本的页面

This page is a translated version of the page Manual:Creating pages with preloaded text and the translation is 70% complete.

预加载维基文本向用户显示部分创建的页面,其可能带有内容组织的内联说明,而不是空白页面。 当wiki包含一个或多个类别的文章,它们具有大量形式文本或需要为此类文章收集的信息是结构化数据和自由格式文本的混合时,此技术特别有用。

创建包含预加载文本的页面的过程分为三个步骤:

  1. 设计预加载文件及其支持模板
  2. 为预加载文件和支持模板创建页面
  3. 设置触发器以加载预加载文件

设计预加载文件

预加载文件通常是带有嵌入式模板的文章。 例如,如果您希望每个客户或市场营销联系人都有一篇文章,则可能需要预加载类似于以下示例的文本。

   <!-- 请在等号后输入客户的联系信息。
        如果您在上传名片图像时需要帮助,请参阅[[Help:Uploading business card images]]
   -->
   {{CustomerContact
   |Number=
   |BizcardImage=
   |Primary phone number=
   |Address=
   }}

命名和记录预加载文件

某些扩展对预加载文本的存储位置有特定的要求。 其他的则完全由系统管理员决定。

命名和记录预加载文件需要多加小心,因为预加载文件并不总是显示在“链入页面”中,因此存在意外删除的风险(无信息/无链接 - 很难从新建的和要移除的文章中分辨出来)。 对于基于模板的预加载文件,以下命名约定可能有助于避免意外删除:

  • place template in Template:CategoryName
  • place preload file in Template:CategoryName/Preload

加载预加载文件

Preloading can be done with a preload parameter in a URL like http://en.wikipedia.org/wiki/Talk:Main_Page?action=edit&section=new&preload=Template:Foo which links to the edit box of a new page, preloaded with Template:Foo. There are also a number of extensions available to trigger your preload file, see below.

The wikitext of the source page is preloaded into the editbox if the page or section does not exist yet. If the page or section to be edited already exists then only its wikitext is loaded, the preload command is ignored.

  • ‎<noinclude> and ‎</noinclude> tags are removed; if you need the preloaded text to provide noinclude tags, you can use
    <no<includeonly></includeonly>include>
    
    in your source: since the two middle tags will be stripped (see next), the preloaded text will end up with just the desired ‎<noinclude>.
  • The ‎<includeonly> and ‎</includeonly> tags are stripped from the source page. If you need the preloaded text to provide includeonly tags, you can use
    <include<includeonly></includeonly>only>
    
    in your source: since the two middle tags will be stripped, the preloaded text will end up with just the desired ‎<includeonly>.

Thus there is neither a complete inclusion nor a regular transclusion. See also 工單T7210 (since 2006-03-09).

If it is creating a new section, the initial content of the "Subject/headline" box can be provided with the parameter "preloadtitle"

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&section=new&preloadtitle=New_Header

If it is not creating a new section, the summary can be set with the summary parameter (工單T19002).

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&summary=Doing%20some%20changes

The minor edit checkbox can be set by adding minor parameter

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&minor=1

使用参数

MediaWiki版本:
1.23

You can also specify parameters to the preload text with the preloadparams[] url parameter (When linking on wiki, you may want to escape the [] to be %5b%5d.) Each parameter specified replaces a $1, $2, ... variable.

Note: $1, $2, ... variables are distinct from {{{1}}}, {{{2}}}, ... variables. In order to use preloadparams[], it appears to be necessary for the template to use $1, $2, ... variables instead of {{{1}}}, {{{2}}}, ... variables. This documentation should be improved by explaining why these two distinct template parameter notations exist, and when it is possible or necessary to use each of the two notations.

例如:

扩展

Extensions that trigger a preload file include:

A few extensions also handle all three steps for you:

All extensions related to page creation are in 分类:页面创建扩展 .


参见