diff --git a/assets/images/icons.png b/assets/images/icons.png index f56a35ed..b4eda14a 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 1cf651d9..a505912d 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 1da6f359..23f3095d 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ - [ "2014-11-30", + [ "2014-12-20", + "New RethinkDB documentation" + ], [ + "2014-11-30", "New PHPUnit and Nokogiri documentations" ], [ "2014-11-16", diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 3b139ec0..5ab6e593 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -263,6 +263,11 @@ credits = [ '2010-2014 The Dojo Foundation', 'MIT', 'https://raw.githubusercontent.com/jrburke/requirejs/master/LICENSE' + ], [ + 'RethinkDB', + 'RethinkDB contributors', + 'CC BY-SA', + 'https://raw.githubusercontent.com/rethinkdb/docs/master/LICENSE' ], [ 'Ruby', '1993-2014 Yukihiro Matsumoto', diff --git a/assets/javascripts/views/pages/rethinkdb.coffee b/assets/javascripts/views/pages/rethinkdb.coffee new file mode 100644 index 00000000..6a00dda4 --- /dev/null +++ b/assets/javascripts/views/pages/rethinkdb.coffee @@ -0,0 +1,4 @@ +#= require views/pages/base +#= require views/pages/underscore + +app.views.RethinkdbPage = app.views.UnderscorePage diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index d3fa1833..b6c27952 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -59,6 +59,7 @@ 'pages/rdoc', 'pages/redis', 'pages/requirejs', + 'pages/rethinkdb', 'pages/rfc', 'pages/sinon', 'pages/sphinx', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 38fb1def..e4c71c31 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -4,7 +4,7 @@ width: 1rem; height: 1rem; background-image: image-url('icons.png'); - background-size: 5rem 12rem; + background-size: 5rem 13rem; } @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { @@ -72,3 +72,4 @@ ._icon-mongoose:before { background-position: -2rem -11rem; } ._icon-phpunit:before { background-position: -3rem -11rem; } ._icon-nokogiri:before { background-position: -4rem -11rem; } +._icon-rethinkdb:before { background-position: 0 -12rem; } diff --git a/assets/stylesheets/pages/_rethinkdb.scss b/assets/stylesheets/pages/_rethinkdb.scss new file mode 100644 index 00000000..841a984c --- /dev/null +++ b/assets/stylesheets/pages/_rethinkdb.scss @@ -0,0 +1,9 @@ +._rethinkdb { + > h2 { @extend %block-heading; } + code { @extend %label; } + + .api_command_illustration { + float: right; + margin: 0 0 1em 1em; + } +} diff --git a/lib/docs/filters/rethinkdb/clean_html.rb b/lib/docs/filters/rethinkdb/clean_html.rb new file mode 100644 index 00000000..ecaa2762 --- /dev/null +++ b/lib/docs/filters/rethinkdb/clean_html.rb @@ -0,0 +1,38 @@ +module Docs + class Rethinkdb + class CleanHtmlFilter < Filter + def call + if root_page? + doc.inner_html = '

ReQL command reference

' + return doc + end + + css('#api-header').each do |node| + node.replace(node.at_css('h1')) + end + + css('.linksbox-container').remove + + css('.highlight').each do |node| + node.before(node.children).remove + end + + css('.command-body').each do |node| + node.name = 'pre' + node.inner_html = node.inner_html.gsub('

', "

\n") + end + + css('pre').each do |node| + node.content = node.content + end + + css('h1').each do |node| + next if node['class'].to_s.include?('title') + node.name = 'h2' + end + + doc + end + end + end +end diff --git a/lib/docs/filters/rethinkdb/entries.rb b/lib/docs/filters/rethinkdb/entries.rb new file mode 100644 index 00000000..949cb891 --- /dev/null +++ b/lib/docs/filters/rethinkdb/entries.rb @@ -0,0 +1,15 @@ +module Docs + class Rethinkdb + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('.title').content.remove('ReQL command:') + end + + def get_type + link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/javascript/"]') + dir = link['href'][/javascript\/([^\/]+)/, 1] + dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and') + end + end + end +end diff --git a/lib/docs/scrapers/rethinkdb.rb b/lib/docs/scrapers/rethinkdb.rb new file mode 100644 index 00000000..36213bb4 --- /dev/null +++ b/lib/docs/scrapers/rethinkdb.rb @@ -0,0 +1,22 @@ +module Docs + class Rethinkdb < UrlScraper + self.name = 'RethinkDB' + self.type = 'rethinkdb' + self.version = '1.15.2' + self.base_url = 'http://rethinkdb.com/api/javascript/' + + html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html' + + options[:trailing_slash] = false + options[:container] = '.container .section' + + options[:fix_urls] = ->(url) do + url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python)}, 'rethinkdb.com/api/javascript/' + end + + options[:attribution] = <<-HTML + © RethinkDB contributors
+ Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. + HTML + end +end diff --git a/public/icons/docs/rethinkdb/16.png b/public/icons/docs/rethinkdb/16.png new file mode 100644 index 00000000..836e5bc5 Binary files /dev/null and b/public/icons/docs/rethinkdb/16.png differ diff --git a/public/icons/docs/rethinkdb/16@2x.png b/public/icons/docs/rethinkdb/16@2x.png new file mode 100644 index 00000000..31c72916 Binary files /dev/null and b/public/icons/docs/rethinkdb/16@2x.png differ diff --git a/public/icons/docs/rethinkdb/SOURCE b/public/icons/docs/rethinkdb/SOURCE new file mode 100644 index 00000000..43c50edf --- /dev/null +++ b/public/icons/docs/rethinkdb/SOURCE @@ -0,0 +1 @@ +http://rethinkdb.com/