mirror of https://github.com/freeCodeCamp/devdocs
parent
7b358f6f28
commit
34934b27cb
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 63 KiB |
@ -0,0 +1,4 @@
|
||||
#= require views/pages/base
|
||||
#= require views/pages/requirejs
|
||||
|
||||
app.views.SocketioPage = app.views.RequirejsPage
|
@ -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
|
||||
© 2014 Automattic<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 739 B |
@ -0,0 +1 @@
|
||||
http://socket.io/
|
Loading…
Reference in new issue