Extension:模板沙盒
- 这是这个扩展的技术文档。 There is also a user documentation.
![]() 發佈狀態: 穩定版本 |
|
---|---|
![]() |
|
实现 | 特殊页面 , 页面操作 |
描述 | Preview pages using sandboxed templates |
作者 | Brad Jorsch (Anomie讨论) |
最新版本 | 1.1.0 (continuous updates) |
兼容性政策 | 快照跟随MediaWiki发布。 master分支不向後兼容。 |
MediaWiki | 1.35+ |
PHP | 7.0+ |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
|
|
季度下載量 | 70 (Ranked 105th) |
公開的wiki使用 | 1,213 (Ranked 194th) |
翻譯TemplateSandbox的扩展,若在translatewiki.net可用 | |
問題 | 尚未完成的工作 · 报告錯誤 |
TemplateSandbox 扩展增加了使用沙盒版本模板预览页面的能力,允许在沙盒代码上线之前轻松测试。 它也适用于 Scribunto 模块。
安裝
- 下载文件,并将其放置在您
extensions/
文件夹中的TemplateSandbox
目录内。 - 将下列代码放置在您的
LocalSettings.php
的底部:wfLoadExtension( 'TemplateSandbox' );
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
致使用MediaWiki 1.24或更早版本的用户:
上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()
。
如果您需要在早期版本(MediaWiki 1.24和更早版本)中安装此扩展,而不是wfLoadExtension( 'TemplateSandbox' );
,您需要使用:
require_once "$IP/extensions/TemplateSandbox/TemplateSandbox.php";
配置
- 參數
$wgTemplateSandboxEditNamespaces
- Namespaces in which to show the "Preview page with this template" box below the edit form. 默认為NS_TEMPLATE
。 Can be expanded to all namespaces by individual users using advancedtemplatesandbox.js.
用法
此扩展会添加一个新的特殊页面:Special:TemplateSandbox To preview a page using sandboxed templates, do the following:
- Copy the templates to be tested under a common prefix. For example, you might copy
Template:Foo
toUser:Example/sandbox/Template:Foo
. Alternatively, you might createUser:Example/sandbox/Template:Foo
as a redirect toTemplate:Foo/sandbox
. - Go to Special:TemplateSandbox. Fill in the page or revision to be rendered, and the prefix you chose in step 1. It is possible to specify multiple prefixes (a prefix search path) by separating them using vertical bars, e.g.
User:Example/sandbox1|User:Example/sandbox2
. - 点击查看。
The extension also adds a box at the bottom of the edit form for pages in the namespaces configured in $wgTemplateSandboxEditNamespaces
.
This allows for previewing some other page as it would appear were the template being edited saved with the current contents of the edit form.
The box can be forced to appear in the edit form for any page by adding the query parameter wpTemplateSandboxShow
to the URL.
參見
- User:Jackmcbarn/advancedtemplatesandbox.js — A MediaWiki user script that enables use of TemplateSandbox for all pages.
- Help:展開模板
- Extension:SandboxLink
- Extension:Scribunto − This extension also allows for sandboxing Scribunto modules.
此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
这个扩展包含在以下包和/或维基农场: 这不是一个权威的名单。一些维基农场/主机可能包含这个extension,即使它们没有在这里列出。经常检查您的维基农场/主机或包来确认。 |