Class: Metanorma::Html::Component::IndexSection

Inherits:
Base
  • Object
show all
Defined in:
lib/metanorma/html/component/index_section.rb

Instance Attribute Summary

Attributes inherited from Base

#renderer

Instance Method Summary collapse

Methods inherited from Base

css_dependencies, #element_attrs, #escape_html, #extract_block_label, #extract_plain_text, #extract_text_value, handled_classes, handles, #initialize, js_dependencies, #output, register_in, #render_mixed_content_in_order, #render_mixed_inline, requires_css, requires_js, #safe_attr, #tag

Constructor Details

This class inherits a constructor from Metanorma::Html::Component::Base

Instance Method Details

#render(collector, **opts) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/metanorma/html/component/index_section.rb', line 7

def render(collector, **opts)
  return if collector.nil? || collector.empty?

  output << tag(:div, %( id="index" class="index-section" data-component="index")) do
    html = tag(:h2) { "Index" }
    html << render_quicknav(collector.sorted_groups)
    html << render_letter_groups(collector.sorted_groups)
    html
  end

  renderer.register_toc_entry(id: "index", level: 1, text: "Index")
end