laravel.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module Docs
  2. class Laravel < UrlScraper
  3. self.name = 'Laravel'
  4. self.slug = 'laravel'
  5. self.type = 'laravel'
  6. self.version = '5.1.1'
  7. self.base_url = 'http://laravel.com'
  8. self.root_path = '/api/5.1/index.html'
  9. self.initial_paths = %w(/docs/5.1/installation /api/5.1/classes.html)
  10. self.links = {
  11. home: 'http://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\.1\//,
  20. /\A\/docs\/5\.1\//]
  21. options[:skip] = %w(
  22. /docs/5.1/quick
  23. /docs/5.1/releases
  24. /docs/5.1/artisan
  25. /docs/5.1/commands
  26. /api/5.1/panel.html
  27. /api/5.1/namespaces.html
  28. /api/5.1/interfaces.html
  29. /api/5.1/traits.html
  30. /api/5.1/doc-index.html
  31. /api/5.1/Illuminate.html
  32. /api/5.1/search.html)
  33. options[:fix_urls] = ->(url) do
  34. url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.1/"
  35. url
  36. end
  37. options[:attribution] = <<-HTML
  38. &copy; Taylor Otwell<br>
  39. Licensed under the MIT License.
  40. HTML
  41. end
  42. end