History

Add RethinkDB documentation

Thibaut committed 11 years ago

Commit 79e574e1 parent d86d78814 files · +97 −-2Browse files

Unified · Split

14 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/news.json +4 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/rethinkdb.coffee +4 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +2 −1
  8. assets/stylesheets/pages/_rethinkdb.scss +9 −0
  9. lib/docs/filters/rethinkdb/clean_html.rb +38 −0
  10. lib/docs/filters/rethinkdb/entries.rb +15 −0
  11. lib/docs/scrapers/rethinkdb.rb +22 −0
  12. public/icons/docs/rethinkdb/16.png +0 −0
  13. public/icons/docs/rethinkdb/16@2x.png +0 −0
  14. public/icons/docs/rethinkdb/SOURCE +1 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+4−1
@@ -1,5 +1,8 @@
11 [
2− [ "2014-11-30",
2+ [ "2014-12-20",
3+ "New <a href=\"/rethinkdb/\">RethinkDB</a> documentation"
4+ ], [
5+ "2014-11-30",
36 "New <a href=\"/phpunit/\">PHPUnit</a> and <a href=\"/nokogiri/\">Nokogiri</a> documentations"
47 ], [
58 "2014-11-16",
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -263,6 +263,11 @@ credits = [ · 262 unmodified lines
263263 '2010-2014 The Dojo Foundation',
264264 'MIT',
265265 'https://raw.githubusercontent.com/jrburke/requirejs/master/LICENSE'
266+ ], [
267+ 'RethinkDB',
268+ 'RethinkDB contributors',
269+ 'CC BY-SA',
270+ 'https://raw.githubusercontent.com/rethinkdb/docs/master/LICENSE'
266271 ], [
267272 'Ruby',
268273 '1993-2014 Yukihiro Matsumoto',
assets/javascripts/views/pages/rethinkdb.coffee+4−0
@@ -0,0 +1,4 @@
1+#= require views/pages/base
2+#= require views/pages/underscore
3+
4+app.views.RethinkdbPage = app.views.UnderscorePage
assets/stylesheets/application.css.scss+1−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 'pages/rdoc',
6060 'pages/redis',
6161 'pages/requirejs',
62+ 'pages/rethinkdb',
6263 'pages/rfc',
6364 'pages/sinon',
6465 'pages/sphinx',
assets/stylesheets/global/_icons.scss+2−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 width: 1rem;
55 height: 1rem;
66 background-image: image-url('icons.png');
7− background-size: 5rem 12rem;
7+ background-size: 5rem 13rem;
88 }
99
1010 @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
@@ -72,3 +72,4 @@ · 61 unmodified lines
7272 ._icon-mongoose:before { background-position: -2rem -11rem; }
7373 ._icon-phpunit:before { background-position: -3rem -11rem; }
7474 ._icon-nokogiri:before { background-position: -4rem -11rem; }
75+._icon-rethinkdb:before { background-position: 0 -12rem; }
assets/stylesheets/pages/_rethinkdb.scss+9−0
@@ -0,0 +1,9 @@
1+._rethinkdb {
2+ > h2 { @extend %block-heading; }
3+ code { @extend %label; }
4+
5+ .api_command_illustration {
6+ float: right;
7+ margin: 0 0 1em 1em;
8+ }
9+}
lib/docs/filters/rethinkdb/clean_html.rb+38−0
@@ -0,0 +1,38 @@
1+module Docs
2+ class Rethinkdb
3+ class CleanHtmlFilter < Filter
4+ def call
5+ if root_page?
6+ doc.inner_html = '<h1>ReQL command reference</h1>'
7+ return doc
8+ end
9+
10+ css('#api-header').each do |node|
11+ node.replace(node.at_css('h1'))
12+ end
13+
14+ css('.linksbox-container').remove
15+
16+ css('.highlight').each do |node|
17+ node.before(node.children).remove
18+ end
19+
20+ css('.command-body').each do |node|
21+ node.name = 'pre'
22+ node.inner_html = node.inner_html.gsub('</p>', "</p>\n")
23+ end
24+
25+ css('pre').each do |node|
26+ node.content = node.content
27+ end
28+
29+ css('h1').each do |node|
30+ next if node['class'].to_s.include?('title')
31+ node.name = 'h2'
32+ end
33+
34+ doc
35+ end
36+ end
37+ end
38+end
lib/docs/filters/rethinkdb/entries.rb+15−0
@@ -0,0 +1,15 @@
1+module Docs
2+ class Rethinkdb
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('.title').content.remove('ReQL command:')
6+ end
7+
8+ def get_type
9+ link = at_css('a[href^="https://github.com/rethinkdb/docs/blob/master/api/javascript/"]')
10+ dir = link['href'][/javascript\/([^\/]+)/, 1]
11+ dir.titleize.gsub('Rql', 'ReQL').gsub('And', 'and')
12+ end
13+ end
14+ end
15+end
lib/docs/scrapers/rethinkdb.rb+22−0
@@ -0,0 +1,22 @@
1+module Docs
2+ class Rethinkdb < UrlScraper
3+ self.name = 'RethinkDB'
4+ self.type = 'rethinkdb'
5+ self.version = '1.15.2'
6+ self.base_url = 'http://rethinkdb.com/api/javascript/'
7+
8+ html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html'
9+
10+ options[:trailing_slash] = false
11+ options[:container] = '.container .section'
12+
13+ options[:fix_urls] = ->(url) do
14+ url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python)}, 'rethinkdb.com/api/javascript/'
15+ end
16+
17+ options[:attribution] = <<-HTML
18+ &copy; RethinkDB contributors<br>
19+ Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
20+ HTML
21+ end
22+end
public/icons/docs/rethinkdb/16.png+0−0

Binary file not shown.

public/icons/docs/rethinkdb/16@2x.png+0−0

Binary file not shown.

public/icons/docs/rethinkdb/SOURCE+1−0
@@ -0,0 +1 @@
1+http://rethinkdb.com/