laravel.rb 1.1 KB

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