[go: nahoru, domu]

Jump to content

Extension:TemplateSandbox: Difference between revisions

From mediawiki.org
Content deleted Content added
adding < translate > sections (partial)
adding < translate > sections (completed)
Line 50: Line 50:


The extension adds a new special page, <tvar|spe>[[Special:TemplateSandbox]]</>.</translate> <translate>To preview a page using sandboxed templates, do the following:</translate>
The extension adds a new special page, <tvar|spe>[[Special:TemplateSandbox]]</>.</translate> <translate>To preview a page using sandboxed templates, do the following:</translate>
# Copy the templates to be tested under a common prefix. For example, you might copy <code>Template:Foo</code> to <code>User:Example/sandbox/Template:Foo</code>. Alternatively, you might create <code>User:Example/sandbox/Template:Foo</code> as a redirect to <code>Template:Foo/sandbox</code>.
# <translate>Copy the templates to be tested under a common prefix. For example, you might copy <tvar|foo><code>Template:Foo</code></> to <tvar|sb><code>User:Example/sandbox/Template:Foo</code></>.</translate> <translate>Alternatively, you might create <tvar|red><code>User:Example/sandbox/Template:Foo</code></> as a redirect to <tvar|onto><code>Template:Foo/sandbox</code></>.</translate>
# 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 [[:en:search path|prefix search path]]) by separating them using vertical bars, e.g. <code>User:Example/sandbox1|User:Example/sandbox2</code>.
# <translate>Go to <tvar|sb>[[Special:TemplateSandbox]]</>.</translate> <translate>Fill in the page or revision to be rendered, and the prefix you chose in step 1.</translate> <translate>It is possible to specify multiple prefixes (a [[:en:search path|prefix search path]]) by separating them using vertical bars, e.g. <tvar|1><code>User:Example/sandbox1|User:Example/sandbox2</code></>.</translate>
# Click '''View'''.
# <translate>Click '''View'''.


The extension also adds a box at the bottom of the edit form for pages in the namespaces configured in <code>$wgTemplateSandboxEditNamespaces</code>. 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 extension also adds a box at the bottom of the edit form for pages in the namespaces configured in <tvar|1><code>$wgTemplateSandboxEditNamespaces</code></>.</translate> <translate>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.


<translate>
== See also == <!--T:5-->
== See also == <!--T:5-->
</translate>
</translate>
* {{ll|Help:ExpandTemplates}}
* {{ll|Help:ExpandTemplates}}
* {{ll|Extension:SandboxLink}}
* {{ll|Extension:SandboxLink}}
* {{ll|Extension:Scribunto}} − This extension also allows for sandboxing Scribunto modules.
* {{ll|Extension:Scribunto}} − <translate>This extension also allows for sandboxing Scribunto modules.</translate>


{{OnWikimedia}}
{{OnWikimedia}}

Revision as of 18:26, 3 April 2020

This is technical documentation of the extension. There is also a user documentation.
MediaWiki extensions manual
TemplateSandbox
Release status: stable
Implementation Special page , Page action
Description Preview pages using sandboxed templates
Author(s) Brad Jorsch (Anomietalk)
Latest version 1.1.0 (2014-03-29)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.21+
PHP 5.5+
Database changes No
License GNU General Public License 2.0 or later
Download
Help Help:Extension:TemplateSandbox
  • $wgTemplateSandboxEditNamespaces
Quarterly downloads 39 (Ranked 90th)
Public wikis using 1,040 (Ranked 233rd)
Translate the TemplateSandbox extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

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.

Installation

  • Download and move the extracted TemplateSandbox folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateSandbox
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'TemplateSandbox' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

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.

Usage

The extension adds a new special page, Special:TemplateSandbox. To preview a page using sandboxed templates, do the following:

  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. 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.
  3. 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.

See also