Showing the changes to lib/docs (3 of 9 files). Show all
Unified · Split
| @@ -0,0 +1,10 @@ | ||
| 1 | +module Docs | |
| 2 | + class Tensorflow | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + css('hr').remove | |
| 6 | + doc | |
| 7 | + end | |
| 8 | + end | |
| 9 | + end | |
| 10 | +end | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +module 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 | |
| 33 | +end | |
| @@ -0,0 +1,18 @@ | ||
| 1 | +module 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 | + © The TensorFlow Authors. All rights reserved.<br> | |
| 15 | + Licensed under the Apache 2.0 License. | |
| 16 | + HTML | |
| 17 | + end | |
| 18 | +end | |