diff --git a/assets/images/icons.png b/assets/images/icons.png
index b5c35560..d706a785 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 5aa844b4..64cb5cd9 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 3d2b9a68..52986d3c 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,5 +1,8 @@
[
[
+ "2016-03-06",
+ "New documentation: TensorFlow"
+ ], [
"2016-02-28",
"New documentations: CodeIgniter, nginx Lua Module and InfluxData"
], [
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 78ae86d6..94e2b725 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -414,6 +414,11 @@ credits = [
'The Regents of the University of California, Sun Microsystems, Inc., Scriptics Corporation, and other parties',
'Tcl/Tk',
'http://tcl.tk/software/tcltk/license.html'
+ ], [
+ 'TensorFlow',
+ '2015 The TensorFlow Authors',
+ 'Apache',
+ 'https://raw.githubusercontent.com/tensorflow/tensorflow/master/LICENSE'
], [
'Underscore.js',
'2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
diff --git a/assets/javascripts/views/pages/tensorflow.coffee b/assets/javascripts/views/pages/tensorflow.coffee
new file mode 100644
index 00000000..7321592f
--- /dev/null
+++ b/assets/javascripts/views/pages/tensorflow.coffee
@@ -0,0 +1,7 @@
+#= require views/pages/base
+
+class app.views.TensorflowPage extends app.views.BasePage
+ prepare: ->
+ @highlightCode @findAll('pre[class*="lang-c++"]'), 'cpp'
+ @highlightCode @findAll('pre.lang-python'), 'python'
+ return
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 9b88ecee..c06d1acd 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -129,3 +129,4 @@
._icon-ramda:before { background-position: -3rem -10rem; @extend %darkIconFix !optional; }
._icon-codeigniter:before { background-position: -4rem -10rem; @extend %darkIconFix !optional; }
._icon-influxdata:before { background-position: -5rem -10rem; @extend %darkIconFix !optional; }
+._icon-tensorflow:before { background-position: -6rem -10rem; }
diff --git a/assets/stylesheets/pages/_tensorflow.scss b/assets/stylesheets/pages/_tensorflow.scss
index 8ad840d7..bd755174 100644
--- a/assets/stylesheets/pages/_tensorflow.scss
+++ b/assets/stylesheets/pages/_tensorflow.scss
@@ -1,12 +1,6 @@
._tensorflow {
- h2, h3, h4 { @extend %block-heading, %label-blue; }
- p > code, li > code { @extend %label; }
+ @extend %simple;
- // These are used for lists of arguments and return values in the docs.
- b > code {
- @extend %label;
- background-color: initial;
- font-weight: 500;
- font-size: 1.1em;
- }
+ h4 { @extend %block-label; }
+ > .toc ul ul { margin: .25rem 0; }
}
diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb
index f84908b9..a4bda2a7 100644
--- a/lib/docs/core/doc.rb
+++ b/lib/docs/core/doc.rb
@@ -48,7 +48,7 @@ module Docs
def slug
slug = @slug || name.try(:downcase)
- version? ? "#{slug}~#{version.downcase.gsub(/[^a-z0-9\_\.]/, '_')}" : slug
+ version? ? "#{slug}~#{version.downcase.gsub('+', 'p').gsub(/[^a-z0-9\_\.]/, '_')}" : slug
end
def path
diff --git a/lib/docs/filters/tensorflow/clean_html.rb b/lib/docs/filters/tensorflow/clean_html.rb
index 1967a7e0..18a8e5a4 100644
--- a/lib/docs/filters/tensorflow/clean_html.rb
+++ b/lib/docs/filters/tensorflow/clean_html.rb
@@ -3,6 +3,16 @@ module Docs
class CleanHtmlFilter < Filter
def call
css('hr').remove
+
+ css('pre > code').each do |node|
+ node.parent['class'] = node['class']
+ node.parent.content = node.content
+ end
+
+ css('b').each do |node|
+ node.before(node.children).remove
+ end
+
doc
end
end
diff --git a/lib/docs/filters/tensorflow/entries.rb b/lib/docs/filters/tensorflow/entries.rb
index 7b86b504..80b4e3db 100644
--- a/lib/docs/filters/tensorflow/entries.rb
+++ b/lib/docs/filters/tensorflow/entries.rb
@@ -2,31 +2,26 @@ module Docs
class Tensorflow
class EntriesFilter < Docs::EntriesFilter
def get_name
- at_css('h1').content
+ name = at_css('h1').content.strip
+ name.remove! 'class '
+ name.remove! 'struct '
+ name
end
def get_type
- at_css('h1').content
- end
-
- def include_default_entry?
- false
+ type = name.dup
+ type.remove! %r{\ \(.*\)}
+ type.remove! 'tensorflow::'
+ type
end
def additional_entries
- entries = []
-
- # Just get everything that is a code tag inside a header tag. I haven't
- # checked if all of these are necessary.
- ents = css('h5 code') + css('h4 code') + css('h3 code') + css('h2 code')
-
- ents.each do |node|
- name = node.content.sub(/\(.*\)/, '()')
- id = node.parent['id']
- entries << [name, id, get_name]
+ css('h2 code', 'h3 code', 'h4 code', 'h5 code').map do |node|
+ name = node.content
+ name.sub! %r{\(.*}, '()'
+ name = name.split(' ').last
+ [name, node.parent['id']]
end
-
- entries
end
end
end
diff --git a/lib/docs/scrapers/tensorflow.rb b/lib/docs/scrapers/tensorflow.rb
index c6436cdd..09403348 100644
--- a/lib/docs/scrapers/tensorflow.rb
+++ b/lib/docs/scrapers/tensorflow.rb
@@ -1,18 +1,31 @@
module Docs
class Tensorflow < UrlScraper
self.name = 'TensorFlow'
- self.slug = 'tensorflow'
self.type = 'tensorflow'
- self.release = '0.6.0-py'
- self.base_url = 'https://www.tensorflow.org/versions/0.6.0/api_docs/python/'
- options[:container] = '#content'
+ html_filters.push 'tensorflow/entries', 'tensorflow/clean_html'
- html_filters.push 'tensorflow/entries', 'tensorflow/clean_html', 'clean_html'
+ options[:container] = '#content'
options[:attribution] = <<-HTML
- © The TensorFlow Authors. All rights reserved.
+ © 2015 The TensorFlow Authors. All rights reserved.
Licensed under the Apache 2.0 License.
HTML
+
+ version 'Python' do
+ self.base_url = 'https://www.tensorflow.org/versions/r0.7/api_docs/python/'
+ self.release = '0.7'
+ end
+
+ version 'C++' do
+ self.base_url = 'https://www.tensorflow.org/versions/r0.7/api_docs/cc/'
+ self.release = '0.7'
+
+ options[:fix_urls] = ->(url) {
+ url.sub! '/api_docs/cc/class', '/api_docs/cc/Class'
+ url.sub! '/api_docs/cc/struct', '/api_docs/cc/Struct'
+ url
+ }
+ end
end
end
diff --git a/public/icons/docs/tensorflow/16.png b/public/icons/docs/tensorflow/16.png
index 2ec8a330..07f894e5 100644
Binary files a/public/icons/docs/tensorflow/16.png and b/public/icons/docs/tensorflow/16.png differ
diff --git a/public/icons/docs/tensorflow/16@2x.png b/public/icons/docs/tensorflow/16@2x.png
index 49f666fe..94eebc91 100644
Binary files a/public/icons/docs/tensorflow/16@2x.png and b/public/icons/docs/tensorflow/16@2x.png differ