diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 3ab185f64c..fdc35997ff 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2026-07-03", + "New documentation: Celery" + ], [ "2026-06-02", "New documentation: PowerShell" diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 95a1b3a9a6..56838083c1 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -30,6 +30,7 @@ @use 'pages/bootstrap'; @use 'pages/cppref'; @use 'pages/cakephp'; +@use 'pages/celery'; @use 'pages/clojure'; @use 'pages/codeception'; @use 'pages/coffeescript'; diff --git a/assets/stylesheets/pages/_celery.scss b/assets/stylesheets/pages/_celery.scss new file mode 100644 index 0000000000..d9735c7341 --- /dev/null +++ b/assets/stylesheets/pages/_celery.scss @@ -0,0 +1,14 @@ +@use 'pages/simple'; + +._celery { + @extend %simple; + + .note, .warning, .seealso { + @extend %note; + .admonition-title { font-weight: bold; } + } + + .note { @extend %note-gray; } + .seealso { @extend %note-green; } + .warning { @extend %note-red; } +} diff --git a/lib/docs/filters/celery/clean_html.rb b/lib/docs/filters/celery/clean_html.rb new file mode 100644 index 0000000000..53fc811a4b --- /dev/null +++ b/lib/docs/filters/celery/clean_html.rb @@ -0,0 +1,35 @@ +module Docs + class Celery + class CleanHtmlFilter < Filter + def call + # 'This document describes the current stable version of Celery...' + css('div.deck').remove + + css('.reference.external.image-reference').remove + + # Table of Contents. + css('nav.contents.local', 'table.docutils').remove + + # ΒΆ anchor links, [source] external links. + css('a.headerlink', 'a.toc-backref', '.viewcode-link', 'hr').remove + + css('h1', 'h2', 'h3', 'h4', 'h5', 'h6').each do |node| + node.content = node.inner_text + end + + css('.highlight-python pre', '.highlight-default pre', '.highlight-pycon pre').each do |node| + node.content = node.content + node['data-language'] = 'python' + node.parent.parent.replace(node) + end + + # Lists are wrapped in blockquotes for some reason. + css('blockquote ol', 'blockquote ul').each do |node| + node.parent.parent.replace(node) + end + + doc + end + end + end +end diff --git a/lib/docs/filters/celery/entries.rb b/lib/docs/filters/celery/entries.rb new file mode 100644 index 0000000000..c18a975236 --- /dev/null +++ b/lib/docs/filters/celery/entries.rb @@ -0,0 +1,27 @@ +module Docs + class Celery + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content.gsub(/\P{ASCII}/, '') + end + + def get_type + if subpath.include?('internals/') + 'Internal Module Reference' + elsif subpath.include?('reference/') + 'API Reference' + elsif subpath.include?('userguide/') + 'User Guide' + else + name + end + end + + def additional_entries + css('dl.py dt[id]').each_with_object [] do |node, entries| + entries << [node['id'], node['id'], get_type] + end + end + end + end +end diff --git a/lib/docs/scrapers/celery.rb b/lib/docs/scrapers/celery.rb new file mode 100644 index 0000000000..270e594a91 --- /dev/null +++ b/lib/docs/scrapers/celery.rb @@ -0,0 +1,28 @@ +module Docs + class Celery < UrlScraper + self.name = 'Celery' + self.type = 'celery' + self.release = '5.6.3' + self.base_url = 'https://docs.celeryq.dev/en/stable/' + self.links = { + home: 'https://docs.celeryq.dev', + code: 'https://github.com/celery/celery' + } + + html_filters.push 'celery/entries', 'celery/clean_html' + + options[:container] = 'div.body' + options[:rate_limit] = 100 + options[:only_patterns] = [/userguide\//, /reference\//] + + options[:attribution] = <<-HTML + Copyright © 2017-2026 Asif Saif Uddin, core team & contributors. All rights reserved.
+ Celery is licensed under The BSD License (3 Clause, also known as the new BSD license). The license is an OSI approved Open Source license and is GPL-compatible. + HTML + + def get_latest_version(opts) + tags = get_github_tags('celery', 'celery', opts) + tags[0]['name'][1..-1] + end + end +end diff --git a/public/icons/docs/celery/16.png b/public/icons/docs/celery/16.png new file mode 100644 index 0000000000..3d582e88bd Binary files /dev/null and b/public/icons/docs/celery/16.png differ diff --git a/public/icons/docs/celery/16@2x.png b/public/icons/docs/celery/16@2x.png new file mode 100644 index 0000000000..fda9845140 Binary files /dev/null and b/public/icons/docs/celery/16@2x.png differ diff --git a/public/icons/docs/celery/SOURCE b/public/icons/docs/celery/SOURCE new file mode 100644 index 0000000000..2f071f4820 --- /dev/null +++ b/public/icons/docs/celery/SOURCE @@ -0,0 +1 @@ +https://docs.celeryq.dev/en/stable/_static/favicon.ico