Class: Docbook::Services::ListOfGenerator
- Inherits:
-
Object
- Object
- Docbook::Services::ListOfGenerator
- Defined in:
- lib/docbook/services/list_of_generator.rb
Overview
Generates lists of figures, tables, and examples with section context.
Defined Under Namespace
Classes: Entry
Constant Summary collapse
- TYPES =
{ figures: [Elements::Figure, Elements::InformalFigure], tables: [Elements::Table, Elements::InformalTable], examples: [Elements::Example, Elements::InformalExample], }.freeze
Instance Method Summary collapse
- #generate(numbering: {}) ⇒ Hash{Symbol => Array<Entry>}
-
#initialize(document) ⇒ ListOfGenerator
constructor
A new instance of ListOfGenerator.
Constructor Details
#initialize(document) ⇒ ListOfGenerator
Returns a new instance of ListOfGenerator.
17 18 19 |
# File 'lib/docbook/services/list_of_generator.rb', line 17 def initialize(document) @document = document end |
Instance Method Details
#generate(numbering: {}) ⇒ Hash{Symbol => Array<Entry>}
23 24 25 26 27 28 29 30 31 |
# File 'lib/docbook/services/list_of_generator.rb', line 23 def generate(numbering: {}) result = {} TYPES.each do |type_name, element_types| entries = [] collect(@document, entries, element_types, numbering) result[type_name] = entries if entries.any? end result end |