libis-format 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libis/format/converter/pdf_selecter.rb +17 -11
- data/lib/libis/format/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f89add0e88c5d7a136475b303e5eec4da7af65ae6469ed24487e00c900871aa
|
4
|
+
data.tar.gz: '0902a88e237a8cf7a42f0ec0ea6aac4370590649aca894853a4f5de8b12dbb1e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90d3b575f8b87aca635d7b526d26ce8a899626b83950e66ed7df382b4e983cf93e3bab4526d5fdbdd268c94e158c99f9296858816f4f630a29d7a7ae89ea73e0
|
7
|
+
data.tar.gz: dfb7854cacec55c33fe6e01d3cc834eb3debe1657366c0247803b3227e84113f9f230e6809462c212c659388b576faeed038464752f959997d39a84aabe52858
|
@@ -26,13 +26,26 @@ module Libis
|
|
26
26
|
|
27
27
|
def initialize
|
28
28
|
super
|
29
|
-
@options[:
|
29
|
+
@options[:ranges] = []
|
30
30
|
end
|
31
31
|
|
32
32
|
# Select a partial list of pages
|
33
33
|
# @param [String] selection as described in com.itextpdf.text.pdf.SequenceList: [!][o][odd][e][even]start-end
|
34
34
|
def range(selection)
|
35
|
-
@options[:
|
35
|
+
@options[:ranges] += selection.split(/\s*,\s*/) unless selection.blank?
|
36
|
+
end
|
37
|
+
|
38
|
+
# Select a partial list of pages
|
39
|
+
# @param [String|Array<String>] selection as described in com.itextpdf.text.pdf.SequenceList: [!][o][odd][e][even]start-end
|
40
|
+
def ranges(selection)
|
41
|
+
case selection
|
42
|
+
when Array
|
43
|
+
@options[:ranges] += selection unless selection.empty?
|
44
|
+
when String
|
45
|
+
range(selection)
|
46
|
+
else
|
47
|
+
# nothing
|
48
|
+
end
|
36
49
|
end
|
37
50
|
|
38
51
|
def convert(source, target, format, opts = {})
|
@@ -52,15 +65,8 @@ module Libis
|
|
52
65
|
def convert_pdf(source, target)
|
53
66
|
|
54
67
|
using_temp(target) do |tmpname|
|
55
|
-
|
56
|
-
|
57
|
-
@options.map { |k, v|
|
58
|
-
if v.nil?
|
59
|
-
nil
|
60
|
-
else
|
61
|
-
["--#{k}", v]
|
62
|
-
end }.compact.flatten
|
63
|
-
)
|
68
|
+
opts = @options[:ranges].map { |range| ["-r", range] }.compact.flatten
|
69
|
+
result = Libis::Format::Tool::PdfSelect.run(source, tmpname, opts)
|
64
70
|
unless result[:err].empty?
|
65
71
|
error("Pdf selection encountered errors:\n%s", result[:err].join(join("\n")))
|
66
72
|
next nil
|
data/lib/libis/format/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|