Skip to content

Commit

Permalink
Fix PDF Options Bug
Browse files Browse the repository at this point in the history
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
grundprinzip committed Nov 21, 2011
1 parent 0657b2d commit 5709d39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/showoff.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def pdf(static=true)


# PDFKit.new takes the HTML and any options for wkhtmltopdf # PDFKit.new takes the HTML and any options for wkhtmltopdf
# run `wkhtmltopdf --extended-help` for a full list of options # 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 # Save the PDF to a file
file = kit.to_file('/tmp/preso.pdf') file = kit.to_file('/tmp/preso.pdf')
Expand Down
2 changes: 1 addition & 1 deletion lib/showoff_utils.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def self.get_config_option(dir, option, default = nil)
data = JSON.parse(File.read(index)) data = JSON.parse(File.read(index))
if data.is_a?(Hash) if data.is_a?(Hash)
if default.is_a?(Hash) if default.is_a?(Hash)
default.merge(data[option]) default.merge(data[option] || default)
else else
data[option] || default data[option] || default
end end
Expand Down

0 comments on commit 5709d39

Please sign in to comment.