typescript.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. module Docs
  2. class Typescript < UrlScraper
  3. self.name = 'TypeScript'
  4. self.type = 'simple'
  5. self.release = '4.1.3'
  6. self.base_url = 'https://www.typescriptlang.org/'
  7. self.root_path = 'docs/handbook/index.html'
  8. self.initial_paths = [
  9. 'tsconfig/'
  10. ]
  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[:container] = 'main'
  17. options[:skip] = [
  18. 'docs/handbook/react-&-webpack.html'
  19. ]
  20. options[:skip_patterns] = [
  21. /2/,
  22. /release-notes/
  23. ]
  24. options[:only_patterns] = [
  25. /docs\/handbook\//,
  26. /tsconfig\//
  27. ]
  28. options[:fix_urls] = -> (url) do
  29. url.gsub!(/docs\/handbook\/index.html/, "index.html")
  30. url
  31. end
  32. options[:attribution] = <<-HTML
  33. &copy; 2012-2020 Microsoft<br>
  34. Licensed under the Apache License, Version 2.0.
  35. HTML
  36. def get_latest_version(opts)
  37. get_latest_github_release('Microsoft', 'TypeScript', opts)
  38. end
  39. end
  40. end