Procházet zdrojové kódy

Update Laravel documentation (5.1.1)

Thibaut před 10 roky
rodič
revize
7963ff337d

+ 6 - 0
assets/javascripts/views/pages/laravel.coffee

@@ -0,0 +1,6 @@
+#= require views/pages/base
+
+class app.views.LaravelPage extends app.views.BasePage
+  afterRender: ->
+    @highlightCode @findAllByTag('pre'), 'php'
+    return

+ 5 - 3
lib/docs/filters/laravel/entries.rb

@@ -13,14 +13,16 @@ module Docs
 
       def get_type
         return 'Guides' unless api_page?
-        type = slug.remove('api/5.0/').remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\')
+        type = slug.remove(%r{api/\d.\d/}).remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\')
 
         if type.end_with?('Console')
           type.split('\\').first
         elsif type.start_with?('Contracts')
           'Contracts'
+        elsif type.start_with?('Database')
+          type.split('\\')[0..2].join('\\')
         else
-          type
+          type.split('\\')[0..1].join('\\')
         end
       end
 
@@ -44,7 +46,7 @@ module Docs
       end
 
       def include_default_entry?
-        subpath != '/api/5.0/classes.html'
+        subpath != '/api/5.1/classes.html'
       end
     end
   end

+ 21 - 17
lib/docs/scrapers/laravel.rb

@@ -3,10 +3,14 @@ module Docs
     self.name = 'Laravel'
     self.slug = 'laravel'
     self.type = 'laravel'
-    self.version = '5.0.0'
+    self.version = '5.1.1'
     self.base_url = 'http://laravel.com'
-    self.root_path = '/api/5.0/index.html'
-    self.initial_paths = %w(/docs/5.0/installation /api/5.0/classes.html)
+    self.root_path = '/api/5.1/index.html'
+    self.initial_paths = %w(/docs/5.1/installation /api/5.1/classes.html)
+    self.links = {
+      home: 'http://laravel.com/',
+      code: 'https://github.com/laravel/laravel'
+    }
 
     html_filters.push 'laravel/entries', 'laravel/clean_html'
 
@@ -15,24 +19,24 @@ module Docs
     }
 
     options[:only_patterns] = [
-      /\A\/api\/5\.0\//,
-      /\A\/docs\/5\.0\//]
+      /\A\/api\/5\.1\//,
+      /\A\/docs\/5\.1\//]
 
     options[:skip] = %w(
-      /docs/5.0/quick
-      /docs/5.0/releases
-      /docs/5.0/artisan
-      /docs/5.0/commands
-      /api/5.0/panel.html
-      /api/5.0/namespaces.html
-      /api/5.0/interfaces.html
-      /api/5.0/traits.html
-      /api/5.0/doc-index.html
-      /api/5.0/Illuminate.html
-      /api/5.0/search.html)
+      /docs/5.1/quick
+      /docs/5.1/releases
+      /docs/5.1/artisan
+      /docs/5.1/commands
+      /api/5.1/panel.html
+      /api/5.1/namespaces.html
+      /api/5.1/interfaces.html
+      /api/5.1/traits.html
+      /api/5.1/doc-index.html
+      /api/5.1/Illuminate.html
+      /api/5.1/search.html)
 
     options[:fix_urls] = ->(url) do
-      url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.0/"
+      url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.1/"
       url
     end