History

Add Clojure documentation

Thibaut committed 11 years ago

Commit 2387fcf1 parent 81c9bfa14 files · +100 −-3Browse 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 +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/stylesheets/application-dark.css.scss +1 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_clojure.scss +10 −0
  9. lib/docs/filters/clojure/clean_html.rb +44 −0
  10. lib/docs/filters/clojure/entries.rb +22 −0
  11. lib/docs/scrapers/clojure.rb +18 −0
  12. public/icons/docs/clojure/16.png +0 −0
  13. public/icons/docs/clojure/16@2x.png +0 −0
  14. public/icons/docs/clojure/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+1−1
@@ -1,6 +1,6 @@
1[1[
2 [ "2015-02-15",2 [ "2015-02-15",
3 "New <a href=\"/iojs/\">io.js</a>, <a href=\"/lua/\">Lua</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"3 "New <a href=\"/iojs/\">io.js</a>, <a href=\"/clojure/\">Clojure</a>, <a href=\"/lua/\">Lua</a> and <a href=\"/yii1/\">Yii 1.1</a> documentations"
4 ], [4 ], [
5 "2015-02-08",5 "2015-02-08",
6 "New dark theme\nClick the icon in the bottom left corner to activate.\n<a href=\"https://github.com/Thibaut/devdocs/issues\" target=\"_blank\">Feedback</a> welcome :)"6 "New dark theme\nClick the icon in the bottom left corner to activate.\n<a href=\"https://github.com/Thibaut/devdocs/issues\" target=\"_blank\">Feedback</a> welcome :)"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -100,6 +100,11 @@ credits = [ · 99 unmodified lines
100 '2011-2015 Jake Luer',100 '2011-2015 Jake Luer',
101 'MIT',101 'MIT',
102 'https://github.com/chaijs/chai/blob/master/README.md#license'102 'https://github.com/chaijs/chai/blob/master/README.md#license'
103 ], [
104 'Clojure',
105 'Rich Hickey',
106 'EPL',
107 'https://github.com/clojure/clojure/blob/master/epl-v10.html'
103 ], [108 ], [
104 'CoffeeScript',109 'CoffeeScript',
105 '2009-2015 Jeremy Ashkenas',110 '2009-2015 Jeremy Ashkenas',
assets/stylesheets/application-dark.css.scss+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
32 'pages/bower',32 'pages/bower',
33 'pages/c',33 'pages/c',
34 'pages/chai',34 'pages/chai',
35 'pages/clojure',
35 'pages/coffeescript',36 'pages/coffeescript',
36 'pages/cordova',37 'pages/cordova',
37 'pages/d3',38 'pages/d3',
assets/stylesheets/application.css.scss+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
32 'pages/bower',32 'pages/bower',
33 'pages/c',33 'pages/c',
34 'pages/chai',34 'pages/chai',
35 'pages/clojure',
35 'pages/coffeescript',36 'pages/coffeescript',
36 'pages/cordova',37 'pages/cordova',
37 'pages/d3',38 'pages/d3',
assets/stylesheets/global/_icons.scss+1−0
@@ -87,3 +87,4 @@ · 86 unmodified lines
87%icon-light-white { background-position: -1rem -14rem; }87%icon-light-white { background-position: -1rem -14rem; }
88._icon-iojs:before { background-position: -2rem -14rem; }88._icon-iojs:before { background-position: -2rem -14rem; }
89._icon-lua:before { background-position: -3rem -14rem; }89._icon-lua:before { background-position: -3rem -14rem; }
90._icon-clojure:before { background-position: -4rem -14rem; }
assets/stylesheets/pages/_clojure.scss+10−0
@@ -0,0 +1,10 @@
1._clojure {
2 h2:not([id]) { @extend %block-heading; }
3 h2[id], h3 { @extend %block-label, %label-blue; }
4
5 .type {
6 float: right;
7 font-size: .9em;
8 color: $textColorLight;
9 }
10}
lib/docs/filters/clojure/clean_html.rb+44−0
@@ -0,0 +1,44 @@
1module Docs
2 class Clojure
3 class CleanHtmlFilter < Filter
4 def call
5 if root_page?
6 doc.inner_html = '<h1>Clojure</h1>'
7 return doc
8 end
9
10 @doc = at_css('#content-tag')
11
12 at_css('h1').content = slug.remove('-api')
13
14 css('> div').each do |node|
15 node.before(node.children).remove
16 end
17
18 css('div > h2', 'div > h3').each do |node|
19 node.parent.before(node.parent.children).remove
20 end
21
22 css('#proto-type', '#var-type', '#type-type').each do |node|
23 node.previous_element << node
24 node['class'] = 'type'
25 end
26
27 css('.proto-added', '.var-added', '.proto-deprecated', '.var-deprecated').each do |node|
28 node.content = node.content
29 node.name = 'p'
30 end
31
32 css('.proto-added', '.var-added').each do |node|
33 if node.content == node.next_element.try(:content)
34 node.remove
35 end
36 end
37
38 css('hr', 'br:first-child', 'pre + br', 'h1 + br', 'h2 + br', 'h3 + br', 'p + br', 'br + br').remove
39
40 doc
41 end
42 end
43 end
44end
lib/docs/filters/clojure/entries.rb+22−0
@@ -0,0 +1,22 @@
1module Docs
2 class Clojure
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 slug.remove('-api')
6 end
7
8 def get_type
9 'Namespaces'
10 end
11
12 def additional_entries
13 css(".toc-entry-anchor[href^='##{self.name}']").map do |node|
14 name = node.content
15 id = node['href'].remove('#')
16 type = name == 'clojure.core' ? id.split('/').first : self.name
17 [name, id, type]
18 end
19 end
20 end
21 end
22end
lib/docs/scrapers/clojure.rb+18−0
@@ -0,0 +1,18 @@
1module Docs
2 class Clojure < UrlScraper
3 self.type = 'clojure'
4 self.version = '1.6'
5 self.base_url = 'http://clojure.github.io/clojure/'
6 self.root_path = 'api-index.html'
7
8 html_filters.push 'clojure/entries', 'clojure/clean_html'
9
10 options[:container] = '#content_view'
11 options[:only_patterns] = [/\Aclojure\./]
12
13 options[:attribution] = <<-HTML
14 &copy; Rich Hickey<br>
15 Licensed under the Eclipse Public License 1.0.
16 HTML
17 end
18end
public/icons/docs/clojure/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/clojure/SOURCE+1−0
@@ -0,0 +1 @@
1http://en.wikipedia.org/wiki/File:Clojure_logo.gif