16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/bookwatch/preprocessing/dita_pdf_preprocessor.rb', line 16
def preprocess(sections, output_locations, options: {}, output_streams: nil, **_)
sections.each do |section|
command = command_creator.convert_to_pdf_command(
section,
dita_flags: options[:dita_flags],
write_to: output_locations.pdf_from_preprocessing_dir
)
status = sheller.run_command(command, output_streams.to_h)
if status.success?
pdf_path = most_recent_pdf(output_locations.pdf_from_preprocessing_dir)
pdf_destination = output_locations.pdf_artifact_dir.join(section.pdf_output_filename)
fs.copy_and_rename(pdf_path, pdf_destination)
else
raise DitaToPDFLibraryFailure.new 'The DITA-to-PDF conversion failed. ' +
'Please check that you have specified the path to your DITA-OT library in the ENV, ' +
'that your DITA-specific keys/values in config.yml are set, ' +
'and that your DITA toolkit is correctly configured.'
end
end
end
|