diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-06 11:39:10 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-06 11:39:10 +0200 |
commit | 8357d3aea2206d8ed25098bbf688f660a5cf0f9f (patch) | |
tree | 40641ee579edd3c57621f0a0d55e339536b217b7 /guides/rails_guides/markdown.rb | |
parent | d76b52844d62c868a0cdca34fc871a6b7b096efe (diff) | |
parent | 220528548b43b949a752ed9bcbc2f83fa6c75560 (diff) | |
download | rails-8357d3aea2206d8ed25098bbf688f660a5cf0f9f.tar.gz rails-8357d3aea2206d8ed25098bbf688f660a5cf0f9f.tar.bz2 rails-8357d3aea2206d8ed25098bbf688f660a5cf0f9f.zip |
Merge pull request #12667 from nateberkopec/make_guides_html_valid
Fix Guide HTML validation
Diffstat (limited to 'guides/rails_guides/markdown.rb')
-rw-r--r-- | guides/rails_guides/markdown.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb index 547c6d2c15..dbf7ff311d 100644 --- a/guides/rails_guides/markdown.rb +++ b/guides/rails_guides/markdown.rb @@ -79,10 +79,10 @@ module RailsGuides def generate_structure @headings_for_index = [] if @body.present? - @body = Nokogiri::HTML(@body).tap do |doc| + @body = Nokogiri::HTML.fragment(@body).tap do |doc| hierarchy = [] - doc.at('body').children.each do |node| + doc.children.each do |node| if node.name =~ /^h[3-6]$/ case node.name when 'h3' @@ -116,7 +116,7 @@ module RailsGuides end end - @index = Nokogiri::HTML(engine.render(raw_index)).tap do |doc| + @index = Nokogiri::HTML.fragment(engine.render(raw_index)).tap do |doc| doc.at('ol')[:class] = 'chapters' end.to_html @@ -130,8 +130,8 @@ module RailsGuides end def generate_title - if heading = Nokogiri::HTML(@header).at(:h2) - @title = "#{heading.text} — Ruby on Rails Guides".html_safe + if heading = Nokogiri::HTML.fragment(@header).at(:h2) + @title = "#{heading.text} — Ruby on Rails Guides" else @title = "Ruby on Rails Guides" end |