Add Symfony documentation

pull/168/head
Thibaut 10 years ago
parent e7f8bf443e
commit 9a99e79fe9

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 74 KiB

@ -1,6 +1,6 @@
[
[ "2015-02-15",
"New <a href=\"/iojs/\">io.js</a>, <a href=\"/clojure/\">Clojure</a>, <a href=\"/lua/\">Lua</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"
"New <a href=\"/iojs/\">io.js</a>, <a href=\"/symfony/\">Symfony</a>, <a href=\"/clojure/\">Clojure</a>, <a href=\"/lua/\">Lua</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"
], [
"2015-02-08",
"New dark theme\nClick the icon in the bottom left corner to activate.\n<a href=\"https://github.com/Thibaut/devdocs/issues\" target=\"_blank\">Feedback</a> welcome :)"

@ -320,6 +320,11 @@ credits = [
'2014-2015 Automattic',
'MIT',
'https://raw.githubusercontent.com/Automattic/socket.io/master/LICENSE'
], [
'Symfony',
'2004-2015 Fabien Potencier',
'MIT',
'http://symfony.com/doc/current/contributing/code/license.html'
], [
'Underscore.js',
'2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',

@ -88,3 +88,4 @@
._icon-iojs:before { background-position: -2rem -7rem; }
._icon-lua:before { background-position: -3rem -7rem; }
._icon-clojure:before { background-position: -4rem -7rem; }
._icon-symfony:before { background-position: -5rem -7rem; }

@ -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
&copy; 2004&ndash;2015 Fabien Potencier<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1 @@
http://symfony.com/logo
Loading…
Cancel
Save