Permalink
Browse files

Fix PDF Options Bug

The pdf_options call in ShowOff::pdf was missing the working directory for the current presentation. Adding this call revealed a bug in get_config_options about non-existing keys.

* added settings.pres_dir to ShowOffUtils::showoff_pdf_options
* fixed default value bug in ShowOffUtils::get_config_option
  • Loading branch information...
1 parent 0657b2d commit 5709d39eddc66ecb4a768067cf699635ea120db7 @grundprinzip grundprinzip committed Nov 21, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/showoff.rb
  2. +1 −1 lib/showoff_utils.rb
View
2 lib/showoff.rb
@@ -382,7 +382,7 @@ def pdf(static=true)
# PDFKit.new takes the HTML and any options for wkhtmltopdf
# run `wkhtmltopdf --extended-help` for a full list of options
- kit = PDFKit.new(html, ShowOffUtils.showoff_pdf_options)
+ kit = PDFKit.new(html, ShowOffUtils.showoff_pdf_options(settings.pres_dir))
# Save the PDF to a file
file = kit.to_file('/tmp/preso.pdf')
View
2 lib/showoff_utils.rb
@@ -288,7 +288,7 @@ def self.get_config_option(dir, option, default = nil)
data = JSON.parse(File.read(index))
if data.is_a?(Hash)
if default.is_a?(Hash)
- default.merge(data[option])
+ default.merge(data[option] || default)
else
data[option] || default
end

0 comments on commit 5709d39

Please sign in to comment.