Split Tensorflow into separate Python, C++ and Guide docs

pull/1165/head
Lukas Geiger 5 years ago
parent d7ca038961
commit c7a2a37280

@ -15,9 +15,9 @@ module Docs
end end
def get_type def get_type
if version == 'Guide' and base_url.path.start_with?('/guide') if base_url.path.start_with?('/guide')
'Guides' 'Guides'
elsif version == 'Guide' and base_url.path.start_with?('/tutorials') elsif base_url.path.start_with?('/tutorials')
'Tutorials' 'Tutorials'
elsif slug.start_with?('tf/audio') elsif slug.start_with?('tf/audio')
'tf.audio' 'tf.audio'

@ -1,10 +1,7 @@
# frozen_string_literal: true
module Docs module Docs
class Tensorflow < UrlScraper class Tensorflow < UrlScraper
self.name = 'TensorFlow' self.name = 'TensorFlow'
self.type = 'tensorflow' self.type = 'tensorflow'
self.release = '2.1'
self.root_path = 'index.html' self.root_path = 'index.html'
self.links = { self.links = {
home: 'https://www.tensorflow.org/', home: 'https://www.tensorflow.org/',
@ -22,17 +19,19 @@ module Docs
Code samples licensed under the Apache 2.0 License. Code samples licensed under the Apache 2.0 License.
HTML HTML
version 'Python' do version '2.1' do
self.base_url = 'https://www.tensorflow.org/api_docs/python/' self.release = '2.1.0'
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"
end end
version 'C++' do version '2.0' do
self.base_url = 'https://www.tensorflow.org/api_docs/cc/' self.release = '2.0.0'
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"
end end
version 'Guide' do version '1.15' do
include MultipleBaseUrls self.release = '1.15.0'
self.base_urls = ['https://www.tensorflow.org/guide/', 'https://www.tensorflow.org/tutorials/'] self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"
end end
def get_latest_version(opts) def get_latest_version(opts)
@ -42,7 +41,7 @@ module Docs
private private
def parse(response) def parse(response)
unless response.url == root_url || self.class.version == 'Guide' unless response.url == root_url
response.body.sub!(/<nav class="devsite-nav-responsive-sidebar.+?<\/nav>/m, '') response.body.sub!(/<nav class="devsite-nav-responsive-sidebar.+?<\/nav>/m, '')
response.body.gsub!(/<li class="devsite-nav-item">.+?<\/li>/m, '') response.body.gsub!(/<li class="devsite-nav-item">.+?<\/li>/m, '')
end end

@ -0,0 +1,21 @@
module Docs
class TensorflowCpp < Tensorflow
self.name = 'TensorFlow C++'
self.slug = 'tensorflow_cpp'
version '2.1' do
self.release = '2.1.0'
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
end
version '2.0' do
self.release = '2.0.0'
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
end
version '1.15' do
self.release = '1.15.0'
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
end
end
end

@ -0,0 +1,9 @@
module Docs
class TensorflowGuide < Tensorflow
include MultipleBaseUrls
self.name = 'TensorFlow Guides'
self.slug = 'tensorflow_guide'
self.base_urls = ['https://www.tensorflow.org/guide/', 'https://www.tensorflow.org/tutorials/']
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

@ -0,0 +1 @@
https://www.tensorflow.org/images/favicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

@ -0,0 +1 @@
https://www.tensorflow.org/images/favicon.png
Loading…
Cancel
Save