History

Add documentation for TensorFlow's python API

Jonas Meinertz Hansen committed 10 years ago

Commit cd55b861 parent 9c9b2ac9 files · +74 −-2Browse files

Unified · Split

9 files
  1. assets/stylesheets/application-dark.css.scss +1 −0
  2. assets/stylesheets/application.css.scss +1 −0
  3. assets/stylesheets/pages/_tensorflow.scss +12 −0
  4. lib/docs/filters/tensorflow/clean_html.rb +10 −0
  5. lib/docs/filters/tensorflow/entries.rb +33 −0
  6. lib/docs/scrapers/tensorflow.rb +18 −0
  7. public/icons/docs/tensorflow/16.png +0 −0
  8. public/icons/docs/tensorflow/16@2x.png +0 −0
  9. public/icons/docs/tensorflow/SOURCE +1 −0
assets/stylesheets/application-dark.css.scss+1−0
@@ -76,6 +76,7 @@ · 75 unmodified lines
76 'pages/sphinx',76 'pages/sphinx',
77 'pages/sphinx_simple',77 'pages/sphinx_simple',
78 'pages/tcl_tk',78 'pages/tcl_tk',
79 'pages/tensorflow',
79 'pages/underscore',80 'pages/underscore',
80 'pages/vagrant',81 'pages/vagrant',
81 'pages/vue',82 'pages/vue',
assets/stylesheets/application.css.scss+1−0
@@ -76,6 +76,7 @@ · 75 unmodified lines
76 'pages/sphinx',76 'pages/sphinx',
77 'pages/sphinx_simple',77 'pages/sphinx_simple',
78 'pages/tcl_tk',78 'pages/tcl_tk',
79 'pages/tensorflow',
79 'pages/underscore',80 'pages/underscore',
80 'pages/vagrant',81 'pages/vagrant',
81 'pages/vue',82 'pages/vue',
assets/stylesheets/pages/_tensorflow.scss+12−0
@@ -0,0 +1,12 @@
1._tensorflow {
2 h2, h3, h4 { @extend %block-heading, %label-blue; }
3 p > code, li > code { @extend %label; }
4
5 // These are used for lists of arguments and return values in the docs.
6 b > code {
7 @extend %label;
8 background-color: initial;
9 font-weight: 500;
10 font-size: 1.1em;
11 }
12}
lib/docs/filters/tensorflow/clean_html.rb+10−0
@@ -0,0 +1,10 @@
1module Docs
2 class Tensorflow
3 class CleanHtmlFilter < Filter
4 def call
5 css('hr').remove
6 doc
7 end
8 end
9 end
10end
lib/docs/filters/tensorflow/entries.rb+33−0
@@ -0,0 +1,33 @@
1module Docs
2 class Tensorflow
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 at_css('h1').content
6 end
7
8 def get_type
9 at_css('h1').content
10 end
11
12 def include_default_entry?
13 false
14 end
15
16 def additional_entries
17 entries = []
18
19 # Just get everything that is a code tag inside a header tag. I haven't
20 # checked if all of these are necessary.
21 ents = css('h5 code') + css('h4 code') + css('h3 code') + css('h2 code')
22
23 ents.each do |node|
24 name = node.content.sub(/\(.*\)/, '()')
25 id = node.parent['id']
26 entries << [name, id, get_name]
27 end
28
29 entries
30 end
31 end
32 end
33end
lib/docs/scrapers/tensorflow.rb+18−0
@@ -0,0 +1,18 @@
1module Docs
2 class Tensorflow < UrlScraper
3 self.name = 'TensorFlow'
4 self.slug = 'tensorflow'
5 self.type = 'tensorflow'
6 self.release = '0.6.0-py'
7 self.base_url = 'https://www.tensorflow.org/versions/0.6.0/api_docs/python/'
8
9 options[:container] = '#content'
10
11 html_filters.push 'tensorflow/entries', 'tensorflow/clean_html', 'clean_html'
12
13 options[:attribution] = <<-HTML
14 &copy; The TensorFlow Authors. All rights reserved.<br>
15 Licensed under the Apache 2.0 License.
16 HTML
17 end
18end
public/icons/docs/tensorflow/16.png+0−0

Binary file not shown.

public/icons/docs/tensorflow/16@2x.png+0−0

Binary file not shown.

public/icons/docs/tensorflow/SOURCE+1−0
@@ -0,0 +1 @@
1https://www.tensorflow.org/images/favicon.png