diff --git a/_test/tests/inc/parser/renderer_xhtml.test.php b/_test/tests/inc/parser/renderer_xhtml.test.php index 295f04ee793ab52ea29643cd922893a20501eab1..ce519b6d5a851764aa69d9ca95532b3c5eac1d08 100644 --- a/_test/tests/inc/parser/renderer_xhtml.test.php +++ b/_test/tests/inc/parser/renderer_xhtml.test.php @@ -248,4 +248,20 @@ class renderer_xhtml_test extends DokuWikiTest { '; $this->assertEquals($expected, $this->R->doc); } + + public function test_blankHeader() { + $this->R->header('0', 1, 1); + $expected = '<h1 class="sectionedit1" id="section0">0</h1>'; + $this->assertEquals($expected, trim($this->R->doc)); + } + + public function test_blankTitleLink() { + global $conf; + $conf['useheading'] = 1; + saveWikiText('test','====== 0 ======', 'test'); + $this->R->internallink('test'); + + $expected = '<a href="/./doku.php?id=test" class="wikilink1" title="test">0</a>'; + $this->assertEquals($expected, trim($this->R->doc)); + } } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 72498182040f807495b83135b2783fd4b61eec82..ad0acf20113b151e318e0a746e0485c6d965cd76 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -191,7 +191,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function header($text, $level, $pos) { global $conf; - if(!$text) return; //skip empty headlines + if(blank($text)) return; //skip empty headlines $hid = $this->_headerToLink($text, true); @@ -1688,7 +1688,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } elseif(is_null($title) || trim($title) == '') { if(useHeading($linktype) && $id) { $heading = p_get_first_heading($id); - if($heading) { + if(!blank($heading)) { return $this->_xmlEntities($heading); } }