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: React Router" + ], [ "2022-01-09", "New documentation: Deno" 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
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 + © React Training 2015-2019
+ © Remix Software 2020-2021
+ 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