Skip to content

Commit 5a03438

Browse files
authored
Merge pull request #2704 from spamguy/rabbitmq
Add RabbitMQ scraper
2 parents 04ac893 + bb1186c commit 5a03438

10 files changed

Lines changed: 93 additions & 2 deletions

File tree

assets/javascripts/news.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
[
33
"2026-07-03",
4-
"New documentation: <a href=\"/celery/\">Celery</a>"
4+
"New documentations: <a href=\"/celery/\">Celery</a>, <a href=\"/rabbit_mq/\">RabbitMQ</a>"
55
],
66
[
77
"2026-06-02",

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
@use 'pages/pygame';
101101
@use 'pages/python';
102102
@use 'pages/qt';
103+
@use 'pages/rabbit_mq';
103104
@use 'pages/ramda';
104105
@use 'pages/rdoc';
105106
@use 'pages/react';
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@use 'pages/simple';
2+
3+
._rabbit_mq {
4+
@extend %simple;
5+
6+
.alert--info, .alert--warning, .alert--success, .alert--secondary {
7+
@extend %note;
8+
.admonitionHeading_Gvgb {
9+
font-weight: 700;
10+
text-transform: uppercase;
11+
}
12+
}
13+
.alert--success { @extend %note, %note-green; }
14+
.alert--info { @extend %note, %note-blue; }
15+
.alert--warning { @extend %note, %note-orange; }
16+
.alert--secondary { @extend %note, %note-gray; }
17+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module Docs
2+
class RabbitMq
3+
class CleanHtmlFilter < Filter
4+
def call
5+
@doc = at_css('.theme-doc-markdown.markdown')
6+
7+
css('.theme-admonition svg').remove
8+
9+
css('pre').each do |node|
10+
node.content = node.css('.token-line').map(&:content).join("\n")
11+
12+
node['data-language'] =
13+
if node['class'].include?('language-bash')
14+
'bash'
15+
elsif node['class'].include?('language-java')
16+
'java'
17+
end
18+
end
19+
20+
doc
21+
end
22+
end
23+
end
24+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Docs
2+
class RabbitMq
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
at_css('h1').content
6+
end
7+
8+
def get_type
9+
breadcrumb = css('.breadcrumbs__item')
10+
11+
if breadcrumb.length > 1
12+
breadcrumb[1].inner_text
13+
else
14+
'Other'
15+
end
16+
end
17+
end
18+
end
19+
end

lib/docs/scrapers/github.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def parse(response)
2323
&.first
2424
parsed = JSON.parse(embedded_json)
2525

26-
[parsed['payload']['blob']['richText'], parsed['title']]
26+
[parsed['payload']['codeViewBlobRoute']['richText'], parsed['title']]
2727
end
2828
end
2929
end

lib/docs/scrapers/rabbit_mq.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module Docs
2+
class RabbitMq < UrlScraper
3+
self.name = 'RabbitMQ'
4+
self.type = 'rabbit_mq'
5+
self.links = {
6+
home: 'https://www.rabbitmq.com/',
7+
code: 'https://github.com/rabbitmq/rabbitmq-server'
8+
}
9+
10+
html_filters.push 'rabbit_mq/entries', 'rabbit_mq/clean_html'
11+
12+
options[:root_path] = '/docs'
13+
options[:skip_patterns] = [/\/next|\/\d\.\d*/, /rabbitmq\//]
14+
options[:attribution] = <<-HTML
15+
Copyright &copy; 2005-2026 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.<br />
16+
Licensed under the Apache License, Version 2.0.
17+
HTML
18+
19+
version do
20+
self.base_url = 'https://www.rabbitmq.com/docs'
21+
self.release = '4.3.2'
22+
end
23+
24+
def get_latest_version(opts)
25+
tags = get_github_tags("rabbitmq", "rabbitmq-server", opts)
26+
tags[0]['name'][1..-1]
27+
end
28+
end
29+
end

public/icons/docs/rabbitmq/16.png

318 Bytes
Loading
424 Bytes
Loading

public/icons/docs/rabbitmq/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.rabbitmq.com/assets/files/rabbitmq-logo-e91cacd38fcef5219149bc5cfa10b384.svg

0 commit comments

Comments
 (0)