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; } ul.simple { margin: 1em 0; }
dt > a.external { float: right; } h2 > a, h3 > a, dt > a { float: right; }
} }
._sphinx { ._sphinx {

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

@ -2,7 +2,7 @@ module Docs
class Django class Django
class FixUrlsFilter < Filter class FixUrlsFilter < Filter
def call 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 html
end end
end end

Loading…
Cancel
Save