Extension:UsenetSyntax

UsenetSyntax is a MediaWiki extension that enables Usenet style emphasis nomenclature such as *bold*, /italics/, and _underline_.


 * Source Code: UsenetSyntax.php
 * Licensing: UsenetSyntax is released under The MIT License.

Installation
require_once('extensions/ExtendedSyntaxParser.php'); require_once('extensions/UsenetSyntax.php');
 * 1) Download UsenetSyntax and ExtendedSyntaxParser, and be sure to rename the downloaded files to UsenetSyntax.php and ExtendedSyntaxParser respectively.
 * 2) Drop these scripts into $IP/extensions
 * Note: $IP is your MediaWiki install dir.
 * 1) Enable the extension by adding these lines to your LocalSettings.php:

Configuration (optional)

If you'd rather interpret the characters differently (for example, interpreting '_' as italics instead of '/'), you may do so in your LocalSettings.php.

To do this, simply override $wgUsenetSyntaxMappings after the require statement like so: require_once('extensions/UsenetSyntax.php'); $wgUsenetSyntaxMappings['_'] = 'italics';

- or -

require_once('extensions/UsenetSyntax.php'); $wgUsenetSyntaxMappings = array ( '*' => 'bold', '_' => 'italics' ); Note: The latter above will disable interpretation of '/' delimited strings altogether, whereas the former will still process them as italics.

Usage
Once installed, you (or editors of your wiki) may use Usenet syntax in any article.

Usenet syntax is not a formally defined markup language, but nevertheless is understood by many systems such as Mozilla Thunderbird.

An alternate version of Usenet syntax (where '/' is not recognized, and '_' signifies italics) is used in other systems such as Google Talk. See the installation section for details on how to use this alternate syntax.

Technical Details
To perform its magic, UsenetSyntax hooks into. For this reason, it's not a true parser extension in the common sense of the term since that title is typically reserved for tag extensions and function extensions.

Caveats and Gotchas
One consequence of hooking into the Parser as such a late stage is that the extension has no regard for &lt;nowiki&gt; blocks. For example: &lt;nowiki&gt; This block *contains bold* text &lt;/nowiki&gt; becomes: &lt;nowiki&gt; This block &lt;b&gt;contains bold&lt;/b&gt; text &lt;/nowiki&gt; This is despite the fact that standard MediaWiki syntax guarantees that any text inside &lt;nowiki&gt; tags will be immune to all markup interpretation.

As of version 0.1, the above also applies for preformatted text blocks (text wrapped in &lt;pre&gt;</tt> tags). This is, however, not a constraint of the hooking mechanism, but rather an unimplemented feature - in the interest of keeping the source code simple.

Further, this extension has not been thoroughly tested, and using it may break some pages in other ways. If you run into page-breakage issues, please feel free to report them on the talk page.

Developer Notes
For the record, I do not support integrating this syntax into the vanilla MediaWiki parser. The standard syntax already has convenient markup for   bold  ,   italicized   and &lt;u&gt;underlined&lt;/u&gt; text.

Additionally, I do not intend to make this extension significantly more robust by correcting for all items listed under Caveats and Gotchas.

--Jim R. Wilson (Jimbojw) 16:09, 21 February 2007 (UTC)