module Prawn::Markup::Processor::Lists
Attributes
list_stack[R]
Public Class Methods
prepended(base)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 6 def self.prepended(base) base.known_elements.push('ol', 'ul', 'li') end
Public Instance Methods
end_li()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 42 def end_li return unless current_list add_cell_text_node(current_list_item) end
end_list()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 29 def end_list list = list_stack.pop append_list(list) unless list.items.empty? end
start_img()
click to toggle source
Calls superclass method
# File lib/prawn/markup/processor/lists.rb, line 48 def start_img if current_list add_cell_image(current_list_item) else super end end
start_li()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 36 def start_li return unless current_list current_list.items << Elements::Item.new end
start_list(ordered)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 18 def start_list(ordered) if current_list add_cell_text_node(current_list_item) elsif current_table add_cell_text_node(current_cell) else add_current_text end @list_stack.push(Elements::List.new(ordered)) end
start_ol()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 10 def start_ol start_list(true) end
start_ul()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 14 def start_ul start_list(false) end
Private Instance Methods
add_list(list)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 91 def add_list(list) pdf.move_up(additional_cell_padding_top) draw_list(list) put_bottom_margin(text_margin_bottom + additional_cell_padding_top) rescue Prawn::Errors::CannotFit => e append_text(list_too_large_placeholder(e)) end
append_list(list)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 79 def append_list(list) if list_stack.empty? if current_table current_cell.nodes << list else add_list(list) end else current_list_item.nodes << list end end
current_list()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 65 def current_list list_stack.last end
current_list_item()
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 69 def current_list_item items = current_list.items items << Elements::Item.new if items.empty? items.last end
draw_list(list)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 99 def draw_list(list) Builders::ListBuilder.new(pdf, list, pdf.bounds.width, options).draw end
inside_container?()
click to toggle source
Calls superclass method
# File lib/prawn/markup/processor/lists.rb, line 75 def inside_container? super || current_list end
list_too_large_placeholder(error)
click to toggle source
# File lib/prawn/markup/processor/lists.rb, line 103 def list_too_large_placeholder(error) placeholder_value(%i[list placeholder too_large], error) || '[list content too large]' end
reset()
click to toggle source
Calls superclass method
# File lib/prawn/markup/processor/lists.rb, line 60 def reset @list_stack = [] super end