Révision | 9efb23d18b6610efe09d72f5a9fb8989f06380e2 (tree) |
---|---|
l'heure | 2017-10-27 07:02:22 |
Auteur | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2283 Fasten ls2 plugin listing on no-title or no-include
@@ -145,15 +145,20 @@ function plugin_ls2_get_headings($page, & $params, $level, $include = FALSE) | ||
145 | 145 | |
146 | 146 | $anchor = PLUGIN_LS2_ANCHOR_ORIGIN; |
147 | 147 | $matches = array(); |
148 | + $is_title = $params['title']; | |
149 | + $is_include = $params['include']; | |
150 | + if (!$is_title && !$is_include) { | |
151 | + return; | |
152 | + } | |
148 | 153 | foreach (get_source($page) as $line) { |
149 | - if ($params['title'] && preg_match('/^(\*{1,3})/', $line, $matches)) { | |
154 | + if ($is_title && preg_match('/^(\*{1,3})/', $line, $matches)) { | |
150 | 155 | $id = make_heading($line); |
151 | 156 | $level = strlen($matches[1]); |
152 | 157 | $id = PLUGIN_LS2_ANCHOR_PREFIX . $anchor++; |
153 | 158 | plugin_ls2_list_push($params, $level + strlen($level)); |
154 | 159 | array_push($params['result'], |
155 | 160 | '<li><a href="' . $href . $id . '">' . $line . '</a>'); |
156 | - } else if ($params['include'] && | |
161 | + } else if ($is_include && | |
157 | 162 | preg_match('/^#include\((.+)\)/', $line, $matches) && |
158 | 163 | is_page($matches[1])) |
159 | 164 | { |