Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running under nginx+passenger throws an encoding error #183

Merged
merged 3 commits into from May 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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