Add Socket.IO documentation

pull/165/head
Thibaut 10 years ago
parent 7b358f6f28
commit 34934b27cb

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 63 KiB

@ -1,6 +1,6 @@
[
[ "2014-12-21",
"New <a href=\"/react/\">React</a> and <a href=\"/rethinkdb/\">RethinkDB</a> documentations"
"New <a href=\"/react/\">React</a>, <a href=\"/rethinkdb/\">RethinkDB</a> and <a href=\"/socketio/\">Socket.IO</a> documentations"
], [
"2014-11-30",
"New <a href=\"/phpunit/\">PHPUnit</a> and <a href=\"/nokogiri/\">Nokogiri</a> documentations"

@ -293,6 +293,11 @@ credits = [
'2010-2014 Christian Johansen',
'BSD',
'https://raw.githubusercontent.com/cjohansen/Sinon.JS/master/LICENSE'
], [
'Socket.io',
'2014 Automattic',
'MIT',
'https://raw.githubusercontent.com/Automattic/socket.io/master/LICENSE'
], [
'Underscore.js',
'2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',

@ -0,0 +1,4 @@
#= require views/pages/base
#= require views/pages/requirejs
app.views.SocketioPage = app.views.RequirejsPage

@ -63,6 +63,7 @@
'pages/rethinkdb',
'pages/rfc',
'pages/sinon',
'pages/socketio',
'pages/sphinx',
'pages/underscore',
'pages/yard',

@ -74,3 +74,4 @@
._icon-nokogiri:before { background-position: -4rem -11rem; }
._icon-rethinkdb:before { background-position: 0 -12rem; }
._icon-react:before { background-position: -1rem -12rem; }
._icon-socketio:before { background-position: -2rem -12rem; }

@ -0,0 +1,24 @@
._socketio {
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
> h2, > h3 { clear: both; }
h4 { font-size: 1em; }
.ezcol-one-half {
margin: .5em 0 1.5em;
float: left;
width: 50%;
padding-right: .5em;
@extend %border-box;
&.ezcol-last {
float: right;
padding: 0 0 0 .5em;
}
> h4 { margin: 0 0 1em; }
> pre { margin: 1em 0 0; }
}
code { @extend %label; }
}

@ -0,0 +1,25 @@
module Docs
class Socketio
class CleanHtmlFilter < Filter
def call
@doc = at_css('.entry-content')
css('p > br').each do |node|
node.remove unless node.next.content =~ /\s*\-/
end
css('h1, h2, h3').each do |node|
next if node == doc.first_element_child
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
node['id'] = node.content.strip.parameterize
end
css('pre').each do |node|
node.content = node.content
end
doc
end
end
end
end

@ -0,0 +1,27 @@
module Docs
class Socketio
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content
end
def get_type
'Guides'
end
def additional_entries
return [] unless slug.end_with?('api')
css('h3').each_with_object([]) do |node, entries|
name = node.content
name.remove! %r{\(.*}
name.remove! %r{\:.*}
unless entries.any? { |entry| entry[0] == name }
entries << [name, node['id'], self.name.remove(' API')]
end
end
end
end
end
end

@ -0,0 +1,20 @@
module Docs
class Socketio < UrlScraper
self.name = 'Socket.IO'
self.slug = 'socketio'
self.type = 'socketio'
self.version = '1.2.1'
self.base_url = 'http://socket.io/docs/'
html_filters.push 'socketio/clean_html', 'socketio/entries'
options[:container] = '#content'
options[:trailing_slash] = false
options[:skip] = %w(faq)
options[:attribution] = <<-HTML
&copy; 2014 Automattic<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Loading…
Cancel
Save