diff options
author | Andreas Gohr <andi@splitbrain.org> | 2007-01-23 09:38:54 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2007-01-23 09:38:54 +0100 |
commit | 2ea4044fe6adc821853ef4f360c95a6f97df0558 (patch) | |
tree | 13a95c4ec3e10f2e08b87044717bfc5d18e571e4 /inc/parser/renderer.php | |
parent | c327d6c4ca39da52e40a5bf854f4223f32f12196 (diff) | |
download | rpg-2ea4044fe6adc821853ef4f360c95a6f97df0558.tar.gz rpg-2ea4044fe6adc821853ef4f360c95a6f97df0558.tar.bz2 |
move title function to base renderer
darcs-hash:20070123083854-7ad00-b2a6723121ed82076a04c5956ecdbf22ec5aede7.gz
Diffstat (limited to 'inc/parser/renderer.php')
-rw-r--r-- | inc/parser/renderer.php | 32 |
1 files changed, 32 insertions, 0 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; + } + + } |