Extension:NamespaceHTML

From Linux Web Expert

Revision as of 16:45, 15 March 2024 by imported>Pppery (Archival requested)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MediaWiki extensions manual
NamespaceHTML
Release status: unmaintained
Implementation Tag
Description Allows raw HTML in specified namespaces
Author(s) Ike Hecht (tosfostalk)
Latest version 0.4 ()
Compatibility policy For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension.
MediaWiki 1.35, 1.39
Database changes No
License GNU General Public License 2.0 or later
Download
$wgRawHtmlNamespaces
<html>
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the NamespaceHTML extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The NamespaceHTML extension allows raw HTML in specified namespaces. It is intended to work just like the $wgRawHtml setting. The difference is that this extension allows specifying which namespace(s) should be able to contain raw HTML, which allows administrators to restrict raw HTML to namespaces with sufficient edit protections.

This extension was created for WikiWorks.

Usage

Embed raw html within ‎<html>...‎</html> tags. See Manual:$wgRawHtml for more information.

As a template

The extension allows inclusion from namespaces where HTML is allowed to namespaces where HTML is not. You can create a custom script namespace and allow HTML in that namespace. Then you can create pages in the script namespace that contain safe scripts which can be transcluded into any page.

Technically, you can use the #tag parser function to pass parameters to the template. See here for an example. However, it is a better idea to use the Widgets extension for that.

Widget examples

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/NamespaceHTML</tvar>|Download]] and move the extracted <tvar name=name>NamespaceHTML</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/NamespaceHTML
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'NamespaceHTML' );
    
  • Configure as required.
  • File:OOjs UI icon lightbulb-yellow.svg <translate> Note:</translate> $wgRawHtmlNamespaces = []; must be configured, see below.
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Configuration

$wgRawHtmlNamespaces
List of the namespaces where raw HTML should be enabled. See this page for more information about namespace constants. For example:
# allow raw HTML but only in the Project: & User: namespaces
$wgRawHtmlNamespaces = [ NS_PROJECT, NS_USER ];

See also