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
22 end22 end
23 23
24 css('h1', 'h2', 'h3', 'dt').each do |node|24 css('h1', 'h2', 'h3', 'dt').each do |node|
25 links = node.css('a').remove
25 node.content = node.content26 node.content = node.content
27 node << links
26 end28 end
27 29
28 css('div[class^="highlight-"]').each do |node|30 css('div[class^="highlight-"]').each do |node|
29 node.name = 'pre'31 node.name = 'pre'
30 node['class'] = node['data-language'] = case node['class']32 node['class'] = node['data-language'] = case node['class']
31 when 'highlight-python' then 'python'33 when 'highlight-python', 'highlight-default' then 'python'
32 when 'highlight-html+django' then 'markup'34 when 'highlight-html+django' then 'markup'
33 else ''35 else ''
34 end36 end
lib/docs/filters/django/fix_urls.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Django2 class Django
3 class FixUrlsFilter < Filter3 class FixUrlsFilter < Filter
4 def call4 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/"
6 html6 html
7 end7 end
8 end8 end