@@ -21,8 +21,12 @@ discard block |
||
| 21 | 21 | * @author Ben Slusky <[email protected]> |
| 22 | 22 | * |
| 23 | 23 | */ |
| 24 | -if (!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); |
|
| 25 | -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
| 24 | +if (!defined('DOKU_INC')) { |
|
| 25 | + define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); |
|
| 26 | +} |
|
| 27 | +if (!defined('DOKU_PLUGIN')) { |
|
| 28 | + define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
| 29 | +} |
|
| 26 | 30 | require_once(DOKU_PLUGIN.'syntax.php'); |
| 27 | 31 | class syntax_plugin_yalist extends DokuWiki_Syntax_Plugin { |
| 28 | 32 | var $stack = array(); |
@@ -59,8 +63,9 @@ discard block |
||
| 59 | 63 | "${frame['list']}_open", |
| 60 | 64 | "${frame['item']}_open", |
| 61 | 65 | "${frame['item']}_content_open"); |
| 62 | - if ($frame['paras']) |
|
| 63 | - array_push($output, 'p_open'); |
|
| 66 | + if ($frame['paras']) { |
|
| 67 | + array_push($output, 'p_open'); |
|
| 68 | + } |
|
| 64 | 69 | array_push($this->stack, $frame); |
| 65 | 70 | break; |
| 66 | 71 | case DOKU_LEXER_EXIT: |
@@ -70,8 +75,9 @@ discard block |
||
| 70 | 75 | // close the content tag; for the rest it will have been |
| 71 | 76 | // closed already |
| 72 | 77 | if ($close_content) { |
| 73 | - if ($frame['paras']) |
|
| 74 | - array_push($output, 'p_close'); |
|
| 78 | + if ($frame['paras']) { |
|
| 79 | + array_push($output, 'p_close'); |
|
| 80 | + } |
|
| 75 | 81 | array_push($output, "${frame['item']}_content_close"); |
| 76 | 82 | $close_content = false; |
| 77 | 83 | } |
@@ -89,8 +95,9 @@ discard block |
||
| 89 | 95 | $close_content = true; |
| 90 | 96 | while ($para_depth < $last_frame['depth'] && count($this->stack) > 1) { |
| 91 | 97 | if ($close_content) { |
| 92 | - if ($last_frame['paras']) |
|
| 93 | - array_push($output, 'p_close'); |
|
| 98 | + if ($last_frame['paras']) { |
|
| 99 | + array_push($output, 'p_close'); |
|
| 100 | + } |
|
| 94 | 101 | array_push($output, "${last_frame['item']}_content_close"); |
| 95 | 102 | $close_content = false; |
| 96 | 103 | } |
@@ -101,13 +108,14 @@ discard block |
||
| 101 | 108 | $last_frame = end($this->stack); |
| 102 | 109 | } |
| 103 | 110 | if ($last_frame['paras']) { |
| 104 | - if ($close_content) |
|
| 105 | - // depth did not change |
|
| 111 | + if ($close_content) { |
|
| 112 | + // depth did not change |
|
| 106 | 113 | array_push($output, 'p_close', 'p_open'); |
| 107 | - else |
|
| 108 | - array_push($output, |
|
| 114 | + } else { |
|
| 115 | + array_push($output, |
|
| 109 | 116 | "${last_frame['item']}_content_open", |
| 110 | 117 | 'p_open'); |
| 118 | + } |
|
| 111 | 119 | } else { |
| 112 | 120 | // let's just pretend we didn't match... |
| 113 | 121 | $state = DOKU_LEXER_UNMATCHED; |
@@ -119,8 +127,9 @@ discard block |
||
| 119 | 127 | if ($curr_frame['depth'] > $last_frame['depth']) { |
| 120 | 128 | // going one level deeper |
| 121 | 129 | $level = $last_frame['level'] + 1; |
| 122 | - if ($last_frame['paras']) |
|
| 123 | - array_push($output, 'p_close'); |
|
| 130 | + if ($last_frame['paras']) { |
|
| 131 | + array_push($output, 'p_close'); |
|
| 132 | + } |
|
| 124 | 133 | array_push($output, |
| 125 | 134 | "${last_frame['item']}_content_close", |
| 126 | 135 | "${curr_frame['list']}_open"); |
@@ -136,8 +145,9 @@ discard block |
||
| 136 | 145 | // again, we need to close the content tag only for |
| 137 | 146 | // the first frame popped off the stack |
| 138 | 147 | if ($close_content) { |
| 139 | - if ($last_frame['paras']) |
|
| 140 | - array_push($output, 'p_close'); |
|
| 148 | + if ($last_frame['paras']) { |
|
| 149 | + array_push($output, 'p_close'); |
|
| 150 | + } |
|
| 141 | 151 | array_push($output, "${last_frame['item']}_content_close"); |
| 142 | 152 | $close_content = false; |
| 143 | 153 | } |
@@ -152,8 +162,9 @@ discard block |
||
| 152 | 162 | array_pop($this->stack); |
| 153 | 163 | $level = $last_frame['level']; |
| 154 | 164 | if ($close_content) { |
| 155 | - if ($last_frame['paras']) |
|
| 156 | - array_push($output, 'p_close'); |
|
| 165 | + if ($last_frame['paras']) { |
|
| 166 | + array_push($output, 'p_close'); |
|
| 167 | + } |
|
| 157 | 168 | array_push($output, "${last_frame['item']}_content_close"); |
| 158 | 169 | $close_content = false; |
| 159 | 170 | } |
@@ -169,8 +180,9 @@ discard block |
||
| 169 | 180 | array_push($output, |
| 170 | 181 | "${curr_frame['item']}_open", |
| 171 | 182 | "${curr_frame['item']}_content_open"); |
| 172 | - if ($curr_frame['paras']) |
|
| 173 | - array_push($output, 'p_open'); |
|
| 183 | + if ($curr_frame['paras']) { |
|
| 184 | + array_push($output, 'p_open'); |
|
| 185 | + } |
|
| 174 | 186 | $curr_frame['level'] = $level; |
| 175 | 187 | array_push($this->stack, $curr_frame); |
| 176 | 188 | break; |
@@ -196,8 +208,9 @@ discard block |
||
| 196 | 208 | ); |
| 197 | 209 | } |
| 198 | 210 | function render($mode, Doku_Renderer $renderer, $data) { |
| 199 | - if ($mode != 'xhtml' && $mode != 'latex') |
|
| 200 | - return false; |
|
| 211 | + if ($mode != 'xhtml' && $mode != 'latex') { |
|
| 212 | + return false; |
|
| 213 | + } |
|
| 201 | 214 | if ($data['state'] == DOKU_LEXER_UNMATCHED) { |
| 202 | 215 | $renderer->doc .= $renderer->_xmlEntities($data['output']); |
| 203 | 216 | return true; |
@@ -327,8 +340,9 @@ discard block |
||
| 327 | 340 | } |
| 328 | 341 | $renderer->doc .= $markup; |
| 329 | 342 | } |
| 330 | - if ($data['state'] == DOKU_LEXER_EXIT) |
|
| 331 | - $renderer->doc .= "\n"; |
|
| 343 | + if ($data['state'] == DOKU_LEXER_EXIT) { |
|
| 344 | + $renderer->doc .= "\n"; |
|
| 345 | + } |
|
| 332 | 346 | return true; |
| 333 | 347 | } |
| 334 | 348 | } |
| 335 | 349 | \ No newline at end of file |