From 7e571ee48cf32173e611f6bc6fb2e10991c7b2dc Mon Sep 17 00:00:00 2001 From: Enoc Date: Sat, 8 Jan 2022 17:38:21 -0600 Subject: [PATCH] Fix rails clean_html_guides filter --- lib/docs/filters/rails/clean_html_guides.rb | 4 +++- lib/docs/scrapers/rdoc/rails.rb | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/rails/clean_html_guides.rb b/lib/docs/filters/rails/clean_html_guides.rb index a40dcba0..0c39d137 100644 --- a/lib/docs/filters/rails/clean_html_guides.rb +++ b/lib/docs/filters/rails/clean_html_guides.rb @@ -24,7 +24,9 @@ module Docs css('pre').each do |node| code = node.at_css('code') - language = code['class'][/highlight ?(\w+)/, 1] + language = code['class'] + break if language.nil? + language = language [/highlight ?(\w+)/, 1] node['data-language'] = language unless language == 'plain' code.remove_attribute('class') node.content = node.content.strip diff --git a/lib/docs/scrapers/rdoc/rails.rb b/lib/docs/scrapers/rdoc/rails.rb index a4bde522..3f2e1f27 100644 --- a/lib/docs/scrapers/rdoc/rails.rb +++ b/lib/docs/scrapers/rdoc/rails.rb @@ -109,7 +109,6 @@ module Docs def get_latest_version(opts) doc = fetch_doc('https://rubyonrails.org/', opts) - doc doc.at_css('.heading__button span').content.scan(/\d\.\d*\.*\d*\.*\d*/)[0] end end