diff --git a/lib/awestruct/context_helper.rb b/lib/awestruct/context_helper.rb index bf3c6eb6..9c42acc0 100644 --- a/lib/awestruct/context_helper.rb +++ b/lib/awestruct/context_helper.rb @@ -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 diff --git a/lib/awestruct/handlers/restructuredtext_handler.rb b/lib/awestruct/handlers/restructuredtext_handler.rb index 1d3c1ec1..df52c407 100644 --- a/lib/awestruct/handlers/restructuredtext_handler.rb +++ b/lib/awestruct/handlers/restructuredtext_handler.rb @@ -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