mirror of https://github.com/freeCodeCamp/devdocs
parent
e7f8bf443e
commit
9a99e79fe9
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
@ -0,0 +1,29 @@
|
||||
module Docs
|
||||
class Symfony
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.location', '#footer').remove
|
||||
|
||||
css('.header > h1').each do |node|
|
||||
node.content = 'Symfony' if root_page?
|
||||
node.parent.before(node).remove
|
||||
end
|
||||
|
||||
css('div.details').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('a > abbr').each do |node|
|
||||
node.parent['title'] = node['title']
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('h1 > a', '.content', 'h3 > code', 'h3 strong', 'abbr').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,57 @@
|
||||
module Docs
|
||||
class Symfony
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('h1').content.strip
|
||||
name.remove! 'Symfony\\'
|
||||
name << " (#{namespace})" if name.gsub! "#{namespace}\\", ''
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
return 'Exceptions' if slug =~ /exception/i
|
||||
return 'Testing' if slug =~ /test/i
|
||||
namespace
|
||||
end
|
||||
|
||||
def namespace
|
||||
@namespace ||= begin
|
||||
path = slug.remove('Symfony/').remove(/\/\w+?\z/).split('/')
|
||||
upto = 1
|
||||
upto = 2 if path[1] == 'Form' && path[2] == 'Extension'
|
||||
upto = 2 if path[1] == 'HttpFoundation' && path[2] == 'Session'
|
||||
path[0..upto].join('\\')
|
||||
end
|
||||
end
|
||||
|
||||
IGNORE_METHODS = %w(get set)
|
||||
|
||||
def additional_entries
|
||||
return [] if initial_page?
|
||||
return [] if type == 'Exceptions'
|
||||
return [] if self.name.include?('Legacy') || self.name.include?('Loader')
|
||||
|
||||
entries = []
|
||||
base_name = self.name.remove(/\(.+\)/).strip
|
||||
|
||||
css('h3[id^="method_"]').each do |node|
|
||||
next if node.at_css('.location').content.start_with?('in')
|
||||
|
||||
name = node['id'].remove('method_')
|
||||
next if name.start_with?('_') || IGNORE_METHODS.include?(name)
|
||||
|
||||
name.prepend "#{base_name}::"
|
||||
name << "() (#{namespace})"
|
||||
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
|
||||
entries.size > 1 ? entries : []
|
||||
end
|
||||
|
||||
def include_default_entry?
|
||||
!initial_page?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
module Docs
|
||||
class Symfony < UrlScraper
|
||||
self.name = 'Symfony'
|
||||
self.slug = 'symfony'
|
||||
self.type = 'laravel'
|
||||
self.version = '2.6'
|
||||
self.base_url = 'http://api.symfony.com/2.6/'
|
||||
self.root_path = 'namespaces.html'
|
||||
self.initial_paths = %w(classes.html)
|
||||
|
||||
html_filters.push 'symfony/entries', 'symfony/clean_html'
|
||||
|
||||
options[:skip] = %w(
|
||||
panel.html
|
||||
namespaces.html
|
||||
interfaces.html
|
||||
traits.html
|
||||
doc-index.html
|
||||
search.html
|
||||
Symfony.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2004–2015 Fabien Potencier<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 631 B |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1 @@
|
||||
http://symfony.com/logo
|
Loading…
Reference in new issue