Extension:模板沙盒

From mediawiki.org
This page is a translated version of the page Extension:TemplateSandbox and the translation is 73% complete.
这是这个扩展的技术文档。 也是用户文档
MediaWiki扩展手册
TemplateSandbox
发行状态: 稳定版
实现 特殊页面 , 页面操作
描述 使用沙盒模板预览页面
作者 Brad Jorsch (Anomie讨论)
最新版本 1.1.0 (continuous updates)
兼容性政策 快照跟随MediaWiki发布。 master分支不向后兼容。
MediaWiki 1.35+
PHP 7.0+
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
帮助 Help:Extension:TemplateSandbox/zh
  • $wgTemplateSandboxEditNamespaces
季度下載量 51 (Ranked 100th)
正在使用的公开wiki数 1,040 (Ranked 233rd)
前往translatewiki.net翻譯TemplateSandbox扩展
問題 开启的任务 · 报告错误

TemplateSandbox 扩展增加了使用沙盒版本模板预览页面的能力,允许在沙盒代码上线之前轻松测试。 它也适用于 Scribunto 模块。

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的TemplateSandbox目录内。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateSandbox
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'TemplateSandbox' );
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。


配置

参数
  • $wgTemplateSandboxEditNamespaces - 要在编辑表单下方显示“使用此模板预览页面”框的命名空间。 默认为NS_TEMPLATE。 单个用户可以使用advancedtemplatesandbox.js拓展到所有命名空间。

用法

此扩展会添加一个新的特殊页面:Special:TemplateSandbox 要使用沙盒模板预览页面,请执行以下操作:

  1. Copy the templates to be tested under a common prefix. For example, you might copy Template:Foo to User:Example/sandbox/Template:Foo. Alternatively, you might create User:Example/sandbox/Template:Foo as a redirect to Template:Foo/sandbox.
  2. 前往Special:TemplateSandboxFill 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.
  3. 点击查看

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.

参见