diff --git a/lib/docs/filters/react_bootstrap/clean_html.rb b/lib/docs/filters/react_bootstrap/clean_html.rb new file mode 100644 index 00000000..6f73ab46 --- /dev/null +++ b/lib/docs/filters/react_bootstrap/clean_html.rb @@ -0,0 +1,17 @@ +module Docs + class ReactBootstrap + class CleanHtmlFilter < Filter + def call + css('.flex-column.d-flex').remove + css('header').remove + css('.bs-example').remove + css('.position-relative').each do |node| + code = node.at_css('textarea') + code.name = 'pre' + code['style'] = code['style'] + '; border: solid 1px;' + end + doc + end + end + end +end diff --git a/lib/docs/filters/react_bootstrap/entries.rb b/lib/docs/filters/react_bootstrap/entries.rb new file mode 100644 index 00000000..45df5da3 --- /dev/null +++ b/lib/docs/filters/react_bootstrap/entries.rb @@ -0,0 +1,23 @@ +module Docs + class ReactBootstrap + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('#rb-docs-content h1, #rb-docs-content h2').content + if name.end_with? '#' + name = name[0..-2] + end + name + end + + def get_type + type = slug.split('/')[0..-2].join(': ') + if type == '' + type = slug.split('/').join('') + end + type.gsub!('-', ' ') + type.split.map(&:capitalize).join(' ') + type + end + end + end +end diff --git a/lib/docs/scrapers/react_bootstrap.rb b/lib/docs/scrapers/react_bootstrap.rb new file mode 100644 index 00000000..9f60e855 --- /dev/null +++ b/lib/docs/scrapers/react_bootstrap.rb @@ -0,0 +1,34 @@ +module Docs + class ReactBootstrap < UrlScraper + self.slug = 'react_bootstrap' + self.type = 'simple' + self.release = '1.5.0' + self.base_url = 'https://react-bootstrap.github.io/' + + self.links = { + home: 'https://react-bootstrap.github.io', + code: 'https://github.com/react-bootstrap/react-bootstrap' + } + + html_filters.push 'react_bootstrap/entries', 'react_bootstrap/clean_html' + + options[:skip] = %w( + react-overlays/ + ) + + options[:replace_paths] = { + } + + options[:trailing_slash] = true + + options[:attribution] = <<-HTML + © 2014–present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff
+ Licensed under the MIT License (MIT). + HTML + + def get_latest_version(opts) + doc = fetch_doc('https://react-bootstrap.github.io/', opts) + doc.at_css('#t-version>a').content.split()[0].strip[1..-1] + end + end +end diff --git a/public/icons/docs/react_bootstrap/16.png b/public/icons/docs/react_bootstrap/16.png new file mode 100644 index 00000000..99a688b9 Binary files /dev/null and b/public/icons/docs/react_bootstrap/16.png differ diff --git a/public/icons/docs/react_bootstrap/16@2x.png b/public/icons/docs/react_bootstrap/16@2x.png new file mode 100644 index 00000000..368fdaec Binary files /dev/null and b/public/icons/docs/react_bootstrap/16@2x.png differ diff --git a/public/icons/docs/react_bootstrap/SOURCE b/public/icons/docs/react_bootstrap/SOURCE new file mode 100644 index 00000000..1dd0687a --- /dev/null +++ b/public/icons/docs/react_bootstrap/SOURCE @@ -0,0 +1 @@ +https://github.com/react-bootstrap/react-bootstrap/blob/master/www/static/logo.svg