Extension:TemplateSandbox/zh
- This is technical documentation of the extension. There is also a user documentation.
TemplateSandbox 发布状态: 稳定版 |
|
---|---|
![]() |
|
实现 | 特殊页面 , 页面操作 |
描述 | Preview pages using sandboxed templates |
作者 | Brad Jorsch (Anomie讨论) |
最新版本 | 1.1.0 (continuous updates) |
兼容性方针 | Snapshots releases along with MediaWiki. Master is not backwards compatible. |
MediaWiki | 1.33+ |
PHP | 7.0+ |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下载 | |
|
|
翻譯TemplateSandbox擴充功能如在translatewiki.net可用 | |
问题 | 尚未完成的工作 · 回報錯誤 |
The TemplateSandbox extension adds the ability to preview a page using sandboxed versions of templates, allowing for easy testing before making the sandbox code live. It also works with Scribunto modules.
安装
- 下载文件,并将其放置在您
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";
配置
- Parameters
$wgTemplateSandboxEditNamespaces
- Namespaces in which to show the "Preview page with this template" box below the edit form.NS_TEMPLATE
by default. Can be expanded to all namespaces by individual users using advancedtemplatesandbox.js.
用法
The extension adds a new special page, 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
. - Click View.
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.
参见
- Help:展開模板
- Extension:SandboxLink
- 扩展:Scribunto − This extension also allows for sandboxing Scribunto modules.
此扩展被用于一个或多个维基媒体项目上。 这可能意味着扩展稳定且工作良好,足以用在同等高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中寻找此扩展名称以查看安装它的网站。 详细的已安装扩展的完整列表可在wiki的Special:Version页面找到。 |