knockout.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module Docs
  2. class Knockout < UrlScraper
  3. self.name = 'Knockout.js'
  4. self.slug = 'knockout'
  5. self.type = 'knockout'
  6. self.release = '3.5.1'
  7. self.base_url = 'https://knockoutjs.com/documentation/'
  8. self.root_path = 'introduction.html'
  9. self.links = {
  10. home: 'https://knockoutjs.com/',
  11. code: 'https://github.com/knockout/knockout'
  12. }
  13. html_filters.push 'knockout/clean_html', 'knockout/entries'
  14. options[:follow_links] = ->(filter) { filter.root_page? }
  15. options[:container] = ->(filter) { filter.root_page? ? '#wrapper' : '.content' }
  16. options[:only] = %w(
  17. json-data.html
  18. extenders.html
  19. deferred-updates.html
  20. unobtrusive-event-handling.html
  21. fn.html
  22. microtasks.html
  23. asynchronous-error-handling.html
  24. amd-loading.html)
  25. options[:only_patterns] = [
  26. /observable/i,
  27. /computed/i,
  28. /component/i,
  29. /binding/,
  30. /plugin/]
  31. options[:attribution] = <<-HTML
  32. &copy; Steven Sanderson, the Knockout.js team, and other contributors<br>
  33. Licensed under the MIT License.
  34. HTML
  35. def get_latest_version(opts)
  36. get_latest_github_release('knockout', 'knockout', opts)
  37. end
  38. end
  39. end