diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-04-10 21:43:33 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-04-10 21:43:33 +0200 |
commit | bfd68419cf89a52facf2a029d191673643c3cf70 (patch) | |
tree | bd3d49a45eb62d09cb0627d12624c51cf575e581 /inc/parser/handler.php | |
parent | e1c10e4d58dad58f2a8b4b121b62bd56045bf852 (diff) | |
download | rpg-bfd68419cf89a52facf2a029d191673643c3cf70.tar.gz rpg-bfd68419cf89a52facf2a029d191673643c3cf70.tar.bz2 |
reverted method to determine the header level
darcs-hash:20060410194333-7ad00-abb8bc33f647ccd8587edbcc151bc60895dd3ae0.gz
Diffstat (limited to 'inc/parser/handler.php')
-rw-r--r-- | inc/parser/handler.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 2088942a1..0d0afa50b 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -85,9 +85,21 @@ class Doku_Handler { function header($match, $state, $pos) { $match = trim($match); - - list($header,$title) = split(' ',$match,2); - $level = 7 - strlen($header); + $levels = array( + '======'=>1, + '====='=>2, + '===='=>3, + '==='=>4, + '=='=>5, + ); + $hsplit = preg_split( '/(={2,})/u', $match,-1, + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + // Locate the level - default to level 1 if no match (title contains == signs) + if ( isset($hsplit[0]) && array_key_exists($hsplit[0], $levels) ) { + $level = $levels[$hsplit[0]]; + } else { + $level = 1; + } // Strip markers and whitespaces $title = trim($match,'='); @@ -1486,4 +1498,4 @@ class Doku_Handler_Block { } } -//Setup VIM: ex: et ts=4 enc=utf-8 :
\ No newline at end of file +//Setup VIM: ex: et ts=4 enc=utf-8 : |