浏览代码

Update Python documentation (3.10.1)

Re-enable most non library docs.

Fixes #1601.
Simon Legner 4 年之前
父节点
当前提交
937bf3b76f
共有 3 个文件被更改,包括 25 次插入5 次删除
  1. 8 1
      lib/docs/filters/python/entries_v3.rb
  2. 17 4
      lib/docs/scrapers/python.rb
  3. 二进制
      python-3.10.1-docs-html.tar.bz2

+ 8 - 1
lib/docs/filters/python/entries_v3.rb

@@ -26,6 +26,13 @@ module Docs
       end
       end
 
 
       def get_type
       def get_type
+        return 'Language Reference' if slug.start_with? 'reference'
+        return 'Python/C API' if slug.start_with? 'c-api'
+        return 'Tutorial' if slug.start_with? 'tutorial'
+
+        return 'Basics' unless slug.start_with? 'library/'
+        return 'Basics' if slug.start_with? 'library/index'
+
         return 'Logging' if slug.start_with? 'library/logging'
         return 'Logging' if slug.start_with? 'library/logging'
         return 'Asynchronous I/O' if slug.start_with? 'library/asyncio'
         return 'Asynchronous I/O' if slug.start_with? 'library/asyncio'
 
 
@@ -53,7 +60,7 @@ module Docs
       end
       end
 
 
       def additional_entries
       def additional_entries
-        return [] if root_page? || !include_default_entry? || name == 'errno'
+        return [] if root_page? || slug.start_with?('library/index') || !include_default_entry? || name == 'errno'
         clean_id_attributes
         clean_id_attributes
         entries = []
         entries = []
 
 

+ 17 - 4
lib/docs/scrapers/python.rb

@@ -1,18 +1,31 @@
 module Docs
 module Docs
   class Python < FileScraper
   class Python < FileScraper
     self.type = 'python'
     self.type = 'python'
-    self.root_path = 'library/index.html'
+    self.root_path = 'index.html'
     self.links = {
     self.links = {
       home: 'https://www.python.org/',
       home: 'https://www.python.org/',
       code: 'https://github.com/python/cpython'
       code: 'https://github.com/python/cpython'
     }
     }
 
 
-    options[:only_patterns] = [/\Alibrary\//]
+    options[:only_patterns] = [
+      # /\Ac-api/,
+      /\Adistributing/,
+      # /\Adistutils/,
+      /\Aextending/,
+      /\Afaq/,
+      /\Ahowto/,
+      /\Aindex.html/,
+      # /\Ainstall/,
+      /\Ainstalling/,
+      /\Alibrary/,
+      /\Areference/,
+      /\Atutorial/,
+      /\Ausing/,
+    ]
 
 
     options[:skip] = %w(
     options[:skip] = %w(
       library/2to3.html
       library/2to3.html
       library/formatter.html
       library/formatter.html
-      library/index.html
       library/intro.html
       library/intro.html
       library/undoc.html
       library/undoc.html
       library/unittest.mock-examples.html
       library/unittest.mock-examples.html
@@ -24,7 +37,7 @@ module Docs
     HTML
     HTML
 
 
     version '3.10' do
     version '3.10' do
-      self.release = '3.10.0'
+      self.release = '3.10.1'
       self.base_url = "https://docs.python.org/#{self.version}/"
       self.base_url = "https://docs.python.org/#{self.version}/"
 
 
       html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
       html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'

二进制
python-3.10.1-docs-html.tar.bz2