Class: Docbook::Output::PipelineSteps::GenerateLists

Inherits:
Object
  • Object
show all
Defined in:
lib/docbook/output/pipeline_steps/generate_lists.rb

Overview

Step 7: Generate lists of figures, tables, and examples.

Instance Method Summary collapse

Instance Method Details

#call(guide, context) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/docbook/output/pipeline_steps/generate_lists.rb', line 8

def call(guide, context)
  numbering_hash = guide.dig("toc", "numbering") || {}
  list_of = Services::ListOfGenerator.new(context.parsed).generate(numbering: numbering_hash)
  list_of.each do |type, entries|
    guide["list_of_#{type}"] = entries.map do |e|
      {
        "id" => e.id,
        "title" => e.title,
        "number" => e.number,
        "section_id" => e.section_id,
        "section_title" => e.section_title,
      }.compact
    end
  end
  guide
end