History

Merge pull request #1692 from freeCodeCamp/react_router

Add React Router documentation (6.2.1)

Simon Legner committed 4 years ago

Commit 215c57e2 parents bd6ca4b c12b8e48 files · +61 −-2Browse files

Unified · Split

8 files
  1. assets/javascripts/news.json +4 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. lib/docs/filters/react_router/clean_html.rb +14 −0
  4. lib/docs/filters/react_router/entries.rb +13 −0
  5. lib/docs/scrapers/react_router.rb +26 −0
  6. public/icons/docs/react_router/16.png +0 −0
  7. public/icons/docs/react_router/16@2x.png +0 −0
  8. public/icons/docs/react_router/SOURCE +1 −0
assets/javascripts/news.json+4−0
@@ -1,4 +1,8 @@
11 [
2+ [
3+ "2021-01-12",
4+ "New documentation: <a href=\"/react_router/\">React Router</a>"
5+ ],
26 [
37 "2022-01-09",
48 "New documentation: <a href=\"/deno/\">Deno</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -732,6 +732,11 @@ credits = [ · 731 unmodified lines
732732 '2014-present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff',
733733 'MIT',
734734 'https://raw.githubusercontent.com/react-bootstrap/react-bootstrap/master/LICENSE'
735+ ], [
736+ 'React Router',
737+ 'React Training 2015-2019<br>Remix Software 2020-2021',
738+ 'MIT',
739+ 'https://raw.githubusercontent.com/remix-run/react-router/main/LICENSE.md'
735740 ], [
736741 'ReactiveX',
737742 'ReactiveX contributors',
lib/docs/filters/react_router/clean_html.rb+14−0
@@ -0,0 +1,14 @@
1+module Docs
2+ class ReactRouter
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('.md-prose')
6+ css('pre').each do |node|
7+ node.content = node.css('.codeblock-line').map(&:content).join("")
8+ node['data-language'] = 'javascript'
9+ end
10+ doc
11+ end
12+ end
13+ end
14+end
lib/docs/filters/react_router/entries.rb+13−0
@@ -0,0 +1,13 @@
1+module Docs
2+ class ReactRouter
3+ class EntriesFilter < Docs::EntriesFilter
4+ def additional_entries
5+ entries = []
6+ css('h2[id], h3[id]').each do |node|
7+ entries << [node.content, node['id'], 'API Reference']
8+ end
9+ entries
10+ end
11+ end
12+ end
13+end
lib/docs/scrapers/react_router.rb+26−0
@@ -0,0 +1,26 @@
1+module Docs
2+ class ReactRouter < UrlScraper
3+ self.name = 'React Router'
4+ self.slug = 'react_router'
5+ self.type = 'simple'
6+ self.release = '6.2.1'
7+ self.base_url = 'https://reactrouterdotcom.fly.dev/docs/en/v6/api'
8+
9+ self.links = {
10+ home: 'https://reactrouterdotcom.fly.dev/',
11+ code: 'https://github.com/remix-run/react-router'
12+ }
13+
14+ html_filters.push 'react_router/entries', 'react_router/clean_html', 'title'
15+
16+ options[:attribution] = <<-HTML
17+ &copy; React Training 2015-2019<br>
18+ &copy; Remix Software 2020-2021<br>
19+ Licensed under the MIT License (MIT).
20+ HTML
21+
22+ def get_latest_version(opts)
23+ get_npm_version('react-router', opts)
24+ end
25+ end
26+end
public/icons/docs/react_router/16.png+0−0

Binary file not shown.

public/icons/docs/react_router/16@2x.png+0−0

Binary file not shown.

public/icons/docs/react_router/SOURCE+1−0
@@ -0,0 +1 @@
1+https://reactrouterdotcom.fly.dev/favicon.ico

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t