History

Version Laravel documentation (5.2 and 5.1)

Fixes #289. Fixes #377.

Thibaut Courouble committed 10 years ago

Commit 3cdf5911 parent 07377103 files · +42 −26Browse files

Unified · Split

3 files
  1. lib/docs/filters/laravel/clean_html.rb +4 −0
  2. lib/docs/filters/laravel/entries.rb +1 −1
  3. lib/docs/scrapers/laravel.rb +37 −25
lib/docs/filters/laravel/clean_html.rb+4−0
@@ -57,6 +57,10 @@ module Docs · 56 unmodified lines
57 node.before(node.children).remove57 node.before(node.children).remove
58 end58 end
59 59
60 css('p > a[name]').each do |node|
61 node.parent.next_element['id'] = node['name']
62 end
63
60 # Remove code highlighting64 # Remove code highlighting
61 css('pre').each do |node|65 css('pre').each do |node|
62 node.content = node.content66 node.content = node.content
lib/docs/filters/laravel/entries.rb+1−1
@@ -46,7 +46,7 @@ module Docs · 45 unmodified lines
46 end46 end
47 47
48 def include_default_entry?48 def include_default_entry?
49 subpath != '/api/5.2/classes.html'49 !subpath.end_with?('classes.html')
50 end50 end
51 end51 end
52 end52 end
lib/docs/scrapers/laravel.rb+37−25
@@ -3,10 +3,9 @@ module Docs · 2 unmodified lines
3 self.name = 'Laravel'3 self.name = 'Laravel'
4 self.slug = 'laravel'4 self.slug = 'laravel'
5 self.type = 'laravel'5 self.type = 'laravel'
6 self.release = '5.2.0'6
7 self.base_url = 'https://laravel.com'7 self.base_url = 'https://laravel.com'
8 self.root_path = '/api/5.2/index.html'8
9 self.initial_paths = %w(/docs/5.2/installation /api/5.2/classes.html)
10 self.links = {9 self.links = {
11 home: 'https://laravel.com/',10 home: 'https://laravel.com/',
12 code: 'https://github.com/laravel/laravel'11 code: 'https://github.com/laravel/laravel'
@@ -18,32 +17,45 @@ module Docs · 5 unmodified lines
18 filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper'17 filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper'
19 }18 }
20 19
21 options[:only_patterns] = [20 options[:skip_patterns] = [
22 /\A\/api\/5\.2\//,21 %r{\A/api/\d\.\d/\.html},
23 /\A\/docs\/5\.2\//]22 %r{\A/api/\d\.\d/panel\.html},
24 23 %r{\A/api/\d\.\d/namespaces\.html},
25 options[:skip] = %w(24 %r{\A/api/\d\.\d/interfaces\.html},
26 /docs/5.2/quick25 %r{\A/api/\d\.\d/traits\.html},
27 /docs/5.2/releases26 %r{\A/api/\d\.\d/doc-index\.html},
28 /docs/5.2/artisan27 %r{\A/api/\d\.\d/Illuminate\.html},
29 /docs/5.2/commands28 %r{\A/api/\d\.\d/search\.html} ]
30 /api/5.2/.html
31 /api/5.2/panel.html
32 /api/5.2/namespaces.html
33 /api/5.2/interfaces.html
34 /api/5.2/traits.html
35 /api/5.2/doc-index.html
36 /api/5.2/Illuminate.html
37 /api/5.2/search.html)
38
39 options[:fix_urls] = ->(url) do
40 url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.2/"
41 url
42 end
43 29
44 options[:attribution] = <<-HTML30 options[:attribution] = <<-HTML
45 &copy; Taylor Otwell<br>31 &copy; Taylor Otwell<br>
46 Licensed under the MIT License.32 Licensed under the MIT License.
47 HTML33 HTML
34
35 version '5.2' do
36 self.release = '5.2.24'
37 self.root_path = '/api/5.2/index.html'
38 self.initial_paths = %w(/docs/5.2/installation /api/5.2/classes.html)
39
40 options[:only_patterns] = [%r{\A/api/5\.2/}, %r{\A/docs/5\.2/}]
41
42 options[:fix_urls] = ->(url) do
43 url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.2/"
44 url
45 end
46 end
47
48 version '5.1' do
49 self.release = '5.1.11'
50 self.root_path = '/api/5.1/index.html'
51 self.initial_paths = %w(/docs/5.1/installation /api/5.1/classes.html)
52
53 options[:only_patterns] = [%r{\A/api/5\.1/}, %r{\A/docs/5\.1/}]
54
55 options[:fix_urls] = ->(url) do
56 url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.1/"
57 url
58 end
59 end
48 end60 end
49end61end