Skip to content

Commit c1181a7

Browse files
committed
Add pdf and context arguments to tag opening and closing
1 parent 4f992bd commit c1181a7

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

.rubocop.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ AllCops:
1616
NewCops: enable
1717

1818
Lint/UnusedMethodArgument:
19-
Exclude:
20-
- lib/prawn_html/utils.rb
19+
Enabled: false
2120

2221
Naming/FileName:
2322
Exclude:

lib/prawn_html/document_renderer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def render_if_needed(element)
9494
end
9595

9696
def apply_tag_close_styles(element)
97-
tag_styles = element.tag_closing
97+
tag_styles = element.tag_closing(pdf: pdf, context: context)
9898
@last_margin = tag_styles[:margin_bottom].to_f
9999
pdf.advance_cursor(last_margin + tag_styles[:padding_bottom].to_f)
100100
pdf.start_new_page if tag_styles[:break_after]
101101
end
102102

103103
def apply_tag_open_styles(element)
104-
tag_styles = element.tag_opening
104+
tag_styles = element.tag_opening(pdf: pdf, context: context)
105105
move_down = (tag_styles[:margin_top].to_f - last_margin) + tag_styles[:padding_top].to_f
106106
pdf.advance_cursor(move_down) if move_down > 0
107107
pdf.start_new_page if tag_styles[:break_before]

lib/prawn_html/tag.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ def process_styles(element_styles: nil)
5656
# Styles to apply on tag closing
5757
#
5858
# @return [Hash] hash of styles to apply
59-
def tag_closing
59+
def tag_closing(pdf: nil, context: nil)
6060
styles.slice(*Attributes::STYLES_APPLY[:tag_close])
6161
end
6262

6363
# Styles to apply on tag opening
6464
#
6565
# @return [Hash] hash of styles to apply
66-
def tag_opening
66+
def tag_opening(pdf: nil, context: nil)
6767
styles.slice(*Attributes::STYLES_APPLY[:tag_open])
6868
end
6969

0 commit comments

Comments
 (0)