| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- module Docs
- class Python < UrlScraper
- self.type = 'python'
- self.root_path = 'index.html'
- self.links = {
- home: 'https://www.python.org/',
- code: 'https://github.com/python/cpython'
- }
- # bypass the clean_text filter as it removes empty span with ids
- options[:clean_text] = false
- # bypass sphinx modifying empty ids
- options[:sphinx_keep_empty_ids] = true
- options[:skip_patterns] = [/whatsnew/]
- options[:skip] = %w(
- library/2to3.html
- library/formatter.html
- library/intro.html
- library/undoc.html
- library/unittest.mock-examples.html
- library/sunau.html)
- options[:attribution] = <<-HTML
- © 2001–2025 Python Software Foundation<br>
- Licensed under the PSF License.
- HTML
- version '3.13' do
- self.release = '3.13.5'
- self.base_url = "https://docs.python.org/#{self.version}/"
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.12' do
- self.release = '3.12.9'
- self.base_url = "https://docs.python.org/#{self.version}/"
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.11' do
- self.release = '3.11.11'
- self.base_url = "https://docs.python.org/#{self.version}/"
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.10' do
- self.release = '3.10.13'
- self.base_url = "https://docs.python.org/#{self.version}/"
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.9' do
- self.release = '3.9.14'
- self.base_url = 'https://docs.python.org/3.9/'
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.8' do
- self.release = '3.8.14'
- self.base_url = 'https://docs.python.org/3.8/'
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.7' do
- self.release = '3.7.14'
- self.base_url = 'https://docs.python.org/3.7/'
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.6' do
- self.release = '3.6.12'
- self.base_url = 'https://docs.python.org/3.6/'
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '3.5' do
- self.release = '3.5.9'
- self.base_url = 'https://docs.python.org/3.5/'
- html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
- end
- version '2.7' do
- self.release = '2.7.17'
- self.base_url = 'https://docs.python.org/2.7/'
- html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'
- end
- def get_latest_version(opts)
- doc = fetch_doc('https://docs.python.org/', opts)
- doc.at_css('title').content.split(' ')[0]
- end
- end
- end
|