![]() Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | text surrounded by <nounwrap></nounwrap> has its linefeeds left intact instead of unwrapping them into paragraphs |
Author(s) | (Justdavetalk) |
Latest version | 1.0 (2009-11-27) |
MediaWiki | 1.15 |
License | Public domain |
Download | No link |
Tags
nounwrap |
|
What can this extension do?
This extension adds a <nounwrap> tag that makes linefeeds within it get treated as linefeeds, while still performing all other wikitext processing. This is useful for copy/pasting large documents into a wiki page that need to be able to wordwrap or contain other wiki formatting without having to indent the entire thing or wrap it in <pre>
Usage
<nounwrap>
line1
line2
line3
</nounwrap>
Download instructions
Please cut and paste the code found below and place it in $IP/extensions/nounwrap.php
. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .
Installation
To install this extension, add the following to LocalSettings.php
:require_once("$IP/extensions/nounwrap.php");
Code
<?php
// MediaWiki nounwrap Extension Ver 1.0
// set up MediaWiki to react to the "<nounwrap>" tag
// created by David D. Miller
// released to the public domain 2009-Nov-27
$wgExtensionFunctions[] = 'efNoUnwrapSetup';
function efNoUnwrapSetup() {
global $wgParser;
$wgParser->setHook( "nounwrap", "RenderNoUnwrap" );
}
function RenderNoUnwrap( $input, $argv, &$parser ) {
// <nounwrap>
// line1
// line2
// </nounwrap>
// linebreaks will be replaced with <br> so they won't unwrap
// all other wikitext processing is still done.
$output = str_replace("\n", "<br>\n", $input);
$output = $parser->recursiveTagParse( $output );
return $output;
}
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.