diff --git a/docs/file-scrapers.md b/docs/file-scrapers.md index 076510fcd9..308a75cd3c 100644 --- a/docs/file-scrapers.md +++ b/docs/file-scrapers.md @@ -272,13 +272,13 @@ cp -r minitest/docs $DEVDOCS/docs/minitest ``` ### Ruby on Rails -* Download a release at https://github.com/rails/rails/releases or clone https://github.com/rails/rails.git (checkout to the branch of the rails' version that is going to be scraped) +* Run `git clone --branch v$RELEASE --depth 7 https://github.com/rails/rails.git && cd rails` * Open `railties/lib/rails/api/task.rb` and comment out any code related to sdoc (`configure_sdoc`) * Run `bundle config set --local without 'db job'` (in the Rails directory) * Run `bundle install && bundle exec rake rdoc` (in the Rails directory) * Run `cd guides && bundle exec rake guides:generate:html && cd ..` * Run `cp -r guides/output html/guides` -* Run `cp -r html $DEVDOCS/docs/rails~[version]` +* Run `cp -r html $DEVDOCS/docs/rails~$VERSION` ### Ruby Download the tarball of Ruby from https://www.ruby-lang.org/en/downloads/, extract it, run diff --git a/lib/docs/filters/rdoc/clean_html.rb b/lib/docs/filters/rdoc/clean_html.rb index ff6d76604d..731994e74d 100644 --- a/lib/docs/filters/rdoc/clean_html.rb +++ b/lib/docs/filters/rdoc/clean_html.rb @@ -42,7 +42,9 @@ def other link_node.content = 'Show source' link_node['class'] = 'method-click-advice' - node.parent.parent.at_css('.method-heading').add_child(link_node) + # Only add "Show source" if source is present + method_root = node.ancestors('.method-detail').first + method_root.at_css('.method-heading').add_child(link_node) if method_root.at_css('.method-source-code') end # (RDoc for Ruby 3.4+) Remove the additional "Source" toggle from the page @@ -50,7 +52,8 @@ def other # Add class to differentiate Ruby code from C code css('.method-source-code').each do |node| - node.parent.prepend_child(node) + header = node.ancestors('.method-detail').first.at_css('.method-header') + header.add_next_sibling(node) pre = node.at_css('pre') pre['class'] = pre.at_css('.ruby-keyword') ? 'ruby' : 'c' end diff --git a/lib/docs/scrapers/rdoc/rails.rb b/lib/docs/scrapers/rdoc/rails.rb index 03aad4a356..a78cbd5042 100644 --- a/lib/docs/scrapers/rdoc/rails.rb +++ b/lib/docs/scrapers/rdoc/rails.rb @@ -75,6 +75,10 @@ class Rails < Rdoc end end + version '8.1' do + self.release = '8.1.2' + end + version '8.0' do self.release = '8.0.1' end