diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-10-15 01:34:46 -0700 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-10-15 01:34:46 -0700 |
commit | 51447840eb55520faba63598e83b24ac8f016501 (patch) | |
tree | 5333722ee3dd3d0616f8f06773094454365772e8 | |
parent | bc1ca93eaed5d2f593673cc7eee7b5d44bcdcd22 (diff) | |
parent | 9b3b9e8e02000edb4c6359d9ad50fbeeab0a4612 (diff) | |
download | rpg-51447840eb55520faba63598e83b24ac8f016501.tar.gz rpg-51447840eb55520faba63598e83b24ac8f016501.tar.bz2 |
Merge pull request #379 from splitbrain/infosyntaxmodetable
Put syntax modes in a table layout, sort numbers in rowspans.
-rw-r--r-- | lib/plugins/info/syntax.php | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index 5e7543603..5d969d7a2 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -48,7 +48,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Handle the match */ - function handle($match, $state, $pos, &$handler){ + function handle($match, $state, $pos, Doku_Handler &$handler){ $match = substr($match,7,-2); //strip ~~INFO: from start and ~~ from end return array(strtolower($match)); } @@ -56,7 +56,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Create output */ - function render($format, &$renderer, $data) { + function render($format, Doku_Renderer &$renderer, $data) { if($format == 'xhtml'){ //handle various info stuff switch ($data[0]){ @@ -112,7 +112,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { // remove subparts foreach($plugins as $p){ - if (!$po =& plugin_load($type,$p)) continue; + if (!$po = plugin_load($type,$p)) continue; list($name,$part) = explode('_',$p,2); $plginfo[$name] = $po->getInfo(); } @@ -146,7 +146,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { $plugins = plugin_list('helper'); foreach($plugins as $p){ - if (!$po =& plugin_load('helper',$p)) continue; + if (!$po = plugin_load('helper',$p)) continue; if (!method_exists($po, 'getMethods')) continue; $methods = $po->getMethods(); @@ -156,7 +156,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { $doc = '<h2><a name="'.$hid.'" id="'.$hid.'">'.hsc($info['name']).'</a></h2>'; $doc .= '<div class="level2">'; $doc .= '<p>'.strtr(hsc($info['desc']), array("\n"=>"<br />")).'</p>'; - $doc .= '<pre class="code">$'.$p." =& plugin_load('helper', '".$p."');</pre>"; + $doc .= '<pre class="code">$'.$p." = plugin_load('helper', '".$p."');</pre>"; $doc .= '</div>'; foreach ($methods as $method){ $title = '$'.$p.'->'.$method['name'].'()'; @@ -215,11 +215,36 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { */ function _syntaxmodes_xhtml(){ $modes = p_get_parsermodes(); + + $compactmodes = array(); + foreach($modes as $mode){ + $compactmodes[$mode['sort']][] = $mode['mode']; + } $doc = ''; + $doc .= '<div class="table"><table class="inline"><tbody>'; + + foreach($compactmodes as $sort => $modes){ + $rowspan = ''; + if(count($modes) > 1) { + $rowspan = ' rowspan="'.count($modes).'"'; + } - foreach ($modes as $mode){ - $doc .= $mode['mode'].' ('.$mode['sort'].'), '; + foreach($modes as $index => $mode) { + $doc .= '<tr>'; + $doc .= '<td class="leftalign">'; + $doc .= $mode; + $doc .= '</td>'; + + if($index === 0) { + $doc .= '<td class="rightalign" '.$rowspan.'>'; + $doc .= $sort; + $doc .= '</td>'; + } + $doc .= '</tr>'; + } } + + $doc .= '</tbody></table></div>'; return $doc; } |