diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 48a664f4..48314be5 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -76,6 +76,7 @@ 'pages/sphinx', 'pages/sphinx_simple', 'pages/tcl_tk', + 'pages/tensorflow', 'pages/underscore', 'pages/vagrant', 'pages/vue', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index e554c901..8ed497ce 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -76,6 +76,7 @@ 'pages/sphinx', 'pages/sphinx_simple', 'pages/tcl_tk', + 'pages/tensorflow', 'pages/underscore', 'pages/vagrant', 'pages/vue', diff --git a/assets/stylesheets/pages/_tensorflow.scss b/assets/stylesheets/pages/_tensorflow.scss new file mode 100644 index 00000000..8ad840d7 --- /dev/null +++ b/assets/stylesheets/pages/_tensorflow.scss @@ -0,0 +1,12 @@ +._tensorflow { + h2, h3, h4 { @extend %block-heading, %label-blue; } + p > code, li > code { @extend %label; } + + // 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; + } +} diff --git a/lib/docs/filters/tensorflow/clean_html.rb b/lib/docs/filters/tensorflow/clean_html.rb new file mode 100644 index 00000000..1967a7e0 --- /dev/null +++ b/lib/docs/filters/tensorflow/clean_html.rb @@ -0,0 +1,10 @@ +module Docs + class Tensorflow + class CleanHtmlFilter < Filter + def call + css('hr').remove + doc + end + end + end +end diff --git a/lib/docs/filters/tensorflow/entries.rb b/lib/docs/filters/tensorflow/entries.rb new file mode 100644 index 00000000..7b86b504 --- /dev/null +++ b/lib/docs/filters/tensorflow/entries.rb @@ -0,0 +1,33 @@ +module Docs + class Tensorflow + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + at_css('h1').content + end + + def include_default_entry? + false + 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] + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/tensorflow.rb b/lib/docs/scrapers/tensorflow.rb new file mode 100644 index 00000000..c6436cdd --- /dev/null +++ b/lib/docs/scrapers/tensorflow.rb @@ -0,0 +1,18 @@ +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', 'clean_html' + + options[:attribution] = <<-HTML + © The TensorFlow Authors. All rights reserved.
+ Licensed under the Apache 2.0 License. + HTML + end +end diff --git a/public/icons/docs/tensorflow/16.png b/public/icons/docs/tensorflow/16.png new file mode 100644 index 00000000..2ec8a330 Binary files /dev/null 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 new file mode 100644 index 00000000..49f666fe Binary files /dev/null and b/public/icons/docs/tensorflow/16@2x.png differ diff --git a/public/icons/docs/tensorflow/SOURCE b/public/icons/docs/tensorflow/SOURCE new file mode 100644 index 00000000..3d2bb927 --- /dev/null +++ b/public/icons/docs/tensorflow/SOURCE @@ -0,0 +1 @@ +https://www.tensorflow.org/images/favicon.png \ No newline at end of file