Fixes #137.
Unified · Split
| @@ -16,7 +16,10 @@ module Docs · 15 unmodified lines | |||
| 16 | def get_name | 16 | def get_name |
| 17 | name = at_css('h1').content | 17 | name = at_css('h1').content |
| 18 | name.remove! %r{\A[\d\.]+ } # remove list number | 18 | name.remove! %r{\A[\d\.]+ } # remove list number |
| 19 | name.remove! "\u{00B6}" # remove pilcrow sign | ||
| 19 | name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash | 20 | name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash |
| 21 | name.remove! 'Built-in' | ||
| 22 | name.strip! | ||
| 20 | name | 23 | name |
| 21 | end | 24 | end |
| 22 | 25 | ||
| @@ -42,11 +45,11 @@ module Docs · 19 unmodified lines | |||
| 42 | end | 45 | end |
| 43 | 46 | ||
| 44 | def include_default_entry? | 47 | def include_default_entry? |
| 45 | name !~ /[A-Z]/ && !skip? # skip non-module names | 48 | !at_css('.body > .section:only-child > .toctree-wrapper:last-child') && !type.in?(%w(Language Superseded)) |
| 46 | end | 49 | end |
| 47 | 50 | ||
| 48 | def additional_entries | 51 | def additional_entries |
| 49 | return [] if root_page? || skip? || name == 'errno' | 52 | return [] if root_page? || !include_default_entry? || name == 'errno' |
| 50 | clean_id_attributes | 53 | clean_id_attributes |
| 51 | entries = [] | 54 | entries = [] |
| 52 | 55 | ||
| @@ -67,10 +70,6 @@ module Docs · 14 unmodified lines | |||
| 67 | entries | 70 | entries |
| 68 | end | 71 | end |
| 69 | 72 | ||
| 70 | def skip? | ||
| 71 | type == 'Language' | ||
| 72 | end | ||
| 73 | |||
| 74 | def clean_id_attributes | 73 | def clean_id_attributes |
| 75 | css('.section > .target[id]').each do |node| | 74 | css('.section > .target[id]').each do |node| |
| 76 | if dt = node.at_css('+ dl > dt') | 75 | if dt = node.at_css('+ dl > dt') |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Python < FileScraper | 2 | class Python < FileScraper |
| 3 | self.version = '3.4.0' | 3 | self.version = '3.4.2' |
| 4 | self.type = 'sphinx' | 4 | self.type = 'sphinx' |
| 5 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python' # downloaded from docs.python.org/3/download.html | 5 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python' # downloaded from docs.python.org/3/download.html |
| 6 | self.base_url = 'http://docs.python.org/3/' | 6 | self.base_url = 'http://docs.python.org/3/' |