From e2b700407876c9c5f3dbc2b14f11cf8d11171b26 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 1 May 2016 11:00:09 -0400 Subject: [PATCH] Update Laravel documentation (5.2.31, 5.1.33) --- assets/javascripts/views/pages/laravel.coffee | 6 ------ assets/javascripts/views/pages/simple.coffee | 1 + lib/docs/core/filter.rb | 11 +++++++++++ lib/docs/filters/laravel/clean_html.rb | 11 ++++++++--- lib/docs/scrapers/laravel.rb | 7 ++++--- 5 files changed, 24 insertions(+), 12 deletions(-) delete mode 100644 assets/javascripts/views/pages/laravel.coffee diff --git a/assets/javascripts/views/pages/laravel.coffee b/assets/javascripts/views/pages/laravel.coffee deleted file mode 100644 index b9992d12..00000000 --- a/assets/javascripts/views/pages/laravel.coffee +++ /dev/null @@ -1,6 +0,0 @@ -#= require views/pages/base - -class app.views.LaravelPage extends app.views.BasePage - prepare: -> - @highlightCode @findAllByTag('pre'), 'php' - return diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee index 32f3f67d..ca42ef93 100644 --- a/assets/javascripts/views/pages/simple.coffee +++ b/assets/javascripts/views/pages/simple.coffee @@ -11,6 +11,7 @@ app.views.CakephpPage = app.views.EmberPage = app.views.ExpressPage = app.views.GoPage = +app.views.LaravelPage = app.views.MarionettePage = app.views.MeteorPage = app.views.ModernizrPage = diff --git a/lib/docs/core/filter.rb b/lib/docs/core/filter.rb index 6d3d4b46..4e458d12 100644 --- a/lib/docs/core/filter.rb +++ b/lib/docs/core/filter.rb @@ -74,5 +74,16 @@ module Docs warn "#{self.class.name} is re-parsing the document" unless ENV['RACK_ENV'] == 'test' super end + + def decode_cloudflare_email(str) + mask = "0x#{str[0..1]}".hex | 0 + result = '' + + str.chars.drop(2).each_slice(2) do |slice| + result += "%" + "0#{("0x#{slice.join}".hex ^ mask).to_s(16)}"[-2..-1] + end + + URI.decode(result) + end end end diff --git a/lib/docs/filters/laravel/clean_html.rb b/lib/docs/filters/laravel/clean_html.rb index 1e1f3dc7..d2585b81 100644 --- a/lib/docs/filters/laravel/clean_html.rb +++ b/lib/docs/filters/laravel/clean_html.rb @@ -8,6 +8,12 @@ module Docs other end + # Remove code highlighting + css('pre').each do |node| + node.content = node.content + node['data-language'] = 'php' + end + doc end @@ -61,9 +67,8 @@ module Docs node.parent.next_element['id'] = node['name'] end - # Remove code highlighting - css('pre').each do |node| - node.content = node.content + css('a.__cf_email__').each do |node| + node.replace(decode_cloudflare_email(node['data-cfemail'])) end end end diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb index a2927cf6..da6f21a1 100644 --- a/lib/docs/scrapers/laravel.rb +++ b/lib/docs/scrapers/laravel.rb @@ -29,11 +29,12 @@ module Docs options[:attribution] = <<-HTML © Taylor Otwell
- Licensed under the MIT License. + Licensed under the MIT License.
+ Laravel is a trademark of Taylor Otwell. HTML version '5.2' do - self.release = '5.2.24' + self.release = '5.2.31' self.root_path = '/api/5.2/index.html' self.initial_paths = %w(/docs/5.2/installation /api/5.2/classes.html) @@ -46,7 +47,7 @@ module Docs end version '5.1' do - self.release = '5.1.11' + self.release = '5.1.33' self.root_path = '/api/5.1/index.html' self.initial_paths = %w(/docs/5.1/installation /api/5.1/classes.html)