Skip to content
Browse files

Merge pull request #183 from jcoglan/master

Running under nginx+passenger throws an encoding error
  • Loading branch information...
2 parents 52d064a + ae11f6a commit fa6af293b165157e4ca2ef44ccad0f6b8e64501f @goncalossilva goncalossilva committed May 17, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/showoff.rb
View
8 lib/showoff.rb
@@ -36,6 +36,7 @@ class ShowOff < Sinatra::Application
set :page_size, "Letter"
set :pres_template, nil
set :showoff_config, nil
+ set :encoding, nil
def initialize(app=nil)
super(app)
@@ -61,7 +62,8 @@ def initialize(app=nil)
showoff_json = JSON.parse(File.read(ShowOffUtils.presentation_config_file))
settings.showoff_config = showoff_json
- # Set options for template and page size
+ # Set options for encoding, template and page size
+ settings.encoding = showoff_json["encoding"]
settings.page_size = showoff_json["page-size"] || "Letter"
settings.pres_template = showoff_json["templates"]
end
@@ -145,6 +147,10 @@ def empty?
def process_markdown(name, content, static=false, pdf=false)
+ if settings.encoding and content.respond_to?(:force_encoding)
+ content.force_encoding(settings.encoding)
+ end
+
# if there are no !SLIDE markers, then make every H1 define a new slide
unless content =~ /^\<?!SLIDE/m
content = content.gsub(/^# /m, "<!SLIDE>\n# ")

0 comments on commit fa6af29

Please sign in to comment.
Something went wrong with that request. Please try again.