From ad5853db6ffeb8d37dd7c248cadf50e5e0fef79b Mon Sep 17 00:00:00 2001 From: TK Lai Date: Sun, 14 May 2023 12:15:58 +0800 Subject: [PATCH 1/5] 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' From 29eebbba1ff9b0f08525afebd1ea59e2a136d121 Mon Sep 17 00:00:00 2001 From: TK Lai Date: Sun, 14 May 2023 12:32:52 +0800 Subject: [PATCH 2/5] laravel: update laravel 6-9 minor version --- lib/docs/scrapers/laravel.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index 343a80ad..348e95dd 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -44,7 +44,7 @@ module Docs end version '9' do - self.release = '9.3.8' + self.release = '9.52.7' self.root_path = '/api/9.x/index.html' self.initial_paths = %w(/docs/9.x/installation /api/9.x/classes.html) @@ -58,7 +58,7 @@ module Docs end version '8' do - self.release = '8.4.1' + self.release = '8.83.27' self.root_path = '/api/8.x/index.html' self.initial_paths = %w(/docs/8.x/installation /api/8.x/classes.html) @@ -71,7 +71,7 @@ module Docs end version '7' do - self.release = '7.30.1' + self.release = '7.30.6' self.root_path = '/api/7.x/index.html' self.initial_paths = %w(/docs/7.x/installation /api/7.x/classes.html) @@ -84,7 +84,7 @@ module Docs end version '6' do - self.release = '6.20.0' + self.release = '6.20.44' self.root_path = '/api/6.x/index.html' self.initial_paths = %w(/docs/6.x/installation /api/6.x/classes.html) From 0cc5933b7e3a73178b9ed13f5fa02d4c67fdb8c8 Mon Sep 17 00:00:00 2001 From: TK Lai Date: Sun, 14 May 2023 12:40:29 +0800 Subject: [PATCH 3/5] laravel: fix "Docs::Entry::Invalid: missing type" on doc:generate --- lib/docs/scrapers/laravel.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index 348e95dd..a104f06b 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -65,6 +65,7 @@ module Docs options[:only_patterns] = [%r{\A/api/8\.x/}, %r{\A/docs/8\.x/}] options[:fix_urls] = ->(url) do + url.sub! %r{8.x/+}, "8.x/" url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/8.x/" url end @@ -78,6 +79,7 @@ module Docs options[:only_patterns] = [%r{\A/api/7\.x/}, %r{\A/docs/7\.x/}] options[:fix_urls] = ->(url) do + url.sub! %r{7.x/+}, "7.x/" url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/7.x/" url end @@ -91,6 +93,7 @@ module Docs options[:only_patterns] = [%r{\A/api/6\.x/}, %r{\A/docs/6\.x/}] options[:fix_urls] = ->(url) do + url.sub! %r{6.x/+}, "6.x/" url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/6.x/" url end From 2e236f5533a195c43d1191da96ff4c52b5a518cf Mon Sep 17 00:00:00 2001 From: TK Lai Date: Sun, 14 May 2023 14:38:04 +0800 Subject: [PATCH 4/5] laravel: fix codes being squashed (fixes #1852) --- lib/docs/filters/laravel/clean_html.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/docs/filters/laravel/clean_html.rb b/lib/docs/filters/laravel/clean_html.rb index 9eba084a..42fc1724 100644 --- a/lib/docs/filters/laravel/clean_html.rb +++ b/lib/docs/filters/laravel/clean_html.rb @@ -9,9 +9,16 @@ module Docs end # Remove code highlighting - css('pre').each do |node| - node.content = node.content - node['data-language'] = 'php' + css('pre > code').each do |node| + if node['data-lang'].eql?('nothing') + # Ignore 'nothing' language + else + node.parent['data-language'] = node['data-lang'] + end + # Prism uses `\n` to determine lines. Otherwise the lines will be + # compacted. + node.parent.content = node.css('.line').map(&:content).join("\n") + node.remove end doc From 13dbfcb5384db144172969811523f9e4d4ce8adb Mon Sep 17 00:00:00 2001 From: TK Lai Date: Wed, 31 May 2023 17:58:53 +0800 Subject: [PATCH 5/5] laravel: update minor version of Laravel 9 and 10 --- lib/docs/scrapers/laravel.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index a104f06b..9b3c0771 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -30,7 +30,7 @@ module Docs HTML version '10' do - self.release = '10.10.0' + self.release = '10.13.0' self.root_path = '/api/10.x/index.html' self.initial_paths = %w(/docs/10.x/installation /api/10.x/classes.html) @@ -44,7 +44,7 @@ module Docs end version '9' do - self.release = '9.52.7' + self.release = '9.52.8' self.root_path = '/api/9.x/index.html' self.initial_paths = %w(/docs/9.x/installation /api/9.x/classes.html)