diff --git a/_test/helper.test.php b/_test/helper.test.php index 939b652..b5bb87e 100644 --- a/_test/helper.test.php +++ b/_test/helper.test.php @@ -136,9 +136,12 @@ function testFormatData() { $this->assertEquals('value1, value2, val', $helper->_formatData(array('type' => ''), "value1\n value2\n val", $renderer)); - $this->assertEquals('link: page ', + $this->assertEquals('link: page page', $helper->_formatData(array('type' => 'page'), "page", $renderer)); + $this->assertEquals('link: page ', + $helper->_formatData(array('type' => 'title'), "page", $renderer)); + $this->assertEquals('link: page title', $helper->_formatData(array('type' => 'title'), "page|title", $renderer)); diff --git a/helper.php b/helper.php index 5d6c4e4..f2c48b1 100644 --- a/helper.php +++ b/helper.php @@ -143,6 +143,14 @@ function _cleanData($value, $type) { return trim($email . ' ' . $name); case 'page': + list($id, $title) = explode('|', $value, 2); + $id = cleanID($id); + if ($title !== null) { + $value = $id . "|" . $title; + } else { + $value = $id; + } + return $value; case 'nspage': return cleanID($value); default: @@ -230,11 +238,12 @@ function _formatData($column, $value, Doku_Renderer_xhtml $R) { $type = $type['type']; } switch($type) { - case 'page': - $val = $this->_addPrePostFixes($column['type'], $val); - $outs[] = $R->internallink($val, null, null, true); - break; case 'title': + list($id, $title) = explode('|', $val, 2); + $val = $this->_addPrePostFixes($column['type'], $id); + $outs[] = $R->internallink($val, $title, null, true); + break; + case 'page': case 'pageid': list($id, $title) = explode('|', $val, 2);