Unified · Split
| @@ -0,0 +1,15 @@ | |||
| 1 | module Docs | ||
| 2 | class Click | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | if root_page? | ||
| 6 | # Image renders quite badly in dark mode | ||
| 7 | at_css('h1 + a.image-reference').remove | ||
| 8 | # All superfluous | ||
| 9 | css('#documentation, #api-reference, #miscellaneous-pages').remove | ||
| 10 | end | ||
| 11 | doc | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| @@ -0,0 +1,45 @@ | |||
| 1 | module Docs | ||
| 2 | class Click | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | |||
| 5 | def initialize(*) | ||
| 6 | super | ||
| 7 | end | ||
| 8 | |||
| 9 | def get_name | ||
| 10 | return at_css('h1').content.strip | ||
| 11 | end | ||
| 12 | |||
| 13 | def get_type | ||
| 14 | return at_css('h1').content.strip | ||
| 15 | end | ||
| 16 | |||
| 17 | def include_default_entry? | ||
| 18 | false | ||
| 19 | end | ||
| 20 | |||
| 21 | def additional_entries | ||
| 22 | return [] if root_page? | ||
| 23 | |||
| 24 | if slug == 'api/' | ||
| 25 | entries = [] | ||
| 26 | doc.css('> section').each do |section| | ||
| 27 | title = section.at_css('h2').content.strip | ||
| 28 | section.css('> dl.py > dt[id]').each do |dt| | ||
| 29 | entries << [dt['id'], dt['id'], title] | ||
| 30 | end | ||
| 31 | end | ||
| 32 | return entries | ||
| 33 | end | ||
| 34 | |||
| 35 | (doc.css('> section') || []).map do |section| | ||
| 36 | title = section.at_css('h2').content.strip | ||
| 37 | [title, section['id']] | ||
| 38 | end | ||
| 39 | end | ||
| 40 | |||
| 41 | private | ||
| 42 | |||
| 43 | end | ||
| 44 | end | ||
| 45 | end | ||
| @@ -0,0 +1,11 @@ | |||
| 1 | module Docs | ||
| 2 | class Click | ||
| 3 | class PreCleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | # Remove ¶ character from tag w/ name & type | ||
| 6 | css('.headerlink').remove | ||
| 7 | doc | ||
| 8 | end | ||
| 9 | end | ||
| 10 | end | ||
| 11 | end | ||
| @@ -0,0 +1,29 @@ | |||
| 1 | module Docs | ||
| 2 | class Click < UrlScraper | ||
| 3 | self.name = 'click' | ||
| 4 | self.type = 'sphinx' #'simple' | ||
| 5 | self.release = '8.1.7' | ||
| 6 | self.base_url = 'https://click.palletsprojects.com/en/8.1.x/' | ||
| 7 | self.root_path = 'index.html' | ||
| 8 | self.links = { | ||
| 9 | home: 'https://click.palletsprojects.com/', | ||
| 10 | code: 'https://github.com/pallets/click' | ||
| 11 | } | ||
| 12 | |||
| 13 | html_filters.push 'click/pre_clean_html', 'click/entries', 'click/clean_html', 'sphinx/clean_html', 'title' | ||
| 14 | |||
| 15 | options[:skip] = ['changes/', 'genindex/', 'py-modindex/', 'license/'] | ||
| 16 | options[:container] = '.body > section' | ||
| 17 | options[:title] = false | ||
| 18 | |||
| 19 | options[:attribution] = <<-HTML | ||
| 20 | © Copyright 2014 Pallets.<br> | ||
| 21 | Licensed under the BSD 3-Clause License.<br> | ||
| 22 | We are not supported nor endorsed by Pallets. | ||
| 23 | HTML | ||
| 24 | |||
| 25 | def get_latest_version(opts) | ||
| 26 | get_latest_github_release('pallets', 'click', opts) | ||
| 27 | end | ||
| 28 | end | ||
| 29 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://github.com/pallets/click/blob/main/docs/_static/click-icon.png | ||