From c12b8e4797435eb521cc4cf0f5d7d6297a7766d4 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Wed, 12 Jan 2022 21:09:41 +0100 Subject: [PATCH] Add React Router documentation (6.2.1) --- assets/javascripts/news.json | 4 +++ .../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(+) create mode 100644 lib/docs/filters/react_router/clean_html.rb create mode 100644 lib/docs/filters/react_router/entries.rb create mode 100644 lib/docs/scrapers/react_router.rb create mode 100644 public/icons/docs/react_router/16.png create mode 100644 public/icons/docs/react_router/16@2x.png create mode 100644 public/icons/docs/react_router/SOURCE 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 0000000000000000000000000000000000000000..3f6a9fbbad8adcd2c677ecedca4eafa77fc43e7e GIT binary patch literal 795 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>fyyE`f{xXVyYi4`I({62W6ETBp8;sb&9t?-cWQ3EPjC zwoD0s=CF8m*zpFrh!(6lJtbZC@d3V&U#nQZFXD7~^fpS)Rg%TThCSQ$%wwRzj7i?^ zE>X<8mo5Tw*h@TpUD=;8@`!MVYzm(E4k)zP)5S4F;&O6=0-u4AArs>yhRF*iY~WBf zp2QVsSjg!n*21xRNkz*P6J=#->lxb0+Un~UtXQ&U(Ww)RVgbR|FFbj2=~CZ?i%;3O zPrQ05{Xs%X(tXB^PeukaW=2OuMc%$~>!!7ZmE?@sh8FI-b{K8gwbQ+#;#1@<7c1i( z6_vjY41WFk$!=iuqoR7J0Sg-|^Ibt9DY0|<2Lxn9I7%f1K71B_>CbTPf~dh_?L{#_ z=c<;tMwFx^mZVxG7o`Fz1|tI_BV7YST|=V~BLgb~3oAooZ37^~;Me8&02B?m`6-!c XmAEx@_dS0D)WG2B>gTe~DWM4fp*Z27 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..55ae36cd777bfaee8282e4b9c825327233ebd5bf GIT binary patch literal 1536 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+0815<8*Plzi}!9`}7i%c>X zn4~WD|l{7Z{~ZF-l)%m0QHXaEw8OiGkq^lhio|iL*@drCpw$2W|9!c4XaZShN`m}?k#!Nr=HO;z^O?CgT`1te=UNW# zg_m{t*Su%S{qm=VnOjkc`OMS5w~O7)Wtr8coZ6el#jffw>DTM~2a~u2=KOmZBK%DE zI$K>oo7SaXmJZgAA9q}&)?IfLv#}BuFIhL=n^n**v25*|tH)UlmOg&CK$V$a?(z3< zZ3W)de>+)zGd|lTD6k>$^b*eLr`2O_{<-RTK7+-!w%UTpxV+Jmlaa&e?roqS7?Zr+ zUCw>E`RPB9!(QU)>&pI&kw=6>W>1IY9ia3MPZ!4!i_^&o5=9LYCw9)9*ebf*##nmy z#EqQB?CN@dW0s{o6Pp%x=FAR}g6P|GER(a-&mZfEW$bT$EU8dXl=kfC!UIP|mmD}d ztAC>WYDuPda`PNmg-~=GdSF-Nqcx#EX#%9eQaKQc|X9 zePmjxq3g`o_lavl(!A3fdpmuC=b-w$IURTBP5;jhrg??<`utF)=$g z`+Y*fi#M;{y?h(|YQ90?rIg#6!OJ6Ce8b;mOD;_ICQpk`nNSRjU}e7x2P^VdMar`