Merge pull request #1459 from MasterEnoc/socketio

Add Socketio version 2 and 3
pull/1462/head
Simon Legner 4 years ago committed by GitHub
commit 2e6d7953c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -6,7 +6,11 @@ module Docs
end end
def get_type def get_type
'Guides' if slug =~ /events|room|emit/ && version.eql?('3')
'Events'
else
'Guides'
end
end end
def additional_entries def additional_entries

@ -3,8 +3,6 @@ module Docs
self.name = 'Socket.IO' self.name = 'Socket.IO'
self.slug = 'socketio' self.slug = 'socketio'
self.type = 'socketio' self.type = 'socketio'
self.release = '1.4.5'
self.base_url = 'http://socket.io/docs/'
self.links = { self.links = {
home: 'http://socket.io/', home: 'http://socket.io/',
code: 'https://github.com/socketio/socket.io' code: 'https://github.com/socketio/socket.io'
@ -12,17 +10,27 @@ module Docs
html_filters.push 'socketio/clean_html', 'socketio/entries' html_filters.push 'socketio/clean_html', 'socketio/entries'
options[:container] = '#content'
options[:trailing_slash] = false options[:trailing_slash] = false
options[:skip] = %w(faq) options[:skip] = %w(/faq /glossary)
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2014&ndash;2015 Automattic<br> &copy; 2014&ndash;2020 Automattic<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
version '3' do
self.release = '3.0.5'
self.base_url = "https://socket.io/docs/v#{version}"
end
version '2' do
self.release = '2.4.0'
self.base_url = "https://socket.io/docs/v#{version}"
end
def get_latest_version(opts) def get_latest_version(opts)
get_npm_version('socket.io', opts) get_npm_version('socket.io', opts)
end end
end end
end end

Loading…
Cancel
Save