Unified · Split
| @@ -0,0 +1,11 @@ | ||
| 1 | +module Docs | |
| 2 | + class React | |
| 3 | + class CleanHtmlReactDevFilter < Filter | |
| 4 | + def call | |
| 5 | + @doc = at_css('article') | |
| 6 | + | |
| 7 | + doc | |
| 8 | + end | |
| 9 | + end | |
| 10 | + end | |
| 11 | +end | |
| @@ -0,0 +1,13 @@ | ||
| 1 | +module Docs | |
| 2 | + class React | |
| 3 | + class EntriesReactDevFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + at_css('article h1').content | |
| 6 | + end | |
| 7 | + | |
| 8 | + def get_type | |
| 9 | + return 'TODO add types' | |
| 10 | + end | |
| 11 | + end | |
| 12 | + end | |
| 13 | +end | |
| @@ -7,6 +7,19 @@ module Docs · 6 unmodified lines | ||
| 7 | 7 | code: 'https://github.com/facebook/react' |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | + version do | |
| 11 | + self.release = '18.3.1' | |
| 12 | + # TODO add /learn | |
| 13 | + self.base_url = 'https://react.dev/reference' | |
| 14 | + | |
| 15 | + html_filters.push 'react/entries_react_dev', 'react/clean_html_react_dev' | |
| 16 | + | |
| 17 | + options[:attribution] = <<-HTML | |
| 18 | + © 2013–present Facebook Inc.<br> | |
| 19 | + Licensed under the Creative Commons Attribution 4.0 International Public License. | |
| 20 | + HTML | |
| 21 | + end | |
| 22 | + | |
| 10 | 23 | version '17' do |
| 11 | 24 | self.release = '17.0.2' |
| 12 | 25 | self.base_url = 'https://17.reactjs.org/docs/' |
| @@ -33,7 +46,6 @@ module Docs · 20 unmodified lines | ||
| 33 | 46 | HTML |
| 34 | 47 | end |
| 35 | 48 | |
| 36 | − | |
| 37 | 49 | def get_latest_version(opts) |
| 38 | 50 | doc = fetch_doc('https://react.dev/', opts) |
| 39 | 51 | doc.at_css('a[href="/versions"]').content.strip[1..-1] |