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 = '4.2.11'
  7. self.base_url = 'http://laravel.com'
  8. self.root_path = '/docs/4.2/introduction'
  9. self.initial_paths = %w(/api/4.2/classes.html)
  10. html_filters.push 'laravel/entries', 'laravel/clean_html'
  11. options[:container] = ->(filter) {
  12. filter.subpath.start_with?('/api') ? nil : '#documentation > article'
  13. }
  14. options[:only_patterns] = [
  15. /\A\/api\/4\.2\//,
  16. /\A\/docs\/4\.2\//]
  17. options[:skip] = %w(
  18. /docs/4.2/quick
  19. /docs/4.2/releases
  20. /docs/4.2/upgrade
  21. /docs/4.2/artisan
  22. /docs/4.2/commands
  23. /api/4.2/panel.html
  24. /api/4.2/namespaces.html
  25. /api/4.2/interfaces.html
  26. /api/4.2/traits.html
  27. /api/4.2/doc-index.html
  28. /api/4.2/Illuminate.html)
  29. options[:fix_urls] = ->(url) do
  30. url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/4.2/"
  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