From ad5853db6ffeb8d37dd7c248cadf50e5e0fef79b Mon Sep 17 00:00:00 2001 From: TK Lai Date: Sun, 14 May 2023 12:15:58 +0800 Subject: [PATCH] laravel: add Laravel 10 documentation --- lib/docs/filters/laravel/entries.rb | 2 +- lib/docs/scrapers/laravel.rb | 30 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/docs/filters/laravel/entries.rb b/lib/docs/filters/laravel/entries.rb index 5de0c713..4a083a9b 100644 --- a/lib/docs/filters/laravel/entries.rb +++ b/lib/docs/filters/laravel/entries.rb @@ -18,7 +18,7 @@ module Docs return heading ? "Guides: #{heading.content.strip}" : 'Guides' end - type = slug.remove(%r{api/\d.[0-9x]/}).remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\') + type = slug.remove(%r{api/[1-9]?\d.[0-9x]/}).remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\') if type.end_with?('Console') type.split('\\').first diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index 7641afd0..343a80ad 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -14,14 +14,14 @@ module Docs } options[:skip_patterns] = [ - %r{\A/api/\d\.[0-9x]/\.html}, - %r{\A/api/\d\.[0-9x]/panel\.html}, - %r{\A/api/\d\.[0-9x]/namespaces\.html}, - %r{\A/api/\d\.[0-9x]/interfaces\.html}, - %r{\A/api/\d\.[0-9x]/traits\.html}, - %r{\A/api/\d\.[0-9x]/doc-index\.html}, - %r{\A/api/\d\.[0-9x]/Illuminate\.html}, - %r{\A/api/\d\.[0-9x]/search\.html} ] + %r{\A/api/[1-9]?\d\.[0-9x]/\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/panel\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/namespaces\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/interfaces\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/traits\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/doc-index\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/Illuminate\.html}, + %r{\A/api/[1-9]?\d\.[0-9x]/search\.html} ] options[:attribution] = <<-HTML © Taylor Otwell
@@ -29,6 +29,20 @@ module Docs Laravel is a trademark of Taylor Otwell. HTML + version '10' do + self.release = '10.10.0' + self.root_path = '/api/10.x/index.html' + self.initial_paths = %w(/docs/10.x/installation /api/10.x/classes.html) + + options[:only_patterns] = [%r{\A/api/10\.x/}, %r{\A/docs/10\.x/}] + + options[:fix_urls] = ->(url) do + url.sub! %r{10.x/+}, "10.x/" + url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?![1-9]?\d)}, "#{Laravel.base_url}/docs/10.x/" + url + end + end + version '9' do self.release = '9.3.8' self.root_path = '/api/9.x/index.html'