Skip to content

Commit

Permalink
Fixing up issues we discussed on the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LightGuard committed Mar 7, 2013
1 parent ba4eaf5 commit de30463
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions lib/awestruct/context_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@ def fully_qualify_urls(base_url, text)
img['src'] = fix_url( base_url, img['src'] )
end

# TODO: Double check if this is true with Nokogiri
# Hpricot::Doc#to_s output encoding is not necessarily the same as the encoding of text
if RUBY_VERSION.start_with? '1.8'
doc.to_xhtml
else
doc.to_xhtml.tap do |d|
d.force_encoding(text.encoding) if d.encoding != text.encoding
end
doc.to_s.tap do |d|
d.force_encoding(text.encoding) if d.encoding != text.encoding
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/awestruct/handlers/restructuredtext_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def rendered_content(context, with_layouts=true)
"--no-doc-title",
" --initial-header-level=#{hl}" ].join(' '),
content )
content = Nokogiri::HTML.fragment( doc ).at( '/html/body/div[@class="document"]' ).inner_html.strip
content = Nokogiri::HTML( doc ).at( '/html/body/div[@class="document"]' ).inner_html.strip
content = content.gsub( "\r", '' )
rescue => e
puts e
Expand Down

0 comments on commit de30463

Please sign in to comment.