Class: Docbook::Services::NumberingService
- Inherits:
-
Object
- Object
- Docbook::Services::NumberingService
- Includes:
- ElementIdHelper
- Defined in:
- lib/docbook/services/numbering_service.rb
Overview
Pre-computes section numbering for the document Handles: Roman numerals for Parts, Arabic for Chapters, Hierarchical for Sections, Alpha for Appendices Auto-numbering for Figures, Examples, Tables
Instance Method Summary collapse
-
#generate ⇒ Array<Models::SectionNumber>
Pre-compute section numbering for the document.
-
#initialize(document) ⇒ NumberingService
constructor
A new instance of NumberingService.
Methods included from ElementIdHelper
#element_id, #refentry_id, #resolve_refentry_title
Constructor Details
#initialize(document) ⇒ NumberingService
Returns a new instance of NumberingService.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/docbook/services/numbering_service.rb', line 13 def initialize(document) @document = document @numbering = [] @part_counter = 0 @chapter_counters = {} @appendix_counter = 0 @section_counters = {} @figure_counters = {} @example_counters = {} @table_counters = {} end |
Instance Method Details
#generate ⇒ Array<Models::SectionNumber>
Pre-compute section numbering for the document.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/docbook/services/numbering_service.rb', line 27 def generate @numbering = [] @part_counter = 0 @chapter_counters = {} @appendix_counter = 0 @section_counters = {} @figure_counters = {} @example_counters = {} @table_counters = {} process_document(@document) @numbering end |