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
5757 node.before(node.children).remove
5858 end
5959
60+ css('p > a[name]').each do |node|
61+ node.parent.next_element['id'] = node['name']
62+ end
63+
6064 # Remove code highlighting
6165 css('pre').each do |node|
6266 node.content = node.content
lib/docs/filters/laravel/entries.rb+1−1
@@ -46,7 +46,7 @@ module Docs · 45 unmodified lines
4646 end
4747
4848 def include_default_entry?
49− subpath != '/api/5.2/classes.html'
49+ !subpath.end_with?('classes.html')
5050 end
5151 end
5252 end
lib/docs/scrapers/laravel.rb+37−25
@@ -3,10 +3,9 @@ module Docs · 2 unmodified lines
33 self.name = 'Laravel'
44 self.slug = 'laravel'
55 self.type = 'laravel'
6− self.release = '5.2.0'
6+
77 self.base_url = 'https://laravel.com'
8− self.root_path = '/api/5.2/index.html'
9− self.initial_paths = %w(/docs/5.2/installation /api/5.2/classes.html)
8+
109 self.links = {
1110 home: 'https://laravel.com/',
1211 code: 'https://github.com/laravel/laravel'
@@ -18,32 +17,45 @@ module Docs · 5 unmodified lines
1817 filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper'
1918 }
2019
21− options[:only_patterns] = [
22− /\A\/api\/5\.2\//,
23− /\A\/docs\/5\.2\//]
24−
25− options[:skip] = %w(
26− /docs/5.2/quick
27− /docs/5.2/releases
28− /docs/5.2/artisan
29− /docs/5.2/commands
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
20+ options[:skip_patterns] = [
21+ %r{\A/api/\d\.\d/\.html},
22+ %r{\A/api/\d\.\d/panel\.html},
23+ %r{\A/api/\d\.\d/namespaces\.html},
24+ %r{\A/api/\d\.\d/interfaces\.html},
25+ %r{\A/api/\d\.\d/traits\.html},
26+ %r{\A/api/\d\.\d/doc-index\.html},
27+ %r{\A/api/\d\.\d/Illuminate\.html},
28+ %r{\A/api/\d\.\d/search\.html} ]
4329
4430 options[:attribution] = <<-HTML
4531 &copy; Taylor Otwell<br>
4632 Licensed under the MIT License.
4733 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
4860 end
4961 end