[devdocsgjs/main: 123/239] Add React Router documentation (6.2.1)




commit c12b8e4797435eb521cc4cf0f5d7d6297a7766d4
Author: Simon Legner <Simon Legner gmail com>
Date:   Wed Jan 12 21:09:41 2022 +0100

    Add React Router documentation (6.2.1)

 assets/javascripts/news.json                       |   4 ++++
 .../javascripts/templates/pages/about_tmpl.coffee  |   5 ++++
 lib/docs/filters/react_router/clean_html.rb        |  14 +++++++++++
 lib/docs/filters/react_router/entries.rb           |  13 +++++++++++
 lib/docs/scrapers/react_router.rb                  |  26 +++++++++++++++++++++
 public/icons/docs/react_router/16.png              | Bin 0 -> 795 bytes
 public/icons/docs/react_router/16 2x png           | Bin 0 -> 1536 bytes
 public/icons/docs/react_router/SOURCE              |   1 +
 8 files changed, 63 insertions(+)
---
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index c394c7e3..4e81919b 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,4 +1,8 @@
 [
+  [
+    "2021-01-12",
+    "New documentation: <a href=\"/react_router/\">React Router</a>"
+  ],
   [
     "2022-01-09",
     "New documentation: <a href=\"/deno/\">Deno</a>"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index c462994f..a9a62681 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -732,6 +732,11 @@ credits = [
     '2014-present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff',
     'MIT',
     'https://raw.githubusercontent.com/react-bootstrap/react-bootstrap/master/LICENSE'
+  ], [
+    'React Router',
+    'React Training 2015-2019<br>Remix Software 2020-2021',
+    'MIT',
+    'https://raw.githubusercontent.com/remix-run/react-router/main/LICENSE.md'
   ], [
     'ReactiveX',
     'ReactiveX contributors',
diff --git a/lib/docs/filters/react_router/clean_html.rb b/lib/docs/filters/react_router/clean_html.rb
new file mode 100644
index 00000000..9d0828ff
--- /dev/null
+++ b/lib/docs/filters/react_router/clean_html.rb
@@ -0,0 +1,14 @@
+module Docs
+  class ReactRouter
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.md-prose')
+        css('pre').each do |node|
+          node.content = node.css('.codeblock-line').map(&:content).join("")
+          node['data-language'] = 'javascript'
+        end
+        doc
+      end
+    end
+  end
+end
diff --git a/lib/docs/filters/react_router/entries.rb b/lib/docs/filters/react_router/entries.rb
new file mode 100644
index 00000000..862cf572
--- /dev/null
+++ b/lib/docs/filters/react_router/entries.rb
@@ -0,0 +1,13 @@
+module Docs
+  class ReactRouter
+    class EntriesFilter < Docs::EntriesFilter
+      def additional_entries
+        entries = []
+        css('h2[id], h3[id]').each do |node|
+          entries << [node.content, node['id'], 'API Reference']
+        end
+        entries
+      end
+    end
+  end
+end
diff --git a/lib/docs/scrapers/react_router.rb b/lib/docs/scrapers/react_router.rb
new file mode 100644
index 00000000..6cb84c41
--- /dev/null
+++ b/lib/docs/scrapers/react_router.rb
@@ -0,0 +1,26 @@
+module Docs
+  class ReactRouter < UrlScraper
+    self.name = 'React Router'
+    self.slug = 'react_router'
+    self.type = 'simple'
+    self.release = '6.2.1'
+    self.base_url = 'https://reactrouterdotcom.fly.dev/docs/en/v6/api'
+
+    self.links = {
+      home: 'https://reactrouterdotcom.fly.dev/',
+      code: 'https://github.com/remix-run/react-router'
+    }
+
+    html_filters.push 'react_router/entries', 'react_router/clean_html', 'title'
+
+    options[:attribution] = <<-HTML
+      &copy; React Training 2015-2019<br>
+      &copy; Remix Software 2020-2021<br>
+      Licensed under the MIT License (MIT).
+    HTML
+
+    def get_latest_version(opts)
+      get_npm_version('react-router', opts)
+    end
+  end
+end
diff --git a/public/icons/docs/react_router/16.png b/public/icons/docs/react_router/16.png
new file mode 100644
index 00000000..3f6a9fbb
Binary files /dev/null and b/public/icons/docs/react_router/16.png differ
diff --git a/public/icons/docs/react_router/16 2x png b/public/icons/docs/react_router/16 2x png
new file mode 100644
index 00000000..55ae36cd
Binary files /dev/null and b/public/icons/docs/react_router/16 2x png differ
diff --git a/public/icons/docs/react_router/SOURCE b/public/icons/docs/react_router/SOURCE
new file mode 100644
index 00000000..b2605efd
--- /dev/null
+++ b/public/icons/docs/react_router/SOURCE
@@ -0,0 +1 @@
+https://reactrouterdotcom.fly.dev/favicon.ico


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]