diff --git a/assets/images/icons.png b/assets/images/icons.png index c065fd0c..ffda95e6 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 687e859e..68dcfb47 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index dacac194..edfeff7e 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,6 +1,6 @@ [ [ "2015-02-15", - "New io.js, Clojure, Lua and Yii 1.1 documentations" + "New io.js, Symfony, Clojure, Lua and Yii 1.1 documentations" ], [ "2015-02-08", "New dark theme\nClick the icon in the bottom left corner to activate.\nFeedback welcome :)" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 88fb8a11..df72522c 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -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', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index da0a9139..5f9f6e48 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -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; } diff --git a/lib/docs/filters/symfony/clean_html.rb b/lib/docs/filters/symfony/clean_html.rb new file mode 100644 index 00000000..98f6aecc --- /dev/null +++ b/lib/docs/filters/symfony/clean_html.rb @@ -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 diff --git a/lib/docs/filters/symfony/entries.rb b/lib/docs/filters/symfony/entries.rb new file mode 100644 index 00000000..61506e14 --- /dev/null +++ b/lib/docs/filters/symfony/entries.rb @@ -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 diff --git a/lib/docs/scrapers/symfony.rb b/lib/docs/scrapers/symfony.rb new file mode 100644 index 00000000..051e4525 --- /dev/null +++ b/lib/docs/scrapers/symfony.rb @@ -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
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/symfony/16.png b/public/icons/docs/symfony/16.png new file mode 100644 index 00000000..5a9d7b41 Binary files /dev/null and b/public/icons/docs/symfony/16.png differ diff --git a/public/icons/docs/symfony/16@2x.png b/public/icons/docs/symfony/16@2x.png new file mode 100644 index 00000000..4b28191e Binary files /dev/null and b/public/icons/docs/symfony/16@2x.png differ diff --git a/public/icons/docs/symfony/SOURCE b/public/icons/docs/symfony/SOURCE new file mode 100644 index 00000000..7ca550a4 --- /dev/null +++ b/public/icons/docs/symfony/SOURCE @@ -0,0 +1 @@ +http://symfony.com/logo