X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=_plugins%2Fmanual.rb;h=4b43cc63a7639f1e47320b6ab6526fb62df3051f;hb=8dda4023a5e675351ea43924f8e477af05eadccc;hp=cde76c4b94504bfac0cfc455511f768dfef01b63;hpb=ae6efdc4a0dd1825a30a1b95b70d6a5f799713a9;p=ardour-manual diff --git a/_plugins/manual.rb b/_plugins/manual.rb index cde76c4..4b43cc6 100644 --- a/_plugins/manual.rb +++ b/_plugins/manual.rb @@ -63,7 +63,7 @@ module Manual end block_given? ? block.call(h) : h - end + end.compact end def self.extract_data(filename) @@ -182,15 +182,19 @@ module Manual url_a = url.split('/').reject(&:empty?) + depth = url_a.length is_current, position, level = *process_hierarchy(current_a, url_a) + # this massively speeds up build time by not including the whole menu tree for each page + next if depth > 1 && current_a[0] != url_a[0] + css_classes = [] css_classes << 'active' if is_current css_classes << position.to_s if position css_classes << "#{position}-#{level}" if position && level css_classes << 'other' unless is_current || position || level - css_classes << "level-#{url_a.length}" + css_classes << "level-#{depth}" css_classes = css_classes.join(' ') if entry[:type] == 'directory' @@ -200,9 +204,11 @@ module Manual <%= entry[:menu_title] %>
-
- <%= entry[:children].join %> -
+ <% if entry[:children].any? %> +
+ <%= entry[:children].join %> +
+ <% end %>
HTML