_plugins/macro-index/macro-index.rb
# Produce an HTML list of child pages.
# @param options [Hash]
# @option [Page, String] :of            (self) Starting point, either a Page or a path
# @option [Number] :depth               (1)    How deep?
# @option [Array<Page>] :no_recurse     ([self]) Do not recurse into these pages
# @option [Bool] :trailing_slash        (1)    Add trailing slashes after directory names whose contents were not listed
# @option [Bool] :ignore_settings_files (true) Do not list _settings.txt files
# @option [Array, Page, String] :ignore ([])   Do not list these pages.
Produce an HTML list of child pages.
Produce an HTML list of child pages .
def index_build_html(pages, options)
      html = "<ul class=\"index\">\n"
      pages.each do |page|
        html << "<li class=\""
        html << "active " if page.fullpath == self.fullpath
        html << (page.has_children? ? "directory" : "file")
        html << "\"><a href=\""
        html << page.link
        html << "\">"
        html << page['title']
        if page.has_children? && options[:no_recurse].none? {|n| n.same? page }
          if options[:depth] > 1
            html << "</a>"
            recurse_options = options.merge(:of => page, :depth => options[:depth]-1, :ignore => page)
            html << index(recurse_options)
          else
            html << "<span class=\"trailing_slash\">/</span>" if options[:trailing_slash]
            html << "</a>"
          end
        else
          html << "</a>"
        end
        html << "</li>\n"
      end
      html << "</ul>\n"
      html
    end
def index_build_html ( pages , options ) html = "<ul class=\"index\">\n" pages . each do | page | html << "<li class=\"" html << "active " if page . fullpath == self . fullpath html << ( page . has_children? ? "directory" : "file" ) html << "\"><a href=\"" html << page . link html << "\">" html << page [ 'title' ] if page . has_children? && options [ :no_recurse ] . none? { | n | n . same? page } if options [ :depth ] > 1 html << "</a>" recurse_options = options . merge ( :of => page , :depth => options [ :depth ] - 1 , :ignore => page ) html << index ( recurse_options ) else html << "<span class=\"trailing_slash\">/</span>" if options [ :trailing_slash ] html << "</a>" end else html << "</a>" end html << "</li>\n" end html << "</ul>\n" html end
Produce an HTML list of child pages.
Produce an HTML list of child pages .
pages
<not_specific>
options
<not_specific>
<not_specific>
None
<not_specific>
:ignore ([]) Do not list these pages.
: ignore ( [] ) Do not list these pages .