MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: beta
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
Translate the NoUnwrap extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?Edit

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>



Download instructionsEdit

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 .


To install this extension, add the following to LocalSettings.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;