typescript.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. module Docs
  2. class Typescript < UrlScraper
  3. include MultipleBaseUrls
  4. self.name = 'TypeScript'
  5. self.type = 'typescript'
  6. self.release = '5.3.3'
  7. self.base_urls = [
  8. 'https://www.typescriptlang.org/docs/handbook/',
  9. 'https://www.typescriptlang.org/'
  10. ]
  11. self.root_path = 'docs/'
  12. def initial_urls
  13. [ 'https://www.typescriptlang.org/docs/handbook/',
  14. 'https://www.typescriptlang.org/tsconfig' ]
  15. end
  16. self.links = {
  17. home: 'https://www.typescriptlang.org',
  18. code: 'https://github.com/Microsoft/TypeScript'
  19. }
  20. html_filters.push 'typescript/entries', 'typescript/clean_html', 'title'
  21. options[:fix_urls_before_parse] = ->(url) do
  22. url.sub! '/docs/handbook/esm-node.html', '/docs/handbook/modules/reference.html#node16-nodenext'
  23. url.sub! '/docs/handbook/modules.html', '/docs/handbook/modules/introduction.html'
  24. url
  25. end
  26. options[:skip] = [
  27. 'react-&-webpack.html'
  28. ]
  29. options[:skip_patterns] = [
  30. /\Abranding/,
  31. /\Acommunity/,
  32. /\Adocs\Z/,
  33. /\Atools/,
  34. /release-notes/,
  35. /dt\/search/,
  36. /play/
  37. ]
  38. options[:attribution] = <<-HTML
  39. &copy; 2012-2023 Microsoft<br>
  40. Licensed under the Apache License, Version 2.0.
  41. HTML
  42. def get_latest_version(opts)
  43. get_latest_github_release('Microsoft', 'TypeScript', opts)
  44. end
  45. end
  46. end