Skip to content

Commit

Permalink
setting to external_encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
komagata committed Oct 17, 2011
1 parent d563abd commit cb73a66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app.rb
Expand Up @@ -10,6 +10,8 @@
require 'hpricot'
require 'nkf'

Encoding.default_external = 'utf-8'

class App < Sinatra::Base
configure do
use Rack::Session::Cookie
Expand All @@ -19,7 +21,6 @@ class App < Sinatra::Base
set :haml, {:attr_wrapper => '"', :ugly => false}
set :sass, {:style => :expanded}
set :raise_errors, true

register Sinatra::R18n
end

Expand Down Expand Up @@ -78,6 +79,6 @@ class App < Sinatra::Base
def html2haml(html)
html5 = (doctype = Hpricot(html).children.detect{ |e| e.doctype? }) ? doctype.public_id.nil? : false
haml = Haml::HTML.new(html.gsub(/\t/, ' ')).render
Haml::Engine.new(haml, :attr_wrapper => '"', :format => html5 ? :html5 : :xhtml ).render
Haml::Engine.new(haml, :attr_wrapper => '"', :format => html5 ? :html5 : :xhtml).render
end
end
2 changes: 1 addition & 1 deletion haml_ext.rb
Expand Up @@ -23,7 +23,7 @@ def to_haml_filter(filter, tabs, options)
else
CGI.unescapeHTML(self.innerText)
end

content = erb_to_interpolation(content, options)
content.gsub!(/\A\s*\n(\s*)/, '\1')
original_indent = content[/\A(\s*)/, 1]
Expand Down

0 comments on commit cb73a66

Please sign in to comment.