diff --git a/assets/images/docs.png b/assets/images/docs.png
index 8a9293ae..33daca6b 100644
Binary files a/assets/images/docs.png and b/assets/images/docs.png differ
diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png
index 9b6ec599..83eee866 100644
Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index edb363ff..d4b9263c 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,5 +1,8 @@
[
[
+ "2016-09-18",
+ "New documentation: Twig"
+ ], [
"2016-09-05",
"New documentations: Fish, Bottle and scikit-image"
], [
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index d7a0bc00..ced81f1d 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -524,6 +524,11 @@ credits = [
'2015 The TensorFlow Authors',
'Apache',
'https://raw.githubusercontent.com/tensorflow/tensorflow/master/LICENSE'
+ ], [
+ 'Twig',
+ '2009-2016 The Twig Team',
+ 'BSD',
+ 'http://twig.sensiolabs.org/license'
], [
'TypeScript',
'Microsoft and other contributors',
diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss
index 85cc67b9..fc7a7ee7 100644
--- a/assets/stylesheets/application-dark.css.scss
+++ b/assets/stylesheets/application-dark.css.scss
@@ -84,8 +84,8 @@
'pages/socketio',
'pages/sphinx',
'pages/sphinx_simple',
- 'pages/tcl_tk',
'pages/support_tables',
+ 'pages/tcl_tk',
'pages/tensorflow',
'pages/underscore',
'pages/vagrant',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 923f9ef1..71075c8b 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -118,6 +118,7 @@
._icon-bower:before { background-position: -4rem -6rem; }
._icon-fish:before { background-position: -5rem -6rem; @extend %darkIconFix !optional; }
._icon-scikit_image:before { background-position: -6rem -6rem; }
+._icon-twig:before { background-position: -7rem -6rem; }
._icon-bottle:before { background-position: 0 -7rem; }
._icon-docker:before { background-position: -1rem -7rem; }
._icon-cakephp:before { background-position: -2rem -7rem; }
diff --git a/lib/docs/filters/twig/clean_html.rb b/lib/docs/filters/twig/clean_html.rb
index a214b839..0669950f 100644
--- a/lib/docs/filters/twig/clean_html.rb
+++ b/lib/docs/filters/twig/clean_html.rb
@@ -2,8 +2,36 @@ module Docs
class Twig
class CleanHtmlFilter < Filter
def call
+ css('.infobar', '.offline-docs', '.headerlink').remove
- css('.infobar', '.admonition-note', 'ul.pages', '.offline-docs').remove
+ css('.builtin-reference', '.admonition-wrapper', 'h1 > code', 'h2 > code', '.body-web', '.reference em').each do |node|
+ node.before(node.children).remove
+ end
+
+ css('.section').each do |node|
+ node.first_element_child['id'] = node['id'] if node['id']
+ node.before(node.children).remove
+ end
+
+ doc.child.remove until doc.child.name == 'h1'
+
+ css('.literal-block').each do |node|
+ pre = node.at_css('.highlight pre') || node.at_css('pre')
+ pre.content = pre.content
+ node.replace(pre)
+ end
+
+ css('p.versionadded').each do |node|
+ node.name = 'div'
+ end
+
+ css('h3:contains("Arguments")').each do |node|
+ node.name = 'h4'
+ end
+
+ css('.navigation').each do |node|
+ node['style'] = 'text-align: center'
+ end
doc
end
diff --git a/lib/docs/filters/twig/entries.rb b/lib/docs/filters/twig/entries.rb
index bb21ce9b..01eff393 100644
--- a/lib/docs/filters/twig/entries.rb
+++ b/lib/docs/filters/twig/entries.rb
@@ -2,32 +2,24 @@ module Docs
class Twig
class EntriesFilter < Docs::EntriesFilter
def get_name
- name = at_css('h1').content.strip.tr('ΒΆ', '')
- name
+ at_css('h1').content
end
def get_type
- if slug.include?('deprecate')
- 'Deprecated'
- elsif slug.include?('extensions')
- 'Doc\\Extensions'
- elsif slug.include?('tags')
- 'tags'
- elsif slug.include?('filters')
- 'filters'
- elsif slug.include?('functions')
- 'functions'
- elsif slug.include?('tests')
- 'tests'
- elsif slug.include?('-operator') || slug.include?('#math') || slug.include?('comparisons')
- 'operators'
- elsif slug.in?('doc/index') || slug.include?('intro') || slug.include?('recipes') || slug.include?('internals') || slug.include?('coding_standards') || slug.include?('installation') || slug.include?('api') || slug.include?('advanced')
- 'Doc'
- elsif slug.include?('templates')
- 'Doc\\Templates'
+ if slug.start_with?('filters')
+ 'Filters'
+ elsif slug.start_with?('functions')
+ 'Functions'
+ elsif slug.start_with?('tags')
+ 'Tags'
+ elsif slug.start_with?('tests')
+ 'Tests'
+ elsif slug.start_with?('extensions')
+ 'Extensions'
+ else
+ 'Miscellaneous'
end
end
-
end
end
end
diff --git a/lib/docs/scrapers/twig.rb b/lib/docs/scrapers/twig.rb
index b1ac1a69..36d3d919 100755
--- a/lib/docs/scrapers/twig.rb
+++ b/lib/docs/scrapers/twig.rb
@@ -1,20 +1,20 @@
module Docs
class Twig < UrlScraper
- self.type = 'twig'
+ self.type = 'sphinx'
+ self.release = '1.24'
+ self.base_url = 'http://twig.sensiolabs.org/doc/'
+ self.root_path = 'index.html'
+ self.initial_paths = %w(extensions/index.html)
options[:attribution] = <<-HTML
- © 2009–2016 by SensioLabs
- Licensed under the three clause BSD license.
+ © 2009–2016 by the Twig Team
+ Licensed under the three clause BSD license.
+ The Twig logo is © 2010–2016 SensioLabs
HTML
- self.release = '1.24.1'
- self.base_url = 'http://twig.sensiolabs.org/'
- self.root_path = 'documentation'
-
html_filters.push 'twig/clean_html', 'twig/entries'
options[:container] = 'div.bd > div.content'
- options[:skip_patterns] = [/\Aapi/, /\Alicense/]
- options[:skip] = %w(doc/deprecated.html doc/advanced_legacy.html)
+ options[:skip] = %w(deprecated.html advanced_legacy.html)
end
end
diff --git a/public/icons/docs/twig/16.png b/public/icons/docs/twig/16.png
index b52ef454..4ed5a5ba 100644
Binary files a/public/icons/docs/twig/16.png and b/public/icons/docs/twig/16.png differ
diff --git a/public/icons/docs/twig/16@2x.png b/public/icons/docs/twig/16@2x.png
index 7dacb1a2..38ee63bb 100644
Binary files a/public/icons/docs/twig/16@2x.png and b/public/icons/docs/twig/16@2x.png differ