1
0

react_native.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module Docs
  2. class ReactNative < UrlScraper
  3. self.name = 'React Native'
  4. self.slug = 'react_native'
  5. self.type = 'react_native'
  6. self.release = '0.66'
  7. self.base_url = 'https://reactnative.dev/docs/'
  8. self.root_path = 'getting-started.html'
  9. self.links = {
  10. home: 'https://reactnative.dev/',
  11. code: 'https://github.com/facebook/react-native'
  12. }
  13. html_filters.push 'react_native/entries', 'react_native/clean_html'
  14. options[:skip_patterns] = [/\Asample\-/, /\A0\./, /\Anext\b/]
  15. options[:skip] = %w(
  16. videos.html
  17. transforms.html
  18. troubleshooting.html
  19. more-resources.html
  20. )
  21. options[:fix_urls] = ->(url) {
  22. url.sub! 'docs/docs', 'docs'
  23. url
  24. }
  25. # https://github.com/facebook/react-native-website/blob/main/LICENSE-docs
  26. options[:attribution] = <<-HTML
  27. &copy; 2022 Facebook Inc.<br>
  28. Licensed under the Creative Commons Attribution 4.0 International Public License.
  29. HTML
  30. def get_latest_version(opts)
  31. doc = fetch_doc('https://reactnative.dev/docs/getting-started', opts)
  32. doc.at_css('meta[name="docsearch:version"]')['content']
  33. end
  34. end
  35. end