Skip to content

Commit d0cf5d7

Browse files
committed
Add ReactiveX documentation
1 parent 2eb8654 commit d0cf5d7

File tree

9 files changed

+120
-0
lines changed

9 files changed

+120
-0
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,11 @@ credits = [
595595
'2013-present Facebook Inc.',
596596
'MIT',
597597
'https://raw.githubusercontent.com/facebook/react/master/LICENSE'
598+
], [
599+
'ReactiveX',
600+
'ReactiveX contributors',
601+
'Apache',
602+
'https://raw.githubusercontent.com/ReactiveX/reactivex.github.io/develop/LICENSE'
598603
], [
599604
'Redis',
600605
'2009-2018 Salvatore Sanfilippo',

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
'pages/ramda',
9090
'pages/rdoc',
9191
'pages/react_native',
92+
'pages/reactivex',
9293
'pages/redis',
9394
'pages/rethinkdb',
9495
'pages/rfc',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
._reactivex {
2+
@extend %simple;
3+
4+
img {
5+
max-width: 50%;
6+
}
7+
8+
figure {
9+
margin: 0;
10+
}
11+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
module Docs
2+
class Reactivex
3+
class CleanHtmlFilter < Filter
4+
def call
5+
# Can't use options[:container] because then the navigation bar wouldn't be scraped
6+
@doc = at_css(root_page? ? '.col-md-8' : '.col-sm-8')
7+
8+
# Remove breadcrumbs
9+
css('.breadcrumb').remove
10+
11+
# Replace interactive demo's with links to them
12+
css('rx-marbles').each do |node|
13+
node.name = 'a'
14+
node.content = 'Open interactive diagram on rxmarbles.com'
15+
node['href'] = "https://rxmarbles.com/##{node['key']}"
16+
node.remove_attribute('key')
17+
end
18+
19+
# Syntax-highlighted code blocks
20+
css('.code').each do |node|
21+
language = node['class'].gsub('code', '').strip
22+
23+
pre = node.at_css('pre')
24+
pre['data-language'] = language
25+
pre.content = pre.content.strip
26+
27+
node.replace(pre)
28+
end
29+
30+
# Assume JavaScript syntax for code blocks not surrounded by a div.code
31+
css('pre').each do |node|
32+
next if node['data-language']
33+
34+
node.content = node.content.strip
35+
node['data-language'] = 'javascript'
36+
end
37+
38+
# Make language specific implementation titles prettier
39+
css('.panel-title').each do |node|
40+
# Remove the link, keep the text
41+
node.content = node.content
42+
43+
# Transform it into a header for better styling
44+
node.name = 'h3'
45+
end
46+
47+
# Remove language specific implementations that are TBD
48+
css('span').each do |node|
49+
next unless node.content == 'TBD'
50+
node.xpath('./ancestor::div[contains(@class, "panel-default")][1]').remove
51+
end
52+
53+
# Remove the : at the end of "Language-Specific Information:"
54+
css('h2').each do |node|
55+
node.inner_html = node.inner_html.gsub('Information:', 'Information')
56+
end
57+
58+
# Remove attributes to reduce file size
59+
css('div').remove_attr('class')
60+
61+
doc
62+
end
63+
end
64+
end
65+
end

lib/docs/filters/reactivex/entries.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Docs
2+
class Reactivex
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
at_css('h1').content
6+
end
7+
8+
def get_type
9+
links = css('.breadcrumb > li:nth-child(2) > a')
10+
links.size > 0 ? links.first.content : 'Manual'
11+
end
12+
end
13+
end
14+
end

lib/docs/scrapers/reactivex.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Docs
2+
class Reactivex < UrlScraper
3+
self.type = 'reactivex'
4+
self.name = 'ReactiveX'
5+
self.base_url = 'http://reactivex.io/'
6+
self.root_path = 'intro.html'
7+
self.links = {
8+
home: 'http://reactivex.io/'
9+
}
10+
11+
html_filters.push 'reactivex/entries', 'reactivex/clean_html'
12+
13+
options[:download_images] = false
14+
15+
options[:only_patterns] = [/documentation\//]
16+
options[:skip_patterns] = [/ko\//]
17+
18+
options[:attribution] = <<-HTML
19+
&copy; ReactiveX contributors<br>
20+
Licensed under the Apache License 2.0.
21+
HTML
22+
end
23+
end

public/icons/docs/reactivex/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/ReactiveX/reactivex.github.io/blob/develop/assets/Rx_Icon.png

public/icons/docs/reactivex/logo.png

1.49 KB
Loading
4.96 KB
Loading

0 commit comments

Comments
 (0)