Skip to content
Snippets Groups Projects
Commit f515db7f authored by Andreas Gohr's avatar Andreas Gohr
Browse files

fix problems with header that look falsy. fixes #1770

parent d5c0422f
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
}
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment