History

Add Socket.IO documentation

Thibaut committed 11 years ago

Commit 34934b21 parent 7b358f614 files · +105 −-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/javascripts/views/pages/socketio.coffee +4 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_socketio.scss +24 −0
  9. lib/docs/filters/socketio/clean_html.rb +25 −0
  10. lib/docs/filters/socketio/entries.rb +27 −0
  11. lib/docs/scrapers/socketio.rb +20 −0
  12. public/icons/docs/socketio/16.png +0 −0
  13. public/icons/docs/socketio/16@2x.png +0 −0
  14. public/icons/docs/socketio/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 [ "2014-12-21",2 [ "2014-12-21",
3 "New <a href=\"/react/\">React</a> and <a href=\"/rethinkdb/\">RethinkDB</a> documentations"3 "New <a href=\"/react/\">React</a>, <a href=\"/rethinkdb/\">RethinkDB</a> and <a href=\"/socketio/\">Socket.IO</a> documentations"
4 ], [4 ], [
5 "2014-11-30",5 "2014-11-30",
6 "New <a href=\"/phpunit/\">PHPUnit</a> and <a href=\"/nokogiri/\">Nokogiri</a> documentations"6 "New <a href=\"/phpunit/\">PHPUnit</a> and <a href=\"/nokogiri/\">Nokogiri</a> documentations"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -293,6 +293,11 @@ credits = [ · 292 unmodified lines
293 '2010-2014 Christian Johansen',293 '2010-2014 Christian Johansen',
294 'BSD',294 'BSD',
295 'https://raw.githubusercontent.com/cjohansen/Sinon.JS/master/LICENSE'295 'https://raw.githubusercontent.com/cjohansen/Sinon.JS/master/LICENSE'
296 ], [
297 'Socket.io',
298 '2014 Automattic',
299 'MIT',
300 'https://raw.githubusercontent.com/Automattic/socket.io/master/LICENSE'
296 ], [301 ], [
297 'Underscore.js',302 'Underscore.js',
298 '2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',303 '2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
assets/javascripts/views/pages/socketio.coffee+4−0
@@ -0,0 +1,4 @@
1#= require views/pages/base
2#= require views/pages/requirejs
3
4app.views.SocketioPage = app.views.RequirejsPage
assets/stylesheets/application.css.scss+1−0
@@ -63,6 +63,7 @@ · 62 unmodified lines
63 'pages/rethinkdb',63 'pages/rethinkdb',
64 'pages/rfc',64 'pages/rfc',
65 'pages/sinon',65 'pages/sinon',
66 'pages/socketio',
66 'pages/sphinx',67 'pages/sphinx',
67 'pages/underscore',68 'pages/underscore',
68 'pages/yard',69 'pages/yard',
assets/stylesheets/global/_icons.scss+1−0
@@ -74,3 +74,4 @@ · 73 unmodified lines
74._icon-nokogiri:before { background-position: -4rem -11rem; }74._icon-nokogiri:before { background-position: -4rem -11rem; }
75._icon-rethinkdb:before { background-position: 0 -12rem; }75._icon-rethinkdb:before { background-position: 0 -12rem; }
76._icon-react:before { background-position: -1rem -12rem; }76._icon-react:before { background-position: -1rem -12rem; }
77._icon-socketio:before { background-position: -2rem -12rem; }
assets/stylesheets/pages/_socketio.scss+24−0
@@ -0,0 +1,24 @@
1._socketio {
2 > h2 { @extend %block-heading; }
3 > h3 { @extend %block-label, %label-blue; }
4 > h2, > h3 { clear: both; }
5 h4 { font-size: 1em; }
6
7 .ezcol-one-half {
8 margin: .5em 0 1.5em;
9 float: left;
10 width: 50%;
11 padding-right: .5em;
12 @extend %border-box;
13
14 &.ezcol-last {
15 float: right;
16 padding: 0 0 0 .5em;
17 }
18
19 > h4 { margin: 0 0 1em; }
20 > pre { margin: 1em 0 0; }
21 }
22
23 code { @extend %label; }
24}
lib/docs/filters/socketio/clean_html.rb+25−0
@@ -0,0 +1,25 @@
1module Docs
2 class Socketio
3 class CleanHtmlFilter < Filter
4 def call
5 @doc = at_css('.entry-content')
6
7 css('p > br').each do |node|
8 node.remove unless node.next.content =~ /\s*\-/
9 end
10
11 css('h1, h2, h3').each do |node|
12 next if node == doc.first_element_child
13 node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
14 node['id'] = node.content.strip.parameterize
15 end
16
17 css('pre').each do |node|
18 node.content = node.content
19 end
20
21 doc
22 end
23 end
24 end
25end
lib/docs/filters/socketio/entries.rb+27−0
@@ -0,0 +1,27 @@
1module Docs
2 class Socketio
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 at_css('h1').content
6 end
7
8 def get_type
9 'Guides'
10 end
11
12 def additional_entries
13 return [] unless slug.end_with?('api')
14
15 css('h3').each_with_object([]) do |node, entries|
16 name = node.content
17 name.remove! %r{\(.*}
18 name.remove! %r{\:.*}
19
20 unless entries.any? { |entry| entry[0] == name }
21 entries << [name, node['id'], self.name.remove(' API')]
22 end
23 end
24 end
25 end
26 end
27end
lib/docs/scrapers/socketio.rb+20−0
@@ -0,0 +1,20 @@
1module Docs
2 class Socketio < UrlScraper
3 self.name = 'Socket.IO'
4 self.slug = 'socketio'
5 self.type = 'socketio'
6 self.version = '1.2.1'
7 self.base_url = 'http://socket.io/docs/'
8
9 html_filters.push 'socketio/clean_html', 'socketio/entries'
10
11 options[:container] = '#content'
12 options[:trailing_slash] = false
13 options[:skip] = %w(faq)
14
15 options[:attribution] = <<-HTML
16 &copy; 2014 Automattic<br>
17 Licensed under the MIT License.
18 HTML
19 end
20end
public/icons/docs/socketio/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/socketio/SOURCE+1−0
@@ -0,0 +1 @@
1http://socket.io/