Explorar o código

Fix minor issues in Django scraper

Fixes #426.
Thibaut Courouble %!s(int64=9) %!d(string=hai) anos
pai
achega
2826b54dd6

+ 1 - 1
assets/stylesheets/pages/_sphinx.scss

@@ -25,7 +25,7 @@
 
   ul.simple { margin: 1em 0; }
 
-  dt > a.external { float: right; }
+  h2 > a, h3 > a, dt > a { float: right; }
 }
 
 ._sphinx {

+ 3 - 1
lib/docs/filters/django/clean_html.rb

@@ -22,13 +22,15 @@ module Docs
         end
 
         css('h1', 'h2', 'h3', 'dt').each do |node|
+          links = node.css('a').remove
           node.content = node.content
+          node << links
         end
 
         css('div[class^="highlight-"]').each do |node|
           node.name = 'pre'
           node['class'] = node['data-language'] = case node['class']
-            when 'highlight-python' then 'python'
+            when 'highlight-python', 'highlight-default' then 'python'
             when 'highlight-html+django' then 'markup'
             else ''
           end

+ 1 - 1
lib/docs/filters/django/fix_urls.rb

@@ -2,7 +2,7 @@ module Docs
   class Django
     class FixUrlsFilter < Filter
       def call
-        html.gsub! %r{#{Regexp.escape(Django.base_url)}([^"']+?)\.html}, "#{Django.base_url}\\1/"
+        html.gsub! %r{#{Regexp.escape(context[:base_url].to_s)}([^"']+?)\.html}, "#{context[:base_url]}\\1/"
         html
       end
     end