From d43aac1c8c239fb7f4ca8d0cb9bf03dc1d6cd958 Mon Sep 17 00:00:00 2001 From: Gina Haeussge <gina@foosel.net> Date: Sat, 26 Jun 2010 15:58:14 +0200 Subject: [PATCH] FS#1915: strip one leading and one trailing newline from code content if available --- inc/parser/xhtml.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index c8862eece..c5a8b8218 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -442,6 +442,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= '</a></dt>'.DOKU_LF.'<dd>'; } + if ($text{0} == "\n") { + $text = substr($text, 1); + } + if (substr($text, -1) == "\n") { + $text = substr($text, 0, -1); + } + if ( is_null($language) ) { $this->doc .= '<pre class="'.$type.'">'.$this->_xmlEntities($text).'</pre>'.DOKU_LF; } else { -- GitLab