lib/softcover/builders/pdf.rb in softcover-1.0.2 vs lib/softcover/builders/pdf.rb in softcover-1.0.3
- old
+ new
@@ -92,17 +92,23 @@
end
# Returns the command to build the PDF (once).
def build_pdf(book_filename, options={})
tmp_filename = Softcover::Utils.tmpify(manifest, book_filename)
- "#{xelatex} #{tmp_filename} #{options[:filters]}"
+ if options[:nonstop] || options[:silent] || options[:quiet]
+ # Use nonstop to prevent LaTeX from hanging in quiet/silent mode.
+ nonstop = "--interaction=nonstopmode"
+ "#{xelatex} #{nonstop} #{tmp_filename} #{options[:filters]}"
+ else
+ "#{xelatex} #{tmp_filename} #{options[:filters]}"
+ end
end
# Returns the full command to build the PDF.
def pdf_cmd(book_filename, options={})
if options[:once]
- build_pdf(book_filename)
+ build_pdf(book_filename, options)
elsif options[:'find-overfull']
# The way we do things, code listings show up as "Overfull", but
# they're actually fine, so filter them out.
filter_out_listings = "grep -v 3.22281pt"
# Because each chapter typically lives in a separate file, it's
@@ -113,11 +119,11 @@
show_context = 'grep -A 3 "Overfull \\\\\\\\hbox"'
build_pdf(book_filename,
filters: "| #{filter_out_listings} | #{show_context}" )
else
# Run the command twice (to guarantee up-to-date cross-references).
- cmd = build_pdf(book_filename)
+ cmd = build_pdf(book_filename, options)
"#{cmd} ; #{cmd}"
end
end
# Returns the command to rename the temp PDF.
@@ -149,6 +155,6 @@
'..', 'template', softcover_sty)
FileUtils.cp source_sty, softcover_sty
end
end
end
-end
\ No newline at end of file
+end