Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | ._rethinkdb { |
| 2 | − > h2 { @extend %block-heading; } | |
| 3 | − code { @extend %label; } | |
| 2 | + @extend %simple; | |
| 3 | + | |
| 4 | + .infobox-alert { @extend %note-orange; } | |
| 4 | 5 | |
| 5 | 6 | .api_command_illustration { |
| 6 | 7 | float: right; |
| @@ -2,16 +2,13 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Rethinkdb |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − if root_page? | |
| 6 | − doc.inner_html = '<h1>ReQL command reference</h1>' | |
| 7 | − return doc | |
| 8 | − end | |
| 5 | + @doc = at_css('.docs-article') | |
| 9 | 6 | |
| 10 | 7 | css('header .title').each do |node| |
| 11 | 8 | node.parent.replace(node) |
| 12 | 9 | end |
| 13 | 10 | |
| 14 | − css('.lang-selector').remove | |
| 11 | + css('.lang-selector', '.platform-buttons img', 'hr', '#in-this-article').remove | |
| 15 | 12 | |
| 16 | 13 | css('.command-syntax').each do |node| |
| 17 | 14 | node.name = 'pre' |
| @@ -22,19 +19,33 @@ module Docs · 4 unmodified lines | ||
| 22 | 19 | node.content = node.content |
| 23 | 20 | end |
| 24 | 21 | |
| 25 | − css('.highlight', '> section', '.highlighter-rouge').each do |node| | |
| 22 | + css('.highlight', 'section', 'div.highlighter-rouge', 'a > p', 'li > h1').each do |node| | |
| 26 | 23 | node.before(node.children).remove |
| 27 | 24 | end |
| 28 | 25 | |
| 26 | + css('h2, h3, h4').each do |node| | |
| 27 | + node.name = node.name.sub(/\d/) { |i| i.to_i + 1 } | |
| 28 | + end | |
| 29 | + | |
| 29 | 30 | css('h1').each do |node| |
| 30 | 31 | next if node['class'].to_s.include?('title') |
| 31 | 32 | node.name = 'h2' |
| 32 | 33 | end |
| 33 | 34 | |
| 35 | + css('td h2').each do |node| | |
| 36 | + node.name = 'h5' | |
| 37 | + end | |
| 38 | + | |
| 34 | 39 | css('pre').each do |node| |
| 35 | 40 | node['data-language'] = current_url.path[/\A\/api\/(\w+)\//, 1] |
| 36 | 41 | end |
| 37 | 42 | |
| 43 | + css('.infobox').each do |node| | |
| 44 | + node.name = 'blockquote' | |
| 45 | + end | |
| 46 | + | |
| 47 | + css('> .infobox:last-child:contains("Contribute:")').remove | |
| 48 | + | |
| 38 | 49 | doc |
| 39 | 50 | end |
| 40 | 51 | end |
| @@ -2,20 +2,34 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Rethinkdb |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − at_css('.title').content.remove('ReQL command:').split(', ').first | |
| 5 | + if subpath.start_with?('api') | |
| 6 | + at_css('.title').content.remove('ReQL command:').split(', ').first | |
| 7 | + else | |
| 8 | + at_css('.docs-nav .active').content | |
| 9 | + end | |
| 6 | 10 | end |
| 7 | 11 | |
| 8 | 12 | def get_type |
| 9 | − link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/"]') | |
| 10 | − dir = link['href'][/api\/\w+\/([^\/]+)/, 1] | |
| 11 | − dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and') | |
| 13 | + if subpath.start_with?('api') | |
| 14 | + link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/"]') | |
| 15 | + dir = link['href'][/api\/\w+\/([^\/]+)/, 1] | |
| 16 | + return 'Reference' if dir == 'index.md' | |
| 17 | + dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and') | |
| 18 | + else | |
| 19 | + at_css('.docs-nav .expanded').previous_element.content.prepend('Guides: ') | |
| 20 | + end | |
| 12 | 21 | end |
| 13 | 22 | |
| 14 | 23 | def additional_entries |
| 24 | + return [] unless subpath.start_with?('api') | |
| 15 | 25 | at_css('.title').content.split(', ')[1..-1].map do |name| |
| 16 | 26 | [name] |
| 17 | 27 | end |
| 18 | 28 | end |
| 29 | + | |
| 30 | + def include_default_entry? | |
| 31 | + at_css('.docs-article p').try(:content) != 'Choose your language:' | |
| 32 | + end | |
| 19 | 33 | end |
| 20 | 34 | end |
| 21 | 35 | end |
| @@ -2,7 +2,9 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Rethinkdb < UrlScraper |
| 3 | 3 | self.name = 'RethinkDB' |
| 4 | 4 | self.type = 'rethinkdb' |
| 5 | − self.release = '2.3.2' | |
| 5 | + self.base_url = 'https://rethinkdb.com/' | |
| 6 | + self.release = '2.3.5' | |
| 7 | + self.root_path = 'docs/' | |
| 6 | 8 | self.links = { |
| 7 | 9 | home: 'https://rethinkdb.com/', |
| 8 | 10 | code: 'https://github.com/rethinkdb/rethinkdb' |
| @@ -10,44 +12,57 @@ module Docs · 1 unmodified line | ||
| 10 | 12 | |
| 11 | 13 | html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html' |
| 12 | 14 | |
| 13 | − options[:trailing_slash] = false | |
| 14 | − options[:container] = '.docs-article' | |
| 15 | + options[:trailing_slash] = true | |
| 16 | + options[:container] = '.documentation' | |
| 17 | + | |
| 18 | + options[:only_patterns] = [/\Adocs/] | |
| 19 | + options[:skip_patterns] = [/docs\/install(\-drivers)?\/./] | |
| 20 | + options[:skip] = %w( | |
| 21 | + docs/build/ | |
| 22 | + docs/tutorials/elections/ | |
| 23 | + docs/tutorials/superheroes/) | |
| 24 | + | |
| 25 | + MULTILANG_DOCS = %w( | |
| 26 | + changefeeds | |
| 27 | + cookbook | |
| 28 | + dates-and-times | |
| 29 | + geo-support | |
| 30 | + guide | |
| 31 | + nested-fields | |
| 32 | + publish-subscribe | |
| 33 | + rabbitmq | |
| 34 | + secondary-indexes | |
| 35 | + sql-to-reql | |
| 36 | + storing-binary) | |
| 15 | 37 | |
| 16 | 38 | options[:attribution] = <<-HTML |
| 17 | 39 | © RethinkDB contributors<br> |
| 18 | 40 | Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. |
| 19 | 41 | HTML |
| 20 | 42 | |
| 21 | − version 'JavaScript' do | |
| 22 | − self.base_url = 'https://rethinkdb.com/api/javascript/' | |
| 23 | − | |
| 24 | − options[:fix_urls] = ->(url) do | |
| 25 | − url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/javascript/' | |
| 26 | − end | |
| 27 | − end | |
| 28 | − | |
| 29 | − version 'Ruby' do | |
| 30 | − self.base_url = 'https://rethinkdb.com/api/ruby/' | |
| 31 | − | |
| 32 | − options[:fix_urls] = ->(url) do | |
| 33 | − url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/ruby/' | |
| 34 | − end | |
| 35 | − end | |
| 43 | + %w(JavaScript Ruby Python Java).each do |name| | |
| 44 | + path = name.downcase | |
| 45 | + instance_eval <<-CODE | |
| 46 | + version '#{name}' do | |
| 47 | + self.initial_paths = %w(api/#{path}/) | |
| 36 | 48 | |
| 37 | − version 'Python' do | |
| 38 | − self.base_url = 'https://rethinkdb.com/api/python/' | |
| 49 | + options[:only_patterns] += [/\\Aapi\\/#{path}\\//] | |
| 39 | 50 | |
| 40 | − options[:fix_urls] = ->(url) do | |
| 41 | − url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/python/' | |
| 42 | − end | |
| 51 | + options[:fix_urls] = ->(url) do | |
| 52 | + url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/#{path}/' | |
| 53 | + url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!#{path}/).*}, 'rethinkdb.com/docs/\\1/#{path}/' | |
| 54 | + url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/#{path}/' | |
| 55 | + url | |
| 56 | + end | |
| 57 | + end | |
| 58 | + CODE | |
| 43 | 59 | end |
| 44 | 60 | |
| 45 | − version 'Java' do | |
| 46 | − self.base_url = 'https://rethinkdb.com/api/java/' | |
| 61 | + private | |
| 47 | 62 | |
| 48 | − options[:fix_urls] = ->(url) do | |
| 49 | − url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/java/' | |
| 50 | − end | |
| 63 | + def process_response?(response) | |
| 64 | + return false unless super | |
| 65 | + response.body !~ /http-equiv="refresh"/i | |
| 51 | 66 | end |
| 52 | 67 | end |
| 53 | 68 | end |
Binary file not shown.
Binary file not shown.