1
0

typescript.rb 1.5 KB

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