Class: PrawnHtml::Tags::Li
Constant Summary
collapse
- ELEMENTS =
[:li].freeze
- INDENT_OL =
-12
- INDENT_UL =
-6
PrawnHtml::Tag::CALLBACKS, PrawnHtml::Tag::TAG_CLASSES
Instance Attribute Summary
#attrs, #parent, #tag
Instance Method Summary
collapse
class_for, #initialize, #process_styles, #tag_close_styles, #tag_open_styles
Constructor Details
This class inherits a constructor from PrawnHtml::Tag
Instance Method Details
#before_content ⇒ Object
15
16
17
18
19
|
# File 'lib/prawn_html/tags/li.rb', line 15
def before_content
return if @before_content_once
@before_content_once = @counter ? "#{@counter}. " : "#{@symbol} "
end
|
#block? ⇒ Boolean
11
12
13
|
# File 'lib/prawn_html/tags/li.rb', line 11
def block?
true
end
|
#block_styles ⇒ Object
21
22
23
24
25
|
# File 'lib/prawn_html/tags/li.rb', line 21
def block_styles
super.tap do |bs|
bs[:indent_paragraphs] = @indent
end
end
|
#on_context_add(_context) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/prawn_html/tags/li.rb', line 27
def on_context_add(_context)
case parent.class.to_s
when 'PrawnHtml::Tags::Ol'
@indent = INDENT_OL
@counter = (parent.counter += 1)
when 'PrawnHtml::Tags::Ul'
@indent = INDENT_UL
@symbol = parent.styles[:list_style_type] || '•'
end
end
|