From 6f1a9aab21feb3d5996b565d4ca47bf0ee59fe38 Mon Sep 17 00:00:00 2001 From: dohsimpson Date: Sat, 20 Feb 2021 11:50:37 -0500 Subject: [PATCH] Added Documentation for React-bootstrap --- .../filters/react_bootstrap/clean_html.rb | 17 +++++++++ lib/docs/filters/react_bootstrap/entries.rb | 23 ++++++++++++ lib/docs/scrapers/react_bootstrap.rb | 34 ++++++++++++++++++ public/icons/docs/react_bootstrap/16.png | Bin 0 -> 642 bytes public/icons/docs/react_bootstrap/16@2x.png | Bin 0 -> 1445 bytes public/icons/docs/react_bootstrap/SOURCE | 1 + 6 files changed, 75 insertions(+) create mode 100644 lib/docs/filters/react_bootstrap/clean_html.rb create mode 100644 lib/docs/filters/react_bootstrap/entries.rb create mode 100644 lib/docs/scrapers/react_bootstrap.rb create mode 100644 public/icons/docs/react_bootstrap/16.png create mode 100644 public/icons/docs/react_bootstrap/16@2x.png create mode 100644 public/icons/docs/react_bootstrap/SOURCE 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 0000000000000000000000000000000000000000..99a688b9a15414f414bac9849baabc3dabf871aa GIT binary patch literal 642 zcmV-|0)737P)@6b{|%)F=K^YQFT=;%T9FNc|T3usSn^9pB+;bKkcQe0kKZ34qY5 z=M^|zzg@@&<}J=jf?Lr(*XH!G`OKY{#(Qh=G`8|qfe@2Y2JrR;vuDg=Z7{VYmK)s= zeEBtK6|kpNk3+2j_8Tc|>8-|PD3%bTz#y=JOnb{68U|Q5?2ar?BevG$06kTA1^KA) zM(_lp04hd@6>{3#N(vS%QY=&Hw-a literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..368fdaeca8b571f5b55ea5dde1a62217add1624d GIT binary patch literal 1445 zcmV;W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jFjOWtGWu+}xG zd9mp{;HX7e^C}^^2&2FYzzZt|{7MXQAMmbf@Z*hxr3l?UJ-o4x{Fh@NtC-r1hp z4C=3GBxzQs2~H`7Tc2I56Rn2Q;{cBF(uux}b|{q6d%?XkBt9c}A|-V1?9v`+F_ebr zAxlVlU(cZD7CZHCfaN8>XZMgF0aj+AFIwSVQ$5kFmSV0#;8@!j2e&WP`HOtbl6r={ zKx6R`&<5&9ehzCH_|s57ay`>l(QVnN^}5jd&uKY*Q07}xxJD3tH!KN1-Y8A%4{w}+ zHFk2m9PcsQ1uPW29O3CChM)I$=^y_KaUK5!=r%jj*n#1$00000NkvXXu0mjfZB@x- literal 0 HcmV?d00001 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