Class: Arrolio::Flowables::HeadingFlowable
- Inherits:
-
TextFlowable
- Object
- Arrolio::Flowable
- TextFlowable
- Arrolio::Flowables::HeadingFlowable
- Defined in:
- lib/arrolio/flowables/heading_flowable.rb
Overview
A section heading: optional number + title text. Lives separate from TextFlowable so the adapter and Engine can recognise headings by type (for outline / TOC building).
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from TextFlowable
Attributes inherited from Arrolio::Flowable
Instance Method Summary collapse
-
#initialize(title, level: 1, number: nil, id: nil, style: Style::Definition.new, measurer: nil) ⇒ HeadingFlowable
constructor
A new instance of HeadingFlowable.
Methods inherited from TextFlowable
#do_split, #emit, #height, #splittable?
Methods inherited from Arrolio::Flowable
#do_split, #emit, #height, #keep_together?, #keep_with_next?, #page_break_after?, #page_break_before?, #space_after, #space_before, #split, #splittable?
Constructor Details
#initialize(title, level: 1, number: nil, id: nil, style: Style::Definition.new, measurer: nil) ⇒ HeadingFlowable
Returns a new instance of HeadingFlowable.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/arrolio/flowables/heading_flowable.rb', line 11 def initialize(title, level: 1, number: nil, id: nil, style: Style::Definition.new, measurer: nil) full_text = number ? "#{number} #{title}" : title.to_s super([InlineRun.new(full_text, style: style)], style: style, measurer: measurer) @title = title @level = level.to_i @number = number @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/arrolio/flowables/heading_flowable.rb', line 9 def id @id end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
9 10 11 |
# File 'lib/arrolio/flowables/heading_flowable.rb', line 9 def level @level end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/arrolio/flowables/heading_flowable.rb', line 9 def number @number end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/arrolio/flowables/heading_flowable.rb', line 9 def title @title end |