Unified · Split
| @@ -743,7 +743,7 @@ credits = [ · 742 unmodified lines | |||
| 743 | 'http://tcl.tk/software/tcltk/license.html' | 743 | 'http://tcl.tk/software/tcltk/license.html' |
| 744 | ], [ | 744 | ], [ |
| 745 | 'TensorFlow', | 745 | 'TensorFlow', |
| 746 | '2018 The TensorFlow Authors', | 746 | '2019 The TensorFlow Authors', |
| 747 | 'CC BY', | 747 | 'CC BY', |
| 748 | 'https://creativecommons.org/licenses/by/3.0/' | 748 | 'https://creativecommons.org/licenses/by/3.0/' |
| 749 | ], [ | 749 | ], [ |
| @@ -4,4 +4,5 @@ · 3 unmodified lines | |||
| 4 | h4 { @extend %block-label; } | 4 | h4 { @extend %block-label; } |
| 5 | h3 + h3 { margin-top: .25rem; } | 5 | h3 + h3 { margin-top: .25rem; } |
| 6 | > .toc ul ul { margin: .25rem 0; } | 6 | > .toc ul ul { margin: .25rem 0; } |
| 7 | table { float: inherit } | ||
| 7 | } | 8 | } |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('.devsite-article-inner') | 5 | @doc = at_css('.devsite-article-inner') |
| 6 | 6 | ||
| 7 | css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br').remove | 7 | css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br', '.devsite-article-meta', 'devsite-nav-buttons').remove |
| 8 | 8 | ||
| 9 | css('aside.note').each do |node| | 9 | css('aside.note').each do |node| |
| 10 | node.name = 'blockquote' | 10 | node.name = 'blockquote' |
| @@ -7,35 +7,108 @@ module Docs · 6 unmodified lines | |||
| 7 | name = at_css('h1').content.strip | 7 | name = at_css('h1').content.strip |
| 8 | name.remove! 'class ' | 8 | name.remove! 'class ' |
| 9 | name.remove! 'struct ' | 9 | name.remove! 'struct ' |
| 10 | name.remove! 'module: ' | 10 | name.remove! 'Module: ' |
| 11 | name.remove! %r{ \(.+\)} | 11 | name.remove! %r{ \(.+\)} |
| 12 | name.sub! %r{(?<!\ )\(.+\)}, '()' | 12 | name.sub! %r{(?<!\ )\(.+\)}, '()' |
| 13 | name.remove! %r{\.\z} | 13 | name.remove! %r{\.\z} |
| 14 | name.sub! 'tf.contrib', 'contrib' unless version == 'Guide' | ||
| 15 | name | 14 | name |
| 16 | end | 15 | end |
| 17 | 16 | ||
| 18 | TYPE_BY_DIR = { | ||
| 19 | 'get_started' => 'Get Started', | ||
| 20 | 'programmers_guide' => 'Guide', | ||
| 21 | 'tutorials' => 'Tutorials', | ||
| 22 | 'performance' => 'Performance', | ||
| 23 | 'deploy' => 'Deploy', | ||
| 24 | 'extend' => 'Extend' | ||
| 25 | } | ||
| 26 | |||
| 27 | def get_type | 17 | def get_type |
| 28 | return 'Guides' if base_url.path.start_with?('/api_guides') | 18 | if version == 'Guide' and base_url.path.start_with?('/guide') |
| 29 | 19 | 'Guides' | |
| 30 | if version == 'Guide' | 20 | elsif version == 'Guide' and base_url.path.start_with?('/tutorials') |
| 31 | TYPE_BY_DIR[subpath.split('/').first] | 21 | 'Tutorials' |
| 22 | elsif slug.start_with?('tf/audio') | ||
| 23 | 'tf.audio' | ||
| 24 | elsif slug.start_with?('tf/autograph') | ||
| 25 | 'tf.autograph' | ||
| 26 | elsif slug.start_with?('tf/bitwise') | ||
| 27 | 'tf.bitwise' | ||
| 28 | elsif slug.start_with?('tf/compat') | ||
| 29 | 'tf.compat' | ||
| 30 | elsif slug.start_with?('tf/config') | ||
| 31 | 'tf.config' | ||
| 32 | elsif slug.start_with?('tf/data') | ||
| 33 | 'tf.data' | ||
| 34 | elsif slug.start_with?('tf/debugging') | ||
| 35 | 'tf.debugging' | ||
| 36 | elsif slug.start_with?('tf/distribute') | ||
| 37 | 'tf.distribute' | ||
| 38 | elsif slug.start_with?('tf/dtypes') | ||
| 39 | 'tf.dtypes' | ||
| 40 | elsif slug.start_with?('tf/errors') | ||
| 41 | 'tf.errors' | ||
| 42 | elsif slug.start_with?('tf/estimator') | ||
| 43 | 'tf.estimator' | ||
| 44 | elsif slug.start_with?('tf/experimental') | ||
| 45 | 'tf.experimental' | ||
| 46 | elsif slug.start_with?('tf/feature_column') | ||
| 47 | 'tf.feature_column' | ||
| 48 | elsif slug.start_with?('tf/graph_util') | ||
| 49 | 'tf.graph_util' | ||
| 50 | elsif slug.start_with?('tf/image') | ||
| 51 | 'tf.image' | ||
| 52 | elsif slug.start_with?('tf/initializers') | ||
| 53 | 'tf.initializers' | ||
| 54 | elsif slug.start_with?('tf/io') | ||
| 55 | 'tf.io' | ||
| 56 | elsif slug.start_with?('tf/keras') | ||
| 57 | 'tf.keras' | ||
| 58 | elsif slug.start_with?('tf/linalg') | ||
| 59 | 'tf.linalg' | ||
| 60 | elsif slug.start_with?('tf/lite') | ||
| 61 | 'tf.lite' | ||
| 62 | elsif slug.start_with?('tf/lookup') | ||
| 63 | 'tf.lookup' | ||
| 64 | elsif slug.start_with?('tf/losses') | ||
| 65 | 'tf.losses' | ||
| 66 | elsif slug.start_with?('tf/math') | ||
| 67 | 'tf.math' | ||
| 68 | elsif slug.start_with?('tf/metrics') | ||
| 69 | 'tf.metrics' | ||
| 70 | elsif slug.start_with?('tf/nest') | ||
| 71 | 'tf.nest' | ||
| 72 | elsif slug.start_with?('tf/nn') | ||
| 73 | 'tf.nn' | ||
| 74 | elsif slug.start_with?('tf/optimizers') | ||
| 75 | 'tf.optimizers' | ||
| 76 | elsif slug.start_with?('tf/quantization') | ||
| 77 | 'tf.quantization' | ||
| 78 | elsif slug.start_with?('tf/queue') | ||
| 79 | 'tf.queue' | ||
| 80 | elsif slug.start_with?('tf/ragged') | ||
| 81 | 'tf.ragged' | ||
| 82 | elsif slug.start_with?('tf/random') | ||
| 83 | 'tf.random' | ||
| 84 | elsif slug.start_with?('tf/raw_ops') | ||
| 85 | 'tf.raw_ops' | ||
| 86 | elsif slug.start_with?('tf/saved_model') | ||
| 87 | 'tf.saved_model' | ||
| 88 | elsif slug.start_with?('tf/sets') | ||
| 89 | 'tf.sets' | ||
| 90 | elsif slug.start_with?('tf/signal') | ||
| 91 | 'tf.signal' | ||
| 92 | elsif slug.start_with?('tf/sparse') | ||
| 93 | 'tf.sparse' | ||
| 94 | elsif slug.start_with?('tf/strings') | ||
| 95 | 'tf.strings' | ||
| 96 | elsif slug.start_with?('tf/summary') | ||
| 97 | 'tf.summary' | ||
| 98 | elsif slug.start_with?('tf/sysconfig') | ||
| 99 | 'tf.sysconfig' | ||
| 100 | elsif slug.start_with?('tf/test') | ||
| 101 | 'tf.test' | ||
| 102 | elsif slug.start_with?('tf/tpu') | ||
| 103 | 'tf.tpu' | ||
| 104 | elsif slug.start_with?('tf/train') | ||
| 105 | 'tf.train' | ||
| 106 | elsif slug.start_with?('tf/version') | ||
| 107 | 'tf.version' | ||
| 108 | elsif slug.start_with?('tf/xla') | ||
| 109 | 'tf.xla' | ||
| 32 | else | 110 | else |
| 33 | node = at_css('.devsite-nav-item.devsite-nav-active') | 111 | 'tf' |
| 34 | node = node.ancestors('.devsite-nav-item').first.at_css('.devsite-nav-title') | ||
| 35 | type = node.content | ||
| 36 | type.remove! %r{\.\z} | ||
| 37 | type = 'tf.contrib' if type.start_with?('tf.contrib') | ||
| 38 | type | ||
| 39 | end | 112 | end |
| 40 | end | 113 | end |
| 41 | end | 114 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | class Tensorflow < UrlScraper | 4 | class Tensorflow < UrlScraper |
| 5 | self.name = 'TensorFlow' | 5 | self.name = 'TensorFlow' |
| 6 | self.type = 'tensorflow' | 6 | self.type = 'tensorflow' |
| 7 | self.release = '1.8' | 7 | self.release = '2.0' |
| 8 | self.root_path = 'index.html' | 8 | self.root_path = 'index.html' |
| 9 | self.links = { | 9 | self.links = { |
| 10 | home: 'https://www.tensorflow.org/', | 10 | home: 'https://www.tensorflow.org/', |
| @@ -16,44 +16,23 @@ module Docs · 5 unmodified lines | |||
| 16 | options[:max_image_size] = 300_000 | 16 | options[:max_image_size] = 300_000 |
| 17 | options[:container] = '.devsite-main-content' | 17 | options[:container] = '.devsite-main-content' |
| 18 | 18 | ||
| 19 | options[:fix_urls] = ->(url) do | ||
| 20 | url.sub! 'how_tos/../tutorials', 'tutorials' | ||
| 21 | url | ||
| 22 | end | ||
| 23 | |||
| 24 | options[:attribution] = <<-HTML | 19 | options[:attribution] = <<-HTML |
| 25 | © 2018 The TensorFlow Authors. All rights reserved.<br> | 20 | © 2019 The TensorFlow Authors. All rights reserved.<br> |
| 26 | Licensed under the Creative Commons Attribution License 3.0.<br> | 21 | Licensed under the Creative Commons Attribution License 3.0.<br> |
| 27 | Code samples licensed under the Apache 2.0 License. | 22 | Code samples licensed under the Apache 2.0 License. |
| 28 | HTML | 23 | HTML |
| 29 | 24 | ||
| 30 | version 'Python' do | 25 | version 'Python' do |
| 31 | include MultipleBaseUrls | 26 | self.base_url = 'https://www.tensorflow.org/api_docs/python/' |
| 32 | self.base_urls = ['https://www.tensorflow.org/api_docs/python/', 'https://www.tensorflow.org/api_guides/python/'] | ||
| 33 | end | 27 | end |
| 34 | 28 | ||
| 35 | version 'C++' do | 29 | version 'C++' do |
| 36 | include MultipleBaseUrls | 30 | self.base_url = 'https://www.tensorflow.org/api_docs/cc/' |
| 37 | self.base_urls = ['https://www.tensorflow.org/api_docs/cc/', 'https://www.tensorflow.org/api_guides/cc/'] | ||
| 38 | end | 31 | end |
| 39 | 32 | ||
| 40 | version 'Guide' do | 33 | version 'Guide' do |
| 41 | self.base_url = 'https://www.tensorflow.org/' | 34 | include MultipleBaseUrls |
| 42 | self.root_path = 'get_started/get_started' | 35 | self.base_urls = ['https://www.tensorflow.org/guide/', 'https://www.tensorflow.org/tutorials/'] |
| 43 | self.initial_paths = %w( | ||
| 44 | programmers_guide/reading_data | ||
| 45 | tutorials/mandelbrot | ||
| 46 | performance/performance_guide | ||
| 47 | deploy/hadoop | ||
| 48 | extend/architecture) | ||
| 49 | |||
| 50 | options[:only_patterns] = [ | ||
| 51 | /\Aget_started/, | ||
| 52 | /\Aprogrammers_guide/, | ||
| 53 | /\Atutorials/, | ||
| 54 | /\Aperformance/, | ||
| 55 | /\Adeploy/, | ||
| 56 | /\Aextend/] | ||
| 57 | end | 36 | end |
| 58 | 37 | ||
| 59 | def get_latest_version(opts) | 38 | def get_latest_version(opts) |
Binary file not shown.
Binary file not shown.