From 2ea4044fe6adc821853ef4f360c95a6f97df0558 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Tue, 23 Jan 2007 09:38:54 +0100 Subject: [PATCH] move title function to base renderer darcs-hash:20070123083854-7ad00-b2a6723121ed82076a04c5956ecdbf22ec5aede7.gz --- inc/parser/renderer.php | 32 ++++++++++++++++++++++++++++++++ inc/parser/xhtml.php | 27 --------------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index eca04cc2f..21d784276 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -220,6 +220,38 @@ class Doku_Renderer extends DokuWiki_Plugin { function tablecell_close(){} + + // util functions follow, you probably won't need to reimplement them + + + /** + * Removes any Namespace from the given name but keeps + * casing and special chars + * + * @author Andreas Gohr <andi@splitbrain.org> + */ + function _simpleTitle($name){ + global $conf; + + //if there is a hash we use the ancor name only + list($name,$hash) = explode('#',$name,2); + if($hash) return $hash; + + //trim colons of a namespace link + $name = rtrim($name,':'); + + if($conf['useslash']){ + $nssep = '[:;/]'; + }else{ + $nssep = '[:;]'; + } + $name = preg_replace('!.*'.$nssep.'!','',$name); + + if(!$name) return $this->_simpleTitle($conf['start']); + return $name; + } + + } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 088180eef..9a6ed7a91 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -928,33 +928,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { return $ret; } - /** - * Removes any Namespace from the given name but keeps - * casing and special chars - * - * @author Andreas Gohr <andi@splitbrain.org> - */ - function _simpleTitle($name){ - global $conf; - - //if there is a hash we use the ancor name only - list($name,$hash) = explode('#',$name,2); - if($hash) return $hash; - - //trim colons of a namespace link - $name = rtrim($name,':'); - - if($conf['useslash']){ - $nssep = '[:;/]'; - }else{ - $nssep = '[:;]'; - } - $name = preg_replace('!.*'.$nssep.'!','',$name); - - if(!$name) return $this->_simpleTitle($conf['start']); - return $name; - } - /** * Renders internal and external media * -- GitLab