lib/softcover/builders/pdf.rb in softcover-0.9.5 vs lib/softcover/builders/pdf.rb in softcover-0.9.6
- old
+ new
@@ -9,12 +9,12 @@
if manifest.markdown?
# Build the HTML to produce PolyTeX as a side-effect,
# then update the manifest to reduce PDF generation
# to a previously solved problem.
Softcover::Builders::Html.new.build!
- self.manifest = Softcover::BookManifest.new(source: :polytex,
- origin: :markdown)
+ opts = options.merge({ source: :polytex, origin: :markdown})
+ self.manifest = Softcover::BookManifest.new(opts)
end
write_master_latex_file(manifest)
# Build the PolyTeX filename so it accepts both 'foo' and 'foo.tex'.
@@ -58,11 +58,11 @@
silence { options[:preview] ? system(cmd) : execute(cmd) }
end
elsif options[:'find-overfull']
silence_stream(STDERR) { execute(cmd) }
else
- options[:preview] ? system(cmd) : execute(cmd)
+ execute(cmd)
end
end
private
@@ -124,10 +124,11 @@
# The purpose is to match the original filename.
# For example, foo_bar.tex should produce foo_bar.pdf.
# While we're at it, we move it to the standard ebooks/ directory.
def rename_pdf(basename, options={})
tmp_pdf = basename + '.tmp.pdf'
- pdf = basename + '.pdf'
+ name = options[:preview] ? basename + '-preview' : basename
+ pdf = name + '.pdf'
mkdir('ebooks')
# Remove the intermediate tmp files unless only running once.
rm_tmp = keep_tmp_files?(options) ? "" : "&& rm -f *.tmp.*"
"mv -f #{tmp_pdf} #{File.join('ebooks', pdf)} #{rm_tmp}"
end
\ No newline at end of file