mirror of https://github.com/freeCodeCamp/devdocs
commit
fdb9701e33
@ -0,0 +1,51 @@
|
||||
._reactivex {
|
||||
@extend %simple;
|
||||
|
||||
img {
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
dfn {
|
||||
cursor: text;
|
||||
font-style: italic;
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#tree {
|
||||
dt, dd {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
dt {
|
||||
float: left;
|
||||
clear: left;
|
||||
|
||||
margin-top: 0;
|
||||
|
||||
&:before {
|
||||
content: "\2026";
|
||||
}
|
||||
}
|
||||
|
||||
dd:not(.sub) {
|
||||
float: left;
|
||||
|
||||
margin: 0 0 0 5px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
dl#outer > dt {
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
|
||||
& + dd {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
module Docs
|
||||
class Reactivex
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Can't use options[:container] because then the navigation bar wouldn't be scraped
|
||||
@doc = at_css(root_page? ? '.col-md-8' : '.col-sm-8')
|
||||
|
||||
# Remove breadcrumbs
|
||||
css('.breadcrumb').remove
|
||||
|
||||
# Titleize title on Backpressure Operators page
|
||||
if subpath == 'documentation/operators/backpressure.html'
|
||||
title = at_css('h1')
|
||||
title.content = title.content.titleize
|
||||
end
|
||||
|
||||
# Lower all h1 headers except the first one
|
||||
css('* + h1').each do |node|
|
||||
node.name = 'h2'
|
||||
end
|
||||
|
||||
# Pull code blocks in links out of their <strong> parent (if possible)
|
||||
css('a > strong > code').each do |node|
|
||||
# Skip if the parent had multiple code nodes and node.parent.replace already ran for one
|
||||
next unless node.parent.name == 'strong'
|
||||
|
||||
node.parent.replace node.parent.children
|
||||
end
|
||||
|
||||
# Pull header out of trees
|
||||
tree = at_css('#tree')
|
||||
unless tree.nil?
|
||||
title = tree.at_css('h1')
|
||||
title.name = 'h2'
|
||||
tree.before(title)
|
||||
end
|
||||
|
||||
# Beautify operator descriptions
|
||||
at_css('h3').name = 'blockquote' if subpath.include?('operators/')
|
||||
|
||||
# Replace interactive demo's with links to them
|
||||
css('rx-marbles').each do |node|
|
||||
node.name = 'a'
|
||||
node.content = 'Open interactive diagram on rxmarbles.com'
|
||||
node['href'] = "https://rxmarbles.com/##{node['key']}"
|
||||
node.remove_attribute('key')
|
||||
end
|
||||
|
||||
# Syntax-highlighted code blocks
|
||||
css('.code').each do |node|
|
||||
language = node['class'].gsub('code', '').strip
|
||||
|
||||
pre = node.at_css('pre')
|
||||
pre['data-language'] = language
|
||||
pre.content = pre.content.strip
|
||||
|
||||
node.replace(pre)
|
||||
end
|
||||
|
||||
# Assume JavaScript syntax for code blocks not surrounded by a div.code
|
||||
css('pre').each do |node|
|
||||
next if node['data-language']
|
||||
|
||||
node.content = node.content.strip
|
||||
node['data-language'] = 'javascript'
|
||||
end
|
||||
|
||||
# Make language specific implementation titles prettier
|
||||
css('.panel-title').each do |node|
|
||||
# Remove the link, keep the children
|
||||
link = node.at_css('a')
|
||||
link.replace(link.children) unless link.nil?
|
||||
|
||||
# Transform it into a header for better styling
|
||||
node.name = 'h3'
|
||||
end
|
||||
|
||||
# Remove language specific implementations that are TBD
|
||||
css('span').each do |node|
|
||||
next unless node.content == 'TBD'
|
||||
node.xpath('./ancestor::div[contains(@class, "panel-default")][1]').remove
|
||||
end
|
||||
|
||||
# Remove the : at the end of "Language-Specific Information:"
|
||||
css('h2').each do |node|
|
||||
node.inner_html = node.inner_html.gsub('Information:', 'Information')
|
||||
end
|
||||
|
||||
# Remove attributes to reduce file size
|
||||
css('div').remove_attr('class')
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Reactivex
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
title = at_css('h1').content
|
||||
title = title.titleize if is_backpressure_operators?
|
||||
title
|
||||
end
|
||||
|
||||
def get_type
|
||||
return 'Manual' if is_backpressure_operators?
|
||||
links = css('.breadcrumb > li:nth-child(2) > a')
|
||||
links.size > 0 ? links.first.content : 'Manual'
|
||||
end
|
||||
|
||||
def is_backpressure_operators?
|
||||
subpath == 'documentation/operators/backpressure.html'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
module Docs
|
||||
class Reactivex < UrlScraper
|
||||
self.name = 'ReactiveX'
|
||||
self.type = 'reactivex'
|
||||
self.base_url = 'http://reactivex.io/'
|
||||
self.root_path = 'intro.html'
|
||||
self.links = {
|
||||
home: 'http://reactivex.io/'
|
||||
}
|
||||
|
||||
html_filters.push 'reactivex/entries', 'reactivex/clean_html'
|
||||
|
||||
options[:download_images] = false
|
||||
|
||||
options[:only_patterns] = [/documentation\//]
|
||||
options[:skip_patterns] = [/ko\//]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© ReactiveX contributors<br>
|
||||
Licensed under the Apache License 2.0.
|
||||
HTML
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_latest_github_commit_date('ReactiveX', 'reactivex.github.io', opts)
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/ReactiveX/reactivex.github.io/blob/develop/assets/Rx_Icon.png
|
Loading…
Reference in new issue