Fix minor issues in Django scraper

Fixes #426.
pull/427/merge
Thibaut Courouble 9 years ago
parent 77ea68b3ba
commit 2826b54dd6

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

@ -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

@ -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

Loading…
Cancel
Save