Merge pull request #1419 from MasterEnoc/rethink

Update Rethinkdb to 2.4.1
pull/1433/head
Simon Legner 4 years ago committed by GitHub
commit 1af4a9773b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,10 +19,6 @@ module Docs
node.content = node.content node.content = node.content
end end
css('.highlight', 'section', 'div.highlighter-rouge', 'a > p', 'li > h1').each do |node|
node.before(node.children).remove
end
css('h2, h3, h4').each do |node| css('h2, h3, h4').each do |node|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 } node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
end end
@ -46,6 +42,8 @@ module Docs
css('> .infobox:last-child:contains("Contribute:")').remove css('> .infobox:last-child:contains("Contribute:")').remove
css('.additional-help').remove
doc doc
end end
end end

@ -1,9 +1,17 @@
module Docs module Docs
class Rethinkdb class Rethinkdb
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if subpath.start_with?('api') if subpath.start_with?('api')
at_css('.title').content.remove('ReQL command:').split(', ').first name = at_css('.title').content.remove('ReQL command:').split(', ').first
if name.strip.empty?
'lt'
else
name
end
else else
at_css('.docs-nav .active').content at_css('.docs-nav .active').content
end end
@ -30,6 +38,7 @@ module Docs
def include_default_entry? def include_default_entry?
at_css('.docs-article p').try(:content) != 'Choose your language:' at_css('.docs-article p').try(:content) != 'Choose your language:'
end end
end end
end end
end end

@ -3,7 +3,7 @@ module Docs
self.name = 'RethinkDB' self.name = 'RethinkDB'
self.type = 'rethinkdb' self.type = 'rethinkdb'
self.base_url = 'https://rethinkdb.com/' self.base_url = 'https://rethinkdb.com/'
self.release = '2.3.5' self.release = '2.4.1'
self.root_path = 'docs/' self.root_path = 'docs/'
self.links = { self.links = {
home: 'https://rethinkdb.com/', home: 'https://rethinkdb.com/',
@ -13,14 +13,18 @@ module Docs
html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html' html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html'
options[:trailing_slash] = true options[:trailing_slash] = true
options[:container] = '.documentation' options[:container] = '.documentation'
options[:only_patterns] = [/\Adocs/] options[:only_patterns] = [/\Adocs/]
options[:skip_patterns] = [/docs\/install(\-drivers)?\/./] options[:skip_patterns] = [/docs\/install(\-drivers)?\/./]
options[:skip] = %w( options[:skip] = %w(
docs/build/ docs/build/
docs/tutorials/elections/ docs/tutorials/elections/
docs/tutorials/superheroes/) docs/tutorials/superheroes/
)
MULTILANG_DOCS = %w( MULTILANG_DOCS = %w(
changefeeds changefeeds
@ -33,29 +37,64 @@ module Docs
rabbitmq rabbitmq
secondary-indexes secondary-indexes
sql-to-reql sql-to-reql
storing-binary) storing-binary
)
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; RethinkDB contributors<br> &copy; RethinkDB contributors<br>
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
HTML HTML
%w(JavaScript Ruby Python Java).each do |name| version 'javascript' do
path = name.downcase self.initial_paths = %w(api/javascript/)
instance_eval <<-CODE
version '#{name}' do options[:only_patterns] += [/\Aapi\/javascript\//]
self.initial_paths = %w(api/#{path}/)
options[:fix_urls] = ->(url) do
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/javascript/'
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!javascript/).*}, 'rethinkdb.com/docs/\\1/javascript/'
url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/javascript/'
url
end
end
version 'ruby' do
self.initial_paths = %w(api/ruby/)
options[:only_patterns] += [/\Aapi\/ruby\//]
options[:fix_urls] = ->(url) do
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/ruby/'
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!ruby/).*}, 'rethinkdb.com/docs/\\1/ruby/'
url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/ruby/'
url
end
end
version 'python' do
self.initial_paths = %w(api/python/)
options[:only_patterns] += [/\\Aapi\\/#{path}\\//] options[:only_patterns] += [/\Aapi\/python\//]
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/#{path}/' url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/python/'
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!#{path}/).*}, 'rethinkdb.com/docs/\\1/#{path}/' url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!python/).*}, 'rethinkdb.com/docs/\\1/python/'
url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/#{path}/' url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/python/'
url url
end end
end end
CODE
version 'java' do
self.initial_paths = %w(api/java/)
options[:only_patterns] += [/\Aapi\/java\//]
options[:fix_urls] = ->(url) do
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/java/'
url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!java/).*}, 'rethinkdb.com/docs/\\1/java/'
url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/java/'
url
end
end end
def get_latest_version(opts) def get_latest_version(opts)
@ -68,5 +107,6 @@ module Docs
return false unless super return false unless super
response.body !~ /http-equiv="refresh"/i response.body !~ /http-equiv="refresh"/i
end end
end end
end end

Loading…
Cancel
Save