Update Laravel documentation (5.0.0)

pull/165/head
Thibaut 10 years ago
parent 07047cb71f
commit e97b8d463d

@ -12,12 +12,24 @@ module Docs
end
def api
css('#footer', '.location').remove
@doc = doc.at_css('#page-content')
css('.location').remove
# Replace .header with <h1>
css('.header > h1').each do |node|
node.parent.before(node).remove
css('.page-header > h1').each do |node|
node.content = 'Laravel' if root_page?
node.parent.before(node).remove
end
css('.container-fluid').each do |node|
node.name = 'table'
node.css('.row').each { |n| n.name = 'tr' }
node.css('div[class^="col"]').each { |n| n.name = 'td' }
end
css('> div').each do |node|
node.before(node.children).remove
end
# Remove <abbr>
@ -38,7 +50,7 @@ module Docs
end
def other
@doc = at_css('#docs-content')
@doc = at_css('article')
# Clean up headings
css('h2 > a').each do |node|

@ -3,29 +3,36 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
if api_page?
at_css('h1').content.strip.split('\\').last
name = at_css('h1').content.strip.remove('Illuminate\\')
name << " (#{type})" unless name.start_with?(self.type)
name
else
at_css('h1').content.strip
at_css('h1').content
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
return 'Guides' unless api_page?
type = slug.remove('api/5.0/').remove('Illuminate/').remove(/\/\w+?\z/).gsub('/', '\\')
if type.end_with?('Console')
type.split('\\').first
elsif type.start_with?('Contracts')
'Contracts'
else
'Guides'
type
end
end
def additional_entries
return [] unless api_page?
return [] if root_page? || !api_page?
base_name = self.name.remove(/\(.+\)/).strip
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.prepend "#{base_name}::"
name << '()'
entries << [name, node['id']]
@ -35,6 +42,10 @@ module Docs
def api_page?
subpath.start_with?('/api')
end
def include_default_entry?
subpath != '/api/5.0/classes.html'
end
end
end
end

@ -3,36 +3,36 @@ module Docs
self.name = 'Laravel'
self.slug = 'laravel'
self.type = 'laravel'
self.version = '4.2.11'
self.version = '5.0.0'
self.base_url = 'http://laravel.com'
self.root_path = '/docs/4.2/introduction'
self.initial_paths = %w(/api/4.2/classes.html)
self.root_path = '/api/5.0/index.html'
self.initial_paths = %w(/docs/5.0/installation /api/5.0/classes.html)
html_filters.push 'laravel/entries', 'laravel/clean_html'
options[:container] = ->(filter) {
filter.subpath.start_with?('/api') ? nil : '#documentation > article'
filter.subpath.start_with?('/api') ? '#content' : '.docs-wrapper'
}
options[:only_patterns] = [
/\A\/api\/4\.2\//,
/\A\/docs\/4\.2\//]
/\A\/api\/5\.0\//,
/\A\/docs\/5\.0\//]
options[:skip] = %w(
/docs/4.2/quick
/docs/4.2/releases
/docs/4.2/upgrade
/docs/4.2/artisan
/docs/4.2/commands
/api/4.2/panel.html
/api/4.2/namespaces.html
/api/4.2/interfaces.html
/api/4.2/traits.html
/api/4.2/doc-index.html
/api/4.2/Illuminate.html)
/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)
options[:fix_urls] = ->(url) do
url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/4.2/"
url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.0/"
url
end

Loading…
Cancel
Save