Skip to content

Commit

Permalink
fix(lint): rubocop linting
Browse files Browse the repository at this point in the history
  • Loading branch information
as-op committed Jun 10, 2024
1 parent 4300345 commit 52faae1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/md_to_pdf/elements/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ def data_inlinehtml_tag(tag, node, opts)
def data_image_style_opts(tag, _node, _opts)
result = {}
if tag.attr("style")
image_styles = tag.attr("style").split(';').map do |pair|
image_styles = tag.attr("style").split(';').to_h do |pair|
k, v = pair.split(':', 2)
[k, v]
end.to_h
end
if image_styles['width']
custom_max_width = parse_pt(image_styles['width'])
result[:custom_max_width] = custom_max_width unless custom_max_width.nil? || custom_max_width <= 0
Expand Down
4 changes: 2 additions & 2 deletions lib/md_to_pdf/utils/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def parse_pt(something)
end
end

def csspx2pt(px)
def csspx2pt(css_px)
# only css pixels are supported, not device pixels
# https://github.com/prawnpdf/prawn/pull/879
px * 0.75
css_px * 0.75
end

def number_unit(string)
Expand Down
7 changes: 3 additions & 4 deletions spec/pdf_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ def images
def out_images
puts "expect_pdf_images(#{images.to_s
.gsub('{:x=>', "\n{x:")
.gsub(':width=>', "width:")
.gsub(':height=>', "height:")
.gsub(':y=>', 'y:')
})"
.gsub(':width=>', 'width:')
.gsub(':height=>', 'height:')
.gsub(':y=>', 'y:')})"
end

def rectangles
Expand Down

0 comments on commit 52faae1

Please sign in to comment.