diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index d7ae6452..07dc5645 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,7 +1,7 @@
[
[
"2024-02-20",
- "New documentation: Next.js"
+ "New documentations: Next.js, click"
],
[
"2024-01-24",
diff --git a/lib/docs/filters/click/entries.rb b/lib/docs/filters/click/entries.rb
new file mode 100644
index 00000000..01fa1a72
--- /dev/null
+++ b/lib/docs/filters/click/entries.rb
@@ -0,0 +1,58 @@
+module Docs
+ class Click
+ class EntriesFilter < Docs::EntriesFilter
+ TYPE_BY_SLUG = {}
+
+ def call
+ if root_page?
+ css('section').each do |node|
+ next if ['documentation', 'api-reference'].include?(node['id'])
+ type = node.at_css('h2').content.strip
+ node.css('li > a').each do |toclink|
+ slug = toclink['href'].split('/')[-2]
+ TYPE_BY_SLUG[slug] = type
+ end
+ end
+ end
+ super
+ end
+
+ def get_name
+ return at_css('h1').content.strip
+ end
+
+ def get_type
+ TYPE_BY_SLUG[slug.split('/').first] || at_css('h1').content.strip
+ end
+
+ def include_default_entry?
+ TYPE_BY_SLUG.include?(slug.split('/').first)
+ end
+
+ def additional_entries
+ return [] if root_page? || TYPE_BY_SLUG.include?(slug.split('/').first)
+
+ if slug == 'api/'
+ entries = []
+ doc.css('> section').each do |section|
+ title = section.at_css('h2').content.strip
+ section.css('dl.py > dt[id]').each do |dt|
+ name = dt['id'].split('.')[1..].join('.')
+ name << '()' if dt.parent.classes.intersect?(['function', 'method', 'classmethod', 'staticmethod'])
+ entries << [name, dt['id'], title]
+ end
+ end
+ return entries
+ end
+
+ (doc.css('> section') || []).map do |section|
+ title = section.at_css('h2').content.strip
+ [title, section['id']]
+ end
+ end
+
+ private
+
+ end
+ end
+end
diff --git a/lib/docs/filters/click/pre_clean_html.rb b/lib/docs/filters/click/pre_clean_html.rb
new file mode 100644
index 00000000..e0552a6a
--- /dev/null
+++ b/lib/docs/filters/click/pre_clean_html.rb
@@ -0,0 +1,11 @@
+module Docs
+ class Click
+ class PreCleanHtmlFilter < Filter
+ def call
+ # Remove ΒΆ character from headers
+ css('.headerlink').remove
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/click.rb b/lib/docs/scrapers/click.rb
new file mode 100644
index 00000000..71c2a423
--- /dev/null
+++ b/lib/docs/scrapers/click.rb
@@ -0,0 +1,30 @@
+module Docs
+ class Click < UrlScraper
+ self.name = 'click'
+ self.type = 'sphinx'
+ self.root_path = 'index.html'
+ self.links = {
+ home: 'https://click.palletsprojects.com/',
+ code: 'https://github.com/pallets/click'
+ }
+
+ html_filters.push 'click/pre_clean_html', 'click/entries', 'sphinx/clean_html'
+
+ options[:container] = '.body > section'
+ options[:skip] = ['changes/', 'genindex/', 'py-modindex/']
+ options[:title] = false
+
+ options[:attribution] = <<-HTML
+ © Copyright 2014 Pallets.
+ Licensed under the BSD 3-Clause License.
+ We are not supported nor endorsed by Pallets.
+ HTML
+
+ self.release = '8.1.x'
+ self.base_url = "https://click.palletsprojects.com/en/#{self.release}/"
+
+ def get_latest_version(opts)
+ get_latest_github_release('pallets', 'click', opts)
+ end
+ end
+end
diff --git a/public/icons/docs/click/16.png b/public/icons/docs/click/16.png
new file mode 100644
index 00000000..d1497c30
Binary files /dev/null and b/public/icons/docs/click/16.png differ
diff --git a/public/icons/docs/click/16@2x.png b/public/icons/docs/click/16@2x.png
new file mode 100644
index 00000000..3bc91ffb
Binary files /dev/null and b/public/icons/docs/click/16@2x.png differ
diff --git a/public/icons/docs/click/SOURCE b/public/icons/docs/click/SOURCE
new file mode 100644
index 00000000..be844957
--- /dev/null
+++ b/public/icons/docs/click/SOURCE
@@ -0,0 +1 @@
+https://github.com/pallets/click/blob/main/docs/_static/click-icon.png