Skip to content

Commit 7480257

Browse files
authored
Merge pull request #1486 from dohsimpson/add_react_bootstrap_doc
Added Documentation for React-bootstrap
2 parents eca9970 + b425f18 commit 7480257

File tree

8 files changed

+101
-0
lines changed

8 files changed

+101
-0
lines changed

assets/javascripts/news.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[
2+
[
3+
"2021-02-26",
4+
"New documentation: <a href=\"/react_bootstrap/\">React Bootstrap</a>"
5+
],
26
[
37
"2021-01-03",
48
"New documentation: <a href=\"/ocaml/\">OCaml</a>"

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,11 @@ credits = [
686686
'2013-present Facebook Inc.',
687687
'MIT',
688688
'https://raw.githubusercontent.com/facebook/react/master/LICENSE'
689+
], [
690+
'React Bootstrap',
691+
'2014-present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff',
692+
'MIT',
693+
'https://raw.githubusercontent.com/react-bootstrap/react-bootstrap/master/LICENSE'
689694
], [
690695
'ReactiveX',
691696
'ReactiveX contributors',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module Docs
2+
class ReactBootstrap
3+
class CleanHtmlFilter < Filter
4+
def call
5+
@doc = doc.at_css('main')
6+
7+
css('.flex-column.d-flex').remove
8+
css('header').remove
9+
css('.bs-example').remove
10+
11+
css('.position-relative pre').each do |node|
12+
node.content = node.children.map(&:content).join("\n")
13+
node.remove_attribute('style')
14+
node['data-language'] = 'jsx'
15+
node.parent.replace(node)
16+
end
17+
18+
css('div, main, pre, h1, h2, h3, h4, h5, h6, a, p').each do |node|
19+
node.delete 'class'
20+
end
21+
css('h1, h2, h3, h4, h5, h6').each do |node|
22+
node.css('a').remove
23+
node.content = node.content
24+
end
25+
26+
css('#___gatsby, #gatsby-focus-wrapper').each do |node|
27+
node.delete 'id'
28+
end
29+
doc
30+
end
31+
end
32+
end
33+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Docs
2+
class ReactBootstrap
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
name = at_css('#rb-docs-content h1, #rb-docs-content h2').content
6+
if name.end_with? '#'
7+
name = name[0..-2]
8+
end
9+
name
10+
end
11+
12+
def get_type
13+
type = slug.split('/')[0..-2].join(': ')
14+
if type == ''
15+
type = slug.split('/').join('')
16+
end
17+
type.gsub!('-', ' ')
18+
type = type.split.map(&:capitalize).join(' ')
19+
type
20+
end
21+
end
22+
end
23+
end

lib/docs/scrapers/react_bootstrap.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module Docs
2+
class ReactBootstrap < UrlScraper
3+
self.name = 'React Bootstrap'
4+
self.slug = 'react_bootstrap'
5+
self.type = 'simple'
6+
self.release = '1.5.0'
7+
self.base_url = 'https://react-bootstrap.github.io/'
8+
9+
self.links = {
10+
home: 'https://react-bootstrap.github.io',
11+
code: 'https://github.com/react-bootstrap/react-bootstrap'
12+
}
13+
14+
html_filters.push 'react_bootstrap/entries', 'react_bootstrap/clean_html'
15+
16+
options[:skip] = %w(
17+
react-overlays/
18+
)
19+
20+
options[:replace_paths] = {
21+
}
22+
23+
options[:trailing_slash] = true
24+
25+
options[:attribution] = <<-HTML
26+
&copy; 2014&ndash;present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff<br>
27+
Licensed under the MIT License (MIT).
28+
HTML
29+
30+
def get_latest_version(opts)
31+
doc = fetch_doc('https://react-bootstrap.github.io/', opts)
32+
doc.at_css('#t-version>a').content.split()[0].strip[1..-1]
33+
end
34+
end
35+
end
642 Bytes
Loading
1.41 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/react-bootstrap/react-bootstrap/blob/master/www/static/logo.svg

0 commit comments

Comments
 (0)