typescript.rb 974 B

1234567891011121314151617181920212223242526272829303132
  1. module Docs
  2. class Typescript < UrlScraper
  3. self.name = 'TypeScript'
  4. self.type = 'simple'
  5. self.release = '3.7.4'
  6. self.base_url = 'https://www.typescriptlang.org/docs/'
  7. self.root_path = 'tutorial.html'
  8. self.links = {
  9. home: 'https://www.typescriptlang.org',
  10. code: 'https://github.com/Microsoft/TypeScript'
  11. }
  12. html_filters.push 'typescript/entries', 'typescript/clean_html'
  13. options[:container] = '#doc-content'
  14. options[:skip] = %w(home.html handbook/release-notes/overview.html)
  15. options[:skip_link] = ->(node) { node.parent.parent['class'] == 'dropdown-menu' }
  16. options[:fix_urls] = ->(url) {
  17. url.sub!(/(\w+)\.md/) { "#{$1.downcase}.html" }
  18. url
  19. }
  20. options[:attribution] = <<-HTML
  21. &copy; 2012-2019 Microsoft<br>
  22. Licensed under the Apache License, Version 2.0.
  23. HTML
  24. def get_latest_version(opts)
  25. get_latest_github_release('Microsoft', 'TypeScript', opts)
  26. end
  27. end
  28. end