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 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
# version documentation message
css('.warning').remove
css('header').remove
css('aside').remove
css('footer').remove
css('pre').each do |node|
node.content = node.content

@ -6,8 +6,12 @@ module Docs
end
def get_type
if slug =~ /events|room|emit/ && version.eql?('3')
'Events'
else
'Guides'
end
end
def additional_entries
return [] unless slug.end_with?('api')

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

Loading…
Cancel
Save