koa.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # frozen_string_literal: true
  2. module Docs
  3. class Koa < Github
  4. self.base_url = 'https://github.com/koajs/koa/tree/master/docs'
  5. self.release = '2.14.2'
  6. self.root_path = 'api/index.md'
  7. self.initial_paths = %w[
  8. error-handling
  9. faq
  10. guide
  11. koa-vs-express
  12. migration
  13. troubleshooting
  14. api/index
  15. api/context
  16. api/request
  17. api/response
  18. ].map { |name| name + '.md' }
  19. self.links = {
  20. home: 'https://koajs.com/',
  21. code: 'https://github.com/koajs/koa'
  22. }
  23. html_filters.push 'koa/clean_html', 'koa/entries'
  24. options[:skip] = %w[middleware.gif]
  25. options[:trailing_slash] = false
  26. options[:container] = '.markdown-body'
  27. options[:fix_urls] = ->(url) do
  28. url.sub! 'https://koajs.com/#error-handling', Koa.base_url + '/error-handling.md'
  29. url
  30. end
  31. options[:attribution] = <<-HTML
  32. &copy; 2020 Koa contributors<br>
  33. Licensed under the MIT License.
  34. HTML
  35. def get_latest_version(opts)
  36. get_npm_version('koa', opts)
  37. end
  38. end
  39. end