kramdown-converter-pdf 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +4 -1
- data/VERSION +1 -1
- data/lib/kramdown/converter/pdf.rb +17 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 795b834db4f9d6e8676470caa1f154256c59377f3fc281a268dfd37cae5915a8
|
4
|
+
data.tar.gz: 2cc6e84a09d6ad9b8c69471ab18c4f514410f202a16e14efbf54359f4a034aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a4dc3134d73739e56beb0aac7a6863448df1da6b8e272ca43dd1f1808fe66733d9c16550b220cbe88ffaa8b071c9ecff4503c228cefa5cef436b91d53e2ad81
|
7
|
+
data.tar.gz: 690bb84edae8de0108053b8f53f17bda2f9cb5ef83a68219d72ba2845ae97df934e7043a3ead6620a0d79b97a5026803acf64b28d18a9e3fe57d4ec96c892614
|
data/CONTRIBUTERS
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
Count Name
|
2
2
|
======= ====
|
3
|
-
|
3
|
+
12 Thomas Leitner <t_leitner@gmx.at>
|
4
|
+
2 Matthew Dodds <matthew.dodds@powerhrg.com>
|
5
|
+
1 Matthew Russell Dodds <matthewrusselldodds@gmail.com>
|
6
|
+
1 Kelly <kellyeryan@gmail.com>
|
4
7
|
1 Carlos Palhares <chjunior@gmail.com>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
@@ -43,7 +43,7 @@ module Kramdown
|
|
43
43
|
#
|
44
44
|
class Pdf < Base
|
45
45
|
|
46
|
-
VERSION = '1.0.
|
46
|
+
VERSION = '1.0.6'
|
47
47
|
|
48
48
|
include Prawn::Measurements
|
49
49
|
|
@@ -155,14 +155,22 @@ module Kramdown
|
|
155
155
|
img_dirs = @options.fetch(:image_directories, []) + ["."]
|
156
156
|
path_or_url = img.attr["src"]
|
157
157
|
begin
|
158
|
-
image_obj, image_info = @pdf.build_image_object(
|
158
|
+
image_obj, image_info = @pdf.build_image_object(open_file(path_or_url))
|
159
159
|
rescue StandardError
|
160
160
|
raise if img_dirs.empty?
|
161
161
|
path_or_url = File.join(img_dirs.shift, img.attr["src"])
|
162
162
|
retry
|
163
163
|
end
|
164
164
|
|
165
|
-
options = {
|
165
|
+
options = {}
|
166
|
+
if img.attr['class'] =~ /\balign\-left\b/
|
167
|
+
options[:position] = :left
|
168
|
+
elsif img.attr['class'] =~ /\balign\-right\b/
|
169
|
+
options[:position] = :right
|
170
|
+
else
|
171
|
+
options[:position] = :center
|
172
|
+
end
|
173
|
+
|
166
174
|
if img.attr['height'] && img.attr['height'] =~ /px$/
|
167
175
|
options[:height] = img.attr['height'].to_i / (@options[:image_dpi] || 150.0) * 72
|
168
176
|
elsif img.attr['width'] && img.attr['width'] =~ /px$/
|
@@ -437,6 +445,12 @@ module Kramdown
|
|
437
445
|
alias render_raw render_footnote
|
438
446
|
alias render_html_element render_footnote
|
439
447
|
|
448
|
+
def open_file(path_or_url)
|
449
|
+
URI.parse(path_or_url).open
|
450
|
+
rescue URI::InvalidURIError
|
451
|
+
open(path_or_url)
|
452
|
+
end
|
453
|
+
|
440
454
|
# ----------------------------
|
441
455
|
# :section: Organizational methods
|
442
456
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-converter-pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.2.2
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email: t_leitner@gmx.at
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
@@ -67,7 +67,7 @@ homepage: https://github.com/kramdown/converter-pdf
|
|
67
67
|
licenses:
|
68
68
|
- MIT
|
69
69
|
metadata: {}
|
70
|
-
post_install_message:
|
70
|
+
post_install_message:
|
71
71
|
rdoc_options: []
|
72
72
|
require_paths:
|
73
73
|
- lib
|
@@ -82,8 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
86
|
-
signing_key:
|
85
|
+
rubygems_version: 3.4.10
|
86
|
+
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: kramdown-converter-pdf uses Prawn to convert a kramdown document to PDF
|
89
89
|
test_files: []
|