History

Fix minor issues in Django scraper

Fixes #426.

Thibaut Courouble committed 10 years ago

Commit 2826b541 parent 77ea68b3 files · +5 −3Browse files

Showing the changes to lib/docs (2 of 3 files). Show all

Unified · Split

2 files
  1. lib/docs/filters/django/clean_html.rb +3 −1
  2. lib/docs/filters/django/fix_urls.rb +1 −1
lib/docs/filters/django/clean_html.rb+3−1
@@ -22,13 +22,15 @@ module Docs · 21 unmodified lines
2222 end
2323
2424 css('h1', 'h2', 'h3', 'dt').each do |node|
25+ links = node.css('a').remove
2526 node.content = node.content
27+ node << links
2628 end
2729
2830 css('div[class^="highlight-"]').each do |node|
2931 node.name = 'pre'
3032 node['class'] = node['data-language'] = case node['class']
31− when 'highlight-python' then 'python'
33+ when 'highlight-python', 'highlight-default' then 'python'
3234 when 'highlight-html+django' then 'markup'
3335 else ''
3436 end
lib/docs/filters/django/fix_urls.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Django
33 class FixUrlsFilter < Filter
44 def call
5− html.gsub! %r{#{Regexp.escape(Django.base_url)}([^"']+?)\.html}, "#{Django.base_url}\\1/"
5+ html.gsub! %r{#{Regexp.escape(context[:base_url].to_s)}([^"']+?)\.html}, "#{context[:base_url]}\\1/"
66 html
77 end
88 end