Skip to content

Commit

Permalink
Merge pull request #183 from jcoglan/master
Browse files Browse the repository at this point in the history
Running under nginx+passenger throws an encoding error
  • Loading branch information
goncalossilva committed May 17, 2012
2 parents 52d064a + ae11f6a commit fa6af29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/showoff.rb
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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# ")
Expand Down

0 comments on commit fa6af29

Please sign in to comment.