Module: Prawn::Markup::Processor::Headings

Included in:
Prawn::Markup::Processor
Defined in:
lib/prawn/markup/processor/headings.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



6
7
8
# File 'lib/prawn/markup/processor/headings.rb', line 6

def self.prepended(base)
  base.known_elements.push('h1', 'h2', 'h3', 'h4', 'h5', 'h6')
end

Instance Method Details

#end_heading(level) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/prawn/markup/processor/headings.rb', line 31

def end_heading(level)
  options = heading_options(level)
  if current_table
    add_cell_text_node(current_cell, options)
  elsif current_list
    add_cell_text_node(current_list_item, options)
  else
    add_current_text(options)
    put_bottom_margin(options[:margin_bottom])
  end
end

#start_heading(level) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/prawn/markup/processor/headings.rb', line 20

def start_heading(level)
  if current_table
    add_cell_text_node(current_cell)
  elsif current_list
    add_cell_text_node(current_list_item)
  else
    add_current_text if buffered_text?
    pdf.move_down(current_heading_margin_top(level))
  end
end