Browse Source

Update Python documentation (3.4.2)

Fixes #137.
Thibaut 11 years ago
parent
commit
660cb1e5fd
2 changed files with 6 additions and 7 deletions
  1. 5 6
      lib/docs/filters/python/entries.rb
  2. 1 1
      lib/docs/scrapers/python.rb

+ 5 - 6
lib/docs/filters/python/entries.rb

@@ -16,7 +16,10 @@ module Docs
       def get_name
         name = at_css('h1').content
         name.remove! %r{\A[\d\.]+ } # remove list number
+        name.remove! "\u{00B6}" # remove pilcrow sign
         name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash
+        name.remove! 'Built-in'
+        name.strip!
         name
       end
 
@@ -42,11 +45,11 @@ module Docs
       end
 
       def include_default_entry?
-        name !~ /[A-Z]/ && !skip? # skip non-module names
+        !at_css('.body > .section:only-child > .toctree-wrapper:last-child') && !type.in?(%w(Language Superseded))
       end
 
       def additional_entries
-        return [] if root_page? || skip? || name == 'errno'
+        return [] if root_page? || !include_default_entry? || name == 'errno'
         clean_id_attributes
         entries = []
 
@@ -67,10 +70,6 @@ module Docs
         entries
       end
 
-      def skip?
-        type == 'Language'
-      end
-
       def clean_id_attributes
         css('.section > .target[id]').each do |node|
           if dt = node.at_css('+ dl > dt')

+ 1 - 1
lib/docs/scrapers/python.rb

@@ -1,6 +1,6 @@
 module Docs
   class Python < FileScraper
-    self.version = '3.4.0'
+    self.version = '3.4.2'
     self.type = 'sphinx'
     self.dir = '/Users/Thibaut/DevDocs/Docs/Python' # downloaded from docs.python.org/3/download.html
     self.base_url = 'http://docs.python.org/3/'