Unified · Split
| @@ -12,12 +12,24 @@ module Docs · 11 unmodified lines | ||
| 12 | 12 | end |
| 13 | 13 | |
| 14 | 14 | def api |
| 15 | − css('#footer', '.location').remove | |
| 15 | + @doc = doc.at_css('#page-content') | |
| 16 | + | |
| 17 | + css('.location').remove | |
| 16 | 18 | |
| 17 | 19 | # Replace .header with <h1> |
| 18 | − css('.header > h1').each do |node| | |
| 19 | − node.parent.before(node).remove | |
| 20 | + css('.page-header > h1').each do |node| | |
| 20 | 21 | node.content = 'Laravel' if root_page? |
| 22 | + node.parent.before(node).remove | |
| 23 | + end | |
| 24 | + | |
| 25 | + css('.container-fluid').each do |node| | |
| 26 | + node.name = 'table' | |
| 27 | + node.css('.row').each { |n| n.name = 'tr' } | |
| 28 | + node.css('div[class^="col"]').each { |n| n.name = 'td' } | |
| 29 | + end | |
| 30 | + | |
| 31 | + css('> div').each do |node| | |
| 32 | + node.before(node.children).remove | |
| 21 | 33 | end |
| 22 | 34 | |
| 23 | 35 | # Remove <abbr> |
| @@ -38,7 +50,7 @@ module Docs · 14 unmodified lines | ||
| 38 | 50 | end |
| 39 | 51 | |
| 40 | 52 | def other |
| 41 | − @doc = at_css('#docs-content') | |
| 53 | + @doc = at_css('article') | |
| 42 | 54 | |
| 43 | 55 | # Clean up headings |
| 44 | 56 | css('h2 > a').each do |node| |
| @@ -3,29 +3,36 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | 5 | if api_page? |
| 6 | − at_css('h1').content.strip.split('\\').last | |
| 6 | + name = at_css('h1').content.strip.remove('Illuminate\\') | |
| 7 | + name << " (#{type})" unless name.start_with?(self.type) | |
| 8 | + name | |
| 7 | 9 | else |
| 8 | − at_css('h1').content.strip | |
| 10 | + at_css('h1').content | |
| 9 | 11 | end |
| 10 | 12 | end |
| 11 | 13 | |
| 12 | 14 | def get_type |
| 13 | − if api_page? | |
| 14 | − type = at_css('h1').content.strip.remove('Illuminate\\').remove(/\\\w+?\z/) | |
| 15 | − type.end_with?('Console') ? type.split('\\').first : type | |
| 15 | + return 'Guides' unless api_page? | |
| 16 | + type = slug.remove('api/5.0/').remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\') | |
| 17 | + | |
| 18 | + if type.end_with?('Console') | |
| 19 | + type.split('\\').first | |
| 20 | + elsif type.start_with?('Contracts') | |
| 21 | + 'Contracts' | |
| 16 | 22 | else |
| 17 | − 'Guides' | |
| 23 | + type | |
| 18 | 24 | end |
| 19 | 25 | end |
| 20 | 26 | |
| 21 | 27 | def additional_entries |
| 22 | − return [] unless api_page? | |
| 28 | + return [] if root_page? || !api_page? | |
| 29 | + base_name = self.name.remove(/\(.+\)/).strip | |
| 23 | 30 | |
| 24 | 31 | css('h3[id^="method_"]').each_with_object [] do |node, entries| |
| 25 | 32 | next if node.at_css('.location').content.start_with?('in') |
| 26 | 33 | |
| 27 | 34 | name = node['id'].remove('method_') |
| 28 | − name.prepend "#{self.name}::" | |
| 35 | + name.prepend "#{base_name}::" | |
| 29 | 36 | name << '()' |
| 30 | 37 | |
| 31 | 38 | entries << [name, node['id']] |
| @@ -35,6 +42,10 @@ module Docs · 3 unmodified lines | ||
| 35 | 42 | def api_page? |
| 36 | 43 | subpath.start_with?('/api') |
| 37 | 44 | end |
| 45 | + | |
| 46 | + def include_default_entry? | |
| 47 | + subpath != '/api/5.0/classes.html' | |
| 48 | + end | |
| 38 | 49 | end |
| 39 | 50 | end |
| 40 | 51 | end |
| @@ -3,36 +3,36 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | self.name = 'Laravel' |
| 4 | 4 | self.slug = 'laravel' |
| 5 | 5 | self.type = 'laravel' |
| 6 | − self.version = '4.2.11' | |
| 6 | + self.version = '5.0.0' | |
| 7 | 7 | self.base_url = 'http://laravel.com' |
| 8 | − self.root_path = '/docs/4.2/introduction' | |
| 9 | − self.initial_paths = %w(/api/4.2/classes.html) | |
| 8 | + self.root_path = '/api/5.0/index.html' | |
| 9 | + self.initial_paths = %w(/docs/5.0/installation /api/5.0/classes.html) | |
| 10 | 10 | |
| 11 | 11 | html_filters.push 'laravel/entries', 'laravel/clean_html' |
| 12 | 12 | |
| 13 | 13 | options[:container] = ->(filter) { |
| 14 | − filter.subpath.start_with?('/api') ? nil : '#documentation > article' | |
| 14 | + filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper' | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | options[:only_patterns] = [ |
| 18 | − /\A\/api\/4\.2\//, | |
| 19 | − /\A\/docs\/4\.2\//] | |
| 18 | + /\A\/api\/5\.0\//, | |
| 19 | + /\A\/docs\/5\.0\//] | |
| 20 | 20 | |
| 21 | 21 | options[:skip] = %w( |
| 22 | − /docs/4.2/quick | |
| 23 | − /docs/4.2/releases | |
| 24 | − /docs/4.2/upgrade | |
| 25 | − /docs/4.2/artisan | |
| 26 | − /docs/4.2/commands | |
| 27 | − /api/4.2/panel.html | |
| 28 | − /api/4.2/namespaces.html | |
| 29 | − /api/4.2/interfaces.html | |
| 30 | − /api/4.2/traits.html | |
| 31 | − /api/4.2/doc-index.html | |
| 32 | − /api/4.2/Illuminate.html) | |
| 22 | + /docs/5.0/quick | |
| 23 | + /docs/5.0/releases | |
| 24 | + /docs/5.0/artisan | |
| 25 | + /docs/5.0/commands | |
| 26 | + /api/5.0/panel.html | |
| 27 | + /api/5.0/namespaces.html | |
| 28 | + /api/5.0/interfaces.html | |
| 29 | + /api/5.0/traits.html | |
| 30 | + /api/5.0/doc-index.html | |
| 31 | + /api/5.0/Illuminate.html | |
| 32 | + /api/5.0/search.html) | |
| 33 | 33 | |
| 34 | 34 | options[:fix_urls] = ->(url) do |
| 35 | − url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/4.2/" | |
| 35 | + url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.0/" | |
| 36 | 36 | url |
| 37 | 37 | end |
| 38 | 38 | |