diff --git a/assets/images/icons.png b/assets/images/icons.png index aac50a9a..719b11cc 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index d3e7cddf..35b9fa1d 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 33e9241d..a8fee2d1 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -155,6 +155,11 @@ credits = [ 'Steven Sanderson, the Knockout.js team, and other contributors', 'MIT', 'https://raw.github.com/knockout/knockout/master/LICENSE' + ], [ + 'Laravel', + 'Taylor Otwell', + 'MIT', + 'https://raw.githubusercontent.com/laravel/framework/master/LICENSE.txt' ], [ 'Less', '2009-2014 The Core Less Team', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index ada08703..84f9e6e6 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -24,7 +24,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1399161600000, # May 4, 2014 + [ 1400976000000, # May 25, 2014 + """ New Laravel documentation """, + ], [ + 1399161600000, # May 4, 2014 """ New Express, Grunt, and MaxCDN documentations """, ], [ 1396742400000, # April 6, 2014 diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index d6b15b9c..57f3e5cb 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -39,6 +39,7 @@ 'pages/knockout', 'pages/git', 'pages/grunt', + 'pages/laravel', 'pages/less', 'pages/lodash', 'pages/maxcdn', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index ab85f8a2..c3ff5cb0 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -4,7 +4,7 @@ width: 1rem; height: 1rem; background-image: image-url('icons.png'); - background-size: 5rem 9rem; + background-size: 5rem 10rem; } @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { @@ -56,3 +56,4 @@ ._icon-express:before { background-position: -2rem -8rem; } ._icon-grunt:before { background-position: -3rem -8rem; } ._icon-maxcdn:before { background-position: -4rem -8rem; } +._icon-laravel:before { background-position: 0 -9rem; } diff --git a/assets/stylesheets/pages/_laravel.scss b/assets/stylesheets/pages/_laravel.scss new file mode 100644 index 00000000..21604526 --- /dev/null +++ b/assets/stylesheets/pages/_laravel.scss @@ -0,0 +1,8 @@ +._sami { + h2 { @extend %block-heading; } + h3 { @extend %block-label, %label-blue; } + h4 { font-size: 1em; } + + blockquote { @extend %note; } + p > code { @extend %label; } +} diff --git a/lib/docs/filters/laravel/clean_html.rb b/lib/docs/filters/laravel/clean_html.rb new file mode 100644 index 00000000..fca4d644 --- /dev/null +++ b/lib/docs/filters/laravel/clean_html.rb @@ -0,0 +1,55 @@ +module Docs + class Laravel + class CleanHtmlFilter < Filter + def call + if subpath.start_with?('/api') + api + else + other + end + + doc + end + + def api + css('#footer', '.location').remove + + # Replace .header with

+ css('.header > h1').each do |node| + node.parent.before(node).remove + node.content = 'Laravel' if root_page? + end + + # Remove + css('a > abbr').each do |node| + node.parent['title'] = node['title'] + node.before(node.children).remove + end + + # Clean up headings + css('h1 > a', '.content', 'h3 > code', 'h3 strong', 'abbr').each do |node| + node.before(node.children).remove + end + + # Remove empty + css('td').each do |node| + node.remove if node.content =~ /\A\s+\z/ + end + end + + def other + @doc = at_css('#docs-content') + + # Clean up headings + css('h2 > a').each do |node| + node.before(node.children).remove + end + + # Remove code highlighting + css('pre').each do |node| + node.content = node.content + end + end + end + end +end diff --git a/lib/docs/filters/laravel/entries.rb b/lib/docs/filters/laravel/entries.rb new file mode 100644 index 00000000..3a0da2c9 --- /dev/null +++ b/lib/docs/filters/laravel/entries.rb @@ -0,0 +1,40 @@ +module Docs + class Laravel + class EntriesFilter < Docs::EntriesFilter + def get_name + if api_page? + at_css('h1').content.strip.split('\\').last + else + at_css('h1').content.strip + end + end + + def get_type + if api_page? + type = at_css('h1').content.strip.remove('Illuminate\\').remove(/\\\w+?\z/) + type.end_with?('Console') ? type.split('\\').first : type + else + 'Guides' + end + end + + def additional_entries + return [] unless api_page? + + css('h3[id^="method_"]').each_with_object [] do |node, entries| + next if node.at_css('.location').content.start_with?('in') + + name = node['id'].remove('method_') + name.prepend "#{self.name}::" + name << '()' + + entries << [name, node['id']] + end + end + + def api_page? + subpath.start_with?('/api') + end + end + end +end diff --git a/lib/docs/scrapers/laravel.rb b/lib/docs/scrapers/laravel.rb new file mode 100644 index 00000000..9d7dce4d --- /dev/null +++ b/lib/docs/scrapers/laravel.rb @@ -0,0 +1,39 @@ +module Docs + class Laravel < UrlScraper + self.name = 'Laravel' + self.slug = 'laravel' + self.type = 'laravel' + self.version = '4.1.29' + self.base_url = 'http://laravel.com' + self.root_path = '/docs/introduction' + self.initial_paths = %w(/api/4.1/namespaces.html) + + html_filters.push 'laravel/entries', 'laravel/clean_html' + + options[:container] = ->(filter) { + filter.subpath.start_with?('/api') ? nil : '#documentation > article' + } + + options[:only_patterns] = [ + /\A\/api\/4\.1\//, + /\A\/docs\//] + + options[:skip] = %w( + /docs/quick + /docs/releases + /docs/upgrade + /docs/artisan + /docs/commands + /api/4.1/panel.html + /api/4.1/classes.html + /api/4.1/interfaces.html + /api/4.1/traits.html + /api/4.1/doc-index.html + /api/4.1/Illuminate.html) + + options[:attribution] = <<-HTML + © Taylor Otwell
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/laravel/16.png b/public/icons/docs/laravel/16.png new file mode 100644 index 00000000..1ecf19ca Binary files /dev/null and b/public/icons/docs/laravel/16.png differ diff --git a/public/icons/docs/laravel/16@2x.png b/public/icons/docs/laravel/16@2x.png new file mode 100755 index 00000000..bbb548f7 Binary files /dev/null and b/public/icons/docs/laravel/16@2x.png differ diff --git a/public/icons/docs/laravel/SOURCE b/public/icons/docs/laravel/SOURCE new file mode 100644 index 00000000..eec12031 --- /dev/null +++ b/public/icons/docs/laravel/SOURCE @@ -0,0 +1 @@ +https://github.com/laravel/art