From 62dcf2be4fd465cd6107b2faae23e28a6467e14a Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Sun, 26 Aug 2018 15:24:59 -0400 Subject: [PATCH] Don't overlay the method's source over its docs in RDoc --- assets/stylesheets/pages/_rdoc.scss | 9 --------- lib/docs/filters/rdoc/clean_html.rb | 6 ++++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/assets/stylesheets/pages/_rdoc.scss b/assets/stylesheets/pages/_rdoc.scss index 7873900a..2b4fc9d5 100644 --- a/assets/stylesheets/pages/_rdoc.scss +++ b/assets/stylesheets/pages/_rdoc.scss @@ -33,17 +33,8 @@ } } - .method-description { position: relative; } - .method-source-code { display: none; - position: absolute; - z-index: 1; - top: 0; - left: -1em; - right: 0; - background: var(--contentBackground); - box-shadow: 0 1em 1em 1em var(--contentBackground); > pre { margin: 0; } } diff --git a/lib/docs/filters/rdoc/clean_html.rb b/lib/docs/filters/rdoc/clean_html.rb index 7c06f324..ac836d19 100644 --- a/lib/docs/filters/rdoc/clean_html.rb +++ b/lib/docs/filters/rdoc/clean_html.rb @@ -37,8 +37,10 @@ module Docs end # Add class to differentiate Ruby code from C code - css('.method-source-code > pre').each do |node| - node['class'] = node.at_css('.ruby-keyword') ? 'ruby' : 'c' + css('.method-source-code').each do |node| + node.parent.prepend_child(node) + pre = node.at_css('pre') + pre['class'] = pre.at_css('.ruby-keyword') ? 'ruby' : 'c' end # Remove code highlighting