diff --git a/lib/docs/filters/laravel/entries.rb b/lib/docs/filters/laravel/entries.rb index 4a1794df..6b7c7dcf 100644 --- a/lib/docs/filters/laravel/entries.rb +++ b/lib/docs/filters/laravel/entries.rb @@ -12,7 +12,12 @@ module Docs end def get_type - return 'Guides' unless api_page? + unless api_page? + link = at_css(".sidebar li a[href='#{result[:path].split('/').last}']") + heading = link.ancestors('li').last.at_css('> h2') + return heading ? "Guides: #{heading.content.strip}" : 'Guides' + end + type = slug.remove(%r{api/\d.\d/}).remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\') if type.end_with?('Console') diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index 9ace8204..69cba641 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -1,11 +1,7 @@ module Docs class Laravel < UrlScraper - self.name = 'Laravel' - self.slug = 'laravel' self.type = 'laravel' - self.base_url = 'https://laravel.com' - self.links = { home: 'https://laravel.com/', code: 'https://github.com/laravel/laravel' @@ -33,6 +29,19 @@ module Docs Laravel is a trademark of Taylor Otwell. HTML + version '5.5' do + self.release = '5.5.0' + self.root_path = '/api/5.5/index.html' + self.initial_paths = %w(/docs/5.5/installation /api/5.5/classes.html) + + options[:only_patterns] = [%r{\A/api/5\.5/}, %r{\A/docs/5\.5/}] + + options[:fix_urls] = ->(url) do + url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.5/" + url + end + end + version '5.4' do self.release = '5.4.30' self.root_path = '/api/5.4/index.html'