laravel.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. module Docs
  2. class Laravel < UrlScraper
  3. self.name = 'Laravel'
  4. self.slug = 'laravel'
  5. self.type = 'laravel'
  6. self.release = '5.2.0'
  7. self.base_url = 'https://laravel.com'
  8. self.root_path = '/api/5.2/index.html'
  9. self.initial_paths = %w(/docs/5.2/installation /api/5.2/classes.html)
  10. self.links = {
  11. home: 'https://laravel.com/',
  12. code: 'https://github.com/laravel/laravel'
  13. }
  14. html_filters.push 'laravel/entries', 'laravel/clean_html'
  15. options[:container] = ->(filter) {
  16. filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper'
  17. }
  18. options[:only_patterns] = [
  19. /\A\/api\/5\.2\//,
  20. /\A\/docs\/5\.2\//]
  21. options[:skip] = %w(
  22. /docs/5.2/quick
  23. /docs/5.2/releases
  24. /docs/5.2/artisan
  25. /docs/5.2/commands
  26. /api/5.2/.html
  27. /api/5.2/panel.html
  28. /api/5.2/namespaces.html
  29. /api/5.2/interfaces.html
  30. /api/5.2/traits.html
  31. /api/5.2/doc-index.html
  32. /api/5.2/Illuminate.html
  33. /api/5.2/search.html)
  34. options[:fix_urls] = ->(url) do
  35. url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.2/"
  36. url
  37. end
  38. options[:attribution] = <<-HTML
  39. &copy; Taylor Otwell<br>
  40. Licensed under the MIT License.
  41. HTML
  42. end
  43. end