make_pdf-jekyll 0.0.6 → 0.1.0
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/make_pdf/command_based.rb +3 -3
- data/lib/make_pdf/firefox.rb +2 -2
- data/lib/make_pdf/jekyll.rb +170 -97
- data/lib/make_pdf.rb +14 -63
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5415a398452c09f6ee1d7561494bb08ad0eba49ba4cb8e8f47ea84fd1ccc6a99
|
|
4
|
+
data.tar.gz: 1b507489b3352cdbf1bdae9f1874b1bd0009cb58be2c3bba859be9d5b6518365
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fc9327227686c526f29c96b6ac86fd0c1ad97a9120770c67c56a4721ab4d6ed69149864696ecaa69f53fe2ac177fc53fa2083c3345ef239bb1fc3488486d6fe
|
|
7
|
+
data.tar.gz: a5237d557f9605a594e323498c9e5e699ef5ddd0079d9ba5a3b6ebe8d01fda4cad0b55cec632d3220f74b98536ac3e2c99ccb4fb9cfeae772f5378bd3b47a895
|
|
@@ -33,20 +33,20 @@ module MakePDF
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def write(source_url, output_filename, **options)
|
|
36
|
-
logger.
|
|
36
|
+
logger.debug("converting #{source_url} with #{@command}")
|
|
37
37
|
arguments = make_arguments(
|
|
38
38
|
command: @command,
|
|
39
39
|
source_url:,
|
|
40
40
|
output_filename:,
|
|
41
41
|
**options
|
|
42
42
|
)
|
|
43
|
-
logger.
|
|
43
|
+
logger.verbose("Executing #{@command} #{arguments}")
|
|
44
44
|
std_out = IO.popen([@command] + arguments, {:err =>[ :child, :out]}) do |pipe|
|
|
45
45
|
pipe.read
|
|
46
46
|
end
|
|
47
47
|
status = $?
|
|
48
48
|
raise RuntimeError.new("Failure executing #{command} with #{arguments}.\n\noutput:\n\n---\n#{std_out}\n---\n") if status != 0
|
|
49
|
-
logger.
|
|
49
|
+
logger.verbose("pdf-writer: Wrote #{output_filename}")
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def output_for(file, output_base_path: ".", version: [], **options)
|
data/lib/make_pdf/firefox.rb
CHANGED
|
@@ -12,14 +12,14 @@ module MakePDF
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def initialize(options)
|
|
15
|
-
Processor.logger.
|
|
15
|
+
Processor.logger.debug('MakePDF firefox:', options)
|
|
16
16
|
@args = make_arguments(**options)
|
|
17
17
|
@driver_opts = Selenium::WebDriver::Firefox::Options.new(args: @opts)
|
|
18
18
|
setup
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def setup
|
|
22
|
-
Processor.logger.
|
|
22
|
+
Processor.logger.debug('MakePDF firefox: start driver')
|
|
23
23
|
@driver = Selenium::WebDriver.for :firefox, capabilities: @driver_opts
|
|
24
24
|
end
|
|
25
25
|
|
data/lib/make_pdf/jekyll.rb
CHANGED
|
@@ -1,13 +1,111 @@
|
|
|
1
1
|
require 'jekyll'
|
|
2
2
|
require 'make_pdf'
|
|
3
3
|
require 'path_of'
|
|
4
|
+
require 'digest'
|
|
5
|
+
require 'uri'
|
|
6
|
+
|
|
7
|
+
require_relative '../pdf_logger.rb'
|
|
4
8
|
|
|
5
9
|
module MakePDF
|
|
6
|
-
LOG_NAME =
|
|
10
|
+
LOG_NAME = 'make_pdf:'.freeze
|
|
11
|
+
|
|
12
|
+
# Site
|
|
13
|
+
#
|
|
14
|
+
# Responible for bridging the configurartions on Jekyll and setting up
|
|
15
|
+
# the conversion of PDFs
|
|
16
|
+
class MakePDFSite
|
|
17
|
+
include PathManip
|
|
18
|
+
attr_reader :options, :site, :logger, :file
|
|
19
|
+
|
|
20
|
+
def default_options
|
|
21
|
+
{
|
|
22
|
+
output_base_path: site.dest,
|
|
23
|
+
input_location: path_of(site.dest),
|
|
24
|
+
input_base_url: relative_path_of(site.baseurl[1..]),
|
|
25
|
+
input_host: URI(site.config['url']).host,
|
|
26
|
+
input_scheme: 'file'
|
|
27
|
+
}.freeze
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def make_options(options, *more_options)
|
|
31
|
+
return {} if options.nil?
|
|
32
|
+
|
|
33
|
+
[options, more_options].flatten
|
|
34
|
+
.reduce(:merge)
|
|
35
|
+
.transform_keys do |key|
|
|
36
|
+
key.to_s.sub('-', '_').to_sym
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def initialize(site, **options)
|
|
41
|
+
raise 'site is nil' if site.nil?
|
|
42
|
+
|
|
43
|
+
@site = site
|
|
44
|
+
config = site.config['make-pdf'] || {}
|
|
45
|
+
@logger = MakePDF::PdfLogger.new(logger: ::Jekyll.logger, level: config['log-map-level'].to_sym || :warn, name: LOG_NAME)
|
|
46
|
+
@options = default_options.merge(make_options(@site.config['make-pdf'], options))
|
|
47
|
+
@queue = []
|
|
48
|
+
@hashes = YAML::safe_load_file(metadata_file)
|
|
49
|
+
|
|
50
|
+
logger.verbose("Initialized with #{self.options}.")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def queue(processor)
|
|
54
|
+
@queue.push(processor)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def <<(doc)
|
|
58
|
+
processor = Processor.new(self, doc, **@options)
|
|
59
|
+
if processor.valid?
|
|
60
|
+
logger.debug("Adding #{processor.name} to queue")
|
|
61
|
+
queue(processor)
|
|
62
|
+
else
|
|
63
|
+
logger.verbose("Skip #{doc.name} => #{processor.reason}")
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def metadata
|
|
68
|
+
'make_pdf_hashes'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def metadata_dir
|
|
72
|
+
result = Pathname.new(site.config['data_dir'])
|
|
73
|
+
Dir.mkdir(result) unless Dir.exist?(result)
|
|
74
|
+
|
|
75
|
+
result
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def metadata_file
|
|
79
|
+
metadata_dir / Pathname.new("#{metadata}.yaml")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def save_hashes
|
|
83
|
+
logger.debug("Saving hash file : #{metadata_file}")
|
|
84
|
+
logger.verbose("Hashes: #{@hashes.to_yaml}")
|
|
85
|
+
File.open(metadata_file, 'w') do |file|
|
|
86
|
+
file.write(@hashes.to_yaml)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def process
|
|
91
|
+
@queue.each do |processor|
|
|
92
|
+
hash = processor.filehash
|
|
93
|
+
if hash != @hashes[processor.source.to_s]
|
|
94
|
+
processor.process(**@options)
|
|
95
|
+
@hashes[processor.source.to_s] = hash
|
|
96
|
+
else
|
|
97
|
+
processor.skip('Not changed')
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
save_hashes
|
|
101
|
+
end
|
|
102
|
+
end
|
|
7
103
|
|
|
8
104
|
# MakePDF Jekyll plugin
|
|
105
|
+
#
|
|
106
|
+
# Processor is the class that process a single document.
|
|
9
107
|
class Processor
|
|
10
|
-
attr_reader :reason, :doc, :name
|
|
108
|
+
attr_reader :reason, :doc, :name, :source, :file
|
|
11
109
|
|
|
12
110
|
def valid?
|
|
13
111
|
@reason.nil?
|
|
@@ -18,38 +116,50 @@ module MakePDF
|
|
|
18
116
|
condition
|
|
19
117
|
end
|
|
20
118
|
|
|
119
|
+
def enable(value)
|
|
120
|
+
possible = {
|
|
121
|
+
'' => true,
|
|
122
|
+
'true' => true,
|
|
123
|
+
'yes' => true,
|
|
124
|
+
'false' => false,
|
|
125
|
+
'no' => false
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
['make-pdf', possible[value.to_s.downcase]]
|
|
129
|
+
end
|
|
130
|
+
|
|
21
131
|
def filter_options(document, **options)
|
|
22
132
|
document.data.filter_map do |key, value|
|
|
23
133
|
key = key.to_s
|
|
24
|
-
if key ==
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"yes" => true,
|
|
29
|
-
"false" => false,
|
|
30
|
-
"no" => false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
[ key, possible[value.to_s.downcase] ]
|
|
34
|
-
else
|
|
35
|
-
[ key.sub("make-pdf-", "").to_sym, value ] if key.start_with?("make-pdf-")
|
|
134
|
+
if key == 'make-pdf'
|
|
135
|
+
enable(value)
|
|
136
|
+
elsif key.start_with?('make-pdf-')
|
|
137
|
+
[key.sub('make-pdf-', '').to_sym, value]
|
|
36
138
|
end
|
|
37
139
|
end.to_h.merge(options)
|
|
38
140
|
end
|
|
39
141
|
|
|
142
|
+
def skip(reason)
|
|
143
|
+
logger.info("Skipped #{@file} #{reason}")
|
|
144
|
+
end
|
|
145
|
+
|
|
40
146
|
def initialize(site, current_doc, **options)
|
|
41
|
-
@site
|
|
42
|
-
@file
|
|
43
|
-
@options
|
|
44
|
-
@name
|
|
147
|
+
@site = site
|
|
148
|
+
@file = current_doc.destination(@base_source)
|
|
149
|
+
@options = filter_options(current_doc, **options)
|
|
150
|
+
@name = current_doc.name
|
|
151
|
+
@source = current_doc.path
|
|
45
152
|
|
|
46
|
-
logger.debug("base_paths: input → #{@options[:input_base_url]}
|
|
153
|
+
logger.debug("base_paths: input → #{@options[:input_base_url]} " \
|
|
154
|
+
"output → #{@options[:output_base_path]} " \
|
|
155
|
+
"host → #{@options[:input_host]}")
|
|
47
156
|
|
|
48
157
|
current_options = make_options(@options, options, filter_options(current_doc))
|
|
158
|
+
current_options[:output_name] ||= Pathname.new(@name).sub_ext('.pdf')
|
|
49
159
|
|
|
50
160
|
logger.debug("options : #{current_options}")
|
|
51
161
|
|
|
52
|
-
return if check_failure(current_options[:disabled],
|
|
162
|
+
return if check_failure(current_options[:disabled], 'MakePDF disabled')
|
|
53
163
|
|
|
54
164
|
return if check_failure(File.extname(@file) != '.html', "#{@file} is not an html")
|
|
55
165
|
|
|
@@ -60,7 +170,7 @@ module MakePDF
|
|
|
60
170
|
writer = current_options[:writer] || site.options[:writer]
|
|
61
171
|
return if check_failure(writer.nil?, "No writer defined for #{current_doc.name} (#{writer})")
|
|
62
172
|
|
|
63
|
-
@writer = MakePDF.const_get(writer.capitalize).new(logger
|
|
173
|
+
@writer = MakePDF.const_get(writer.capitalize).new(logger: logger, **current_options)
|
|
64
174
|
@doc = current_doc
|
|
65
175
|
end
|
|
66
176
|
|
|
@@ -69,101 +179,64 @@ module MakePDF
|
|
|
69
179
|
end
|
|
70
180
|
|
|
71
181
|
def targets
|
|
72
|
-
@options[:targets] ||
|
|
182
|
+
@options[:targets] || ''
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def respond_to_missing?(method_name)
|
|
186
|
+
@options.include?(method_name) ||
|
|
187
|
+
(!@site.options.nil? && @site.options.include?(method_name)) ||
|
|
188
|
+
@site.respond_to?(method_name, false)
|
|
73
189
|
end
|
|
74
190
|
|
|
75
191
|
def method_missing(method_name, *args, **options)
|
|
76
192
|
if @options.include?(method_name)
|
|
77
|
-
|
|
78
|
-
elsif
|
|
79
|
-
|
|
193
|
+
@options[method_name]
|
|
194
|
+
elsif !@site.options.nil? && @site.options.include?(method_name)
|
|
195
|
+
@site.options[method_name]
|
|
80
196
|
elsif @site.respond_to?(method_name, false)
|
|
81
|
-
|
|
197
|
+
@site.send(method_name, *args, **options)
|
|
82
198
|
else
|
|
83
199
|
super
|
|
84
200
|
end
|
|
85
201
|
end
|
|
86
202
|
|
|
87
|
-
|
|
88
|
-
logger.debug("MakePDF rendering options #{options}")
|
|
203
|
+
private
|
|
89
204
|
|
|
90
|
-
|
|
205
|
+
def try(identification, count)
|
|
91
206
|
begin
|
|
92
|
-
|
|
93
|
-
@writer.process(@file, **options.merge(@options))
|
|
207
|
+
yield
|
|
94
208
|
rescue => error
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
logger.warn("
|
|
209
|
+
attempt += 1
|
|
210
|
+
message = "#{identification} attempt number #{attempt} failed with #{error}"
|
|
211
|
+
if attempted < count
|
|
212
|
+
logger.warn("#{message}, retrying")
|
|
99
213
|
retry
|
|
100
214
|
else
|
|
101
|
-
logger.
|
|
102
|
-
raise error
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def process(**options)
|
|
108
|
-
render_option(**options)
|
|
109
|
-
unless self.targets.nil?
|
|
110
|
-
self.targets.split(",").each do |option|
|
|
111
|
-
render_option(version: option.split(","), **options)
|
|
215
|
+
logger.error("#{message}.")
|
|
112
216
|
end
|
|
113
217
|
end
|
|
114
218
|
end
|
|
115
219
|
|
|
116
|
-
|
|
117
|
-
include PathManip
|
|
118
|
-
attr_reader :options, :site, :logger
|
|
119
|
-
|
|
120
|
-
def default_options
|
|
121
|
-
return {
|
|
122
|
-
output_base_path: site.source,
|
|
123
|
-
input_location: path_of(site.dest),
|
|
124
|
-
input_base_url: relative_path_of(site.baseurl[1..]),
|
|
125
|
-
input_host: site.config["url"].match(Regexp.new("^[^:]*://\([^/]+\)/?.*$"))[1],
|
|
126
|
-
input_scheme: "file"
|
|
127
|
-
}.freeze
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def make_options(options, *more_options)
|
|
131
|
-
return {} if options.nil?
|
|
220
|
+
public
|
|
132
221
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def initialize(site, **options)
|
|
141
|
-
config = site.config["make-pdf"]||{}
|
|
142
|
-
@logger = MakePDF::Logger.new(logger: ::Jekyll.logger, level: (config["log-map-level"] || :debug))
|
|
143
|
-
@site = site
|
|
144
|
-
@options = default_options.merge(make_options(@site.config["make-pdf"], options))
|
|
145
|
-
@queue = []
|
|
146
|
-
logger.debug("Initialized with #{self.options}.")
|
|
222
|
+
def render_option(**options)
|
|
223
|
+
logger.info("processing #{@file}")
|
|
224
|
+
logger.debug("MakePDF rendering options #{options}")
|
|
225
|
+
try("Process #{@file}", 3) do
|
|
226
|
+
@writer.process(@file, **options.merge(@options))
|
|
147
227
|
end
|
|
228
|
+
end
|
|
148
229
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
end
|
|
230
|
+
def filehash
|
|
231
|
+
return Digest::SHA256.file(@source).hexdigest
|
|
232
|
+
end
|
|
153
233
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
queue(processor)
|
|
158
|
-
else
|
|
159
|
-
logger.info("Skip #{doc.name} => #{processor.reason}")
|
|
160
|
-
end
|
|
161
|
-
end
|
|
234
|
+
def process(**options)
|
|
235
|
+
render_option(**options)
|
|
236
|
+
return if targets.nil?
|
|
162
237
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
processor.process(**@options)
|
|
166
|
-
end
|
|
238
|
+
targets.split(',').each do |option|
|
|
239
|
+
render_option(version: option.split(','), **options)
|
|
167
240
|
end
|
|
168
241
|
end
|
|
169
242
|
end
|
|
@@ -171,15 +244,15 @@ module MakePDF
|
|
|
171
244
|
::Jekyll.logger.info("Loaded #{MakePDF::LOG_NAME} plugin")
|
|
172
245
|
|
|
173
246
|
::Jekyll::Hooks.register [:site], :after_init do |site|
|
|
174
|
-
|
|
175
|
-
|
|
247
|
+
@pdf_site = MakePDF::MakePDFSite.new(site)
|
|
248
|
+
@pdf_site.logger.debug("site :after_init #{@pdf_site}")
|
|
176
249
|
end
|
|
177
250
|
|
|
178
251
|
::Jekyll::Hooks.register [:pages, :documents, :posts], :post_write do |doc|
|
|
179
|
-
|
|
252
|
+
@pdf_site << doc
|
|
180
253
|
end
|
|
181
254
|
|
|
182
|
-
::Jekyll::Hooks.register [:site], :post_write do
|
|
183
|
-
|
|
255
|
+
::Jekyll::Hooks.register [:site], :post_write do
|
|
256
|
+
@pdf_site.process
|
|
184
257
|
end
|
|
185
258
|
end
|
data/lib/make_pdf.rb
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
require 'path_of'
|
|
5
5
|
|
|
6
|
+
require_relative "./pdf_logger.rb"
|
|
7
|
+
|
|
6
8
|
module MakePDF
|
|
7
9
|
module PathManip
|
|
8
10
|
|
|
@@ -11,69 +13,16 @@ module MakePDF
|
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
|
|
14
|
-
class Logger
|
|
15
|
-
LEVELS = [ :debug, :info, :warn, :error ]
|
|
16
|
-
|
|
17
|
-
def level
|
|
18
|
-
@min_level || 0
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def initialize(logger: nil, level: :debug, verbose: false)
|
|
22
|
-
@logger = logger
|
|
23
|
-
@min_level = LEVELS.index(level) || 2
|
|
24
|
-
@verbose = verbose
|
|
25
|
-
write(:debug, "logging at least level #{LEVELS[@min_level].to_s} with #{logger}")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def write(level, *args)
|
|
29
|
-
print("#{level.to_s} : ", *args.map do |msg|
|
|
30
|
-
if (msg.size > 80)
|
|
31
|
-
msg[0..79] + "…"
|
|
32
|
-
else
|
|
33
|
-
msg
|
|
34
|
-
end
|
|
35
|
-
end.join("\n"), "\n")
|
|
36
|
-
return
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def verbose(*args)
|
|
40
|
-
if (@verbose)
|
|
41
|
-
@logger.send(LEVELS[self.level], LOG_NAME, *args)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def method_missing(method_name, *args, **options)
|
|
46
|
-
if @logger.nil? and LEVELS.include?(method_name)
|
|
47
|
-
return write(method_name, *args)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if accepts?(method_name)
|
|
51
|
-
@logger.send(LEVELS[[LEVELS.index(method_name), self.level].max], LOG_NAME, *args, **options)
|
|
52
|
-
else
|
|
53
|
-
super
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def accepts?(method_name)
|
|
58
|
-
LEVELS.include?(method_name) and @logger.respond_to?(method_name, false)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def respond_to_missing?(method_name, include_private = false)
|
|
62
|
-
accepts?(method_name) || super
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
16
|
class PDFWriter
|
|
67
17
|
include PathManip
|
|
68
18
|
attr_reader :output_dir, :source_url, :logger
|
|
69
19
|
|
|
70
|
-
def initialize(input_base_url:, output_base_path:, input_scheme: "file", input_host: nil, logger:
|
|
20
|
+
def initialize(input_base_url:, output_base_path:, output_name: nil, input_scheme: "file", input_host: nil, logger: PdfLogger.new(self.class.name) ,**options)
|
|
71
21
|
@logger = logger
|
|
72
22
|
raise ArgumentError.new("Scheme `#{input_scheme}` requires an `input_host`.") if input_scheme != "file" && input_host.nil?
|
|
73
|
-
@options = options.merge({ input_base_url:, output_base_path:, input_scheme:, input_host: })
|
|
74
|
-
|
|
23
|
+
@options = options.merge({ input_base_url:, output_base_path:, input_scheme:, input_host:, output_name: output_name || make_pdf_filename(input_base_url) })
|
|
75
24
|
end
|
|
76
|
-
|
|
25
|
+
|
|
77
26
|
def make_relative_file(file, input_location:, **options)
|
|
78
27
|
path_of(file).relative_path_from(path_of(input_location))
|
|
79
28
|
end
|
|
@@ -89,20 +38,22 @@ module MakePDF
|
|
|
89
38
|
end
|
|
90
39
|
end
|
|
91
40
|
|
|
92
|
-
def make_pdf_filename(file, output_base_path:, input_location:, output_dir:, **options)
|
|
93
|
-
base_path = path_of(output_base_path)
|
|
94
|
-
filepath = make_relative_file(file, input_location:)
|
|
95
|
-
result = base_path / relative_path_of(output_dir) / filepath
|
|
41
|
+
def make_pdf_filename(file, output_base_path:, input_location:, output_name:, output_dir:, **options)
|
|
42
|
+
base_path = path_of(output_base_path)
|
|
43
|
+
filepath = make_relative_file(path_of(file).dirname, input_location:)
|
|
44
|
+
result = base_path / relative_path_of(output_dir) / filepath / output_name
|
|
96
45
|
@logger.verbose("make_pdf_filename(#{file}, #{output_base_path}) → base_path: #{base_path}, filepath: #{filepath} ⇒ #{result}")
|
|
97
46
|
result
|
|
98
47
|
end
|
|
99
48
|
|
|
100
|
-
def make_output_filename(file, input_location:, output_base_path:, output_dir: ".", **options)
|
|
49
|
+
def make_output_filename(file, input_location:, output_base_path:, output_name:, output_dir: ".", **options)
|
|
101
50
|
@logger.verbose("make_output_filename(#{file}, #{input_location}, #{output_base_path})")
|
|
102
|
-
filename = make_pdf_filename(file, output_base_path:, output_dir:, input_location:, **options)
|
|
51
|
+
filename = make_pdf_filename(file, output_base_path:, output_dir:, output_name:, input_location:, **options)
|
|
103
52
|
output_base_path = path_of(output_base_path)
|
|
104
53
|
output = output_base_path / relative_path_of(output_dir) / filename
|
|
105
|
-
|
|
54
|
+
|
|
55
|
+
FileUtils::mkdir_p(output.dirname) unless (output.dirname.directory?)
|
|
56
|
+
|
|
106
57
|
@logger.debug("filename: #{filename} ⇒ #{output}")
|
|
107
58
|
output
|
|
108
59
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: make_pdf-jekyll
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Bogado da Silva Lins
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Allows that some documents, or pages to have a pdf version pre generated.
|
|
14
13
|
email: 'victor@bogado.net '
|
|
@@ -21,11 +20,10 @@ files:
|
|
|
21
20
|
- lib/make_pdf/command_based.rb
|
|
22
21
|
- lib/make_pdf/firefox.rb
|
|
23
22
|
- lib/make_pdf/jekyll.rb
|
|
24
|
-
homepage: https://
|
|
23
|
+
homepage: https://github.com/bogado/make_pdf-jekyll
|
|
25
24
|
licenses:
|
|
26
25
|
- MIT
|
|
27
26
|
metadata: {}
|
|
28
|
-
post_install_message:
|
|
29
27
|
rdoc_options: []
|
|
30
28
|
require_paths:
|
|
31
29
|
- lib
|
|
@@ -33,15 +31,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
33
31
|
requirements:
|
|
34
32
|
- - ">="
|
|
35
33
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
34
|
+
version: 4.0.0
|
|
37
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
36
|
requirements:
|
|
39
37
|
- - ">="
|
|
40
38
|
- !ruby/object:Gem::Version
|
|
41
39
|
version: '0'
|
|
42
40
|
requirements: []
|
|
43
|
-
rubygems_version:
|
|
44
|
-
signing_key:
|
|
41
|
+
rubygems_version: 4.0.19
|
|
45
42
|
specification_version: 4
|
|
46
43
|
summary: Create PDF along side of HTML files for site.
|
|
47
44
|
test_files: []
|