Finish CodeceptJS scraper

pull/547/head
Thibaut Courouble 8 years ago
parent 1fda4fcb0c
commit 193db39f9b

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 139 KiB

@ -1,7 +1,7 @@
[
[
"2016-12-04",
"New documentations: <a href=\"/sqlite/\">SQLite</a> and <a href=\"/codeception/\">Codeception</a>"
"New documentations: <a href=\"/sqlite/\">SQLite</a>, <a href=\"/codeception/\">Codeception</a> and <a href=\"/codeceptjs/\">CodeceptJS</a>"
], [
"2016-11-20",
"New documentations: <a href=\"/yarn/\">Yarn</a>, <a href=\"/immutable/\">Immutable.js</a> and <a href=\"/async/\">Async</a>"

@ -159,6 +159,11 @@ credits = [
'2011-2016 Michael Bodnarchuk and contributors',
'MIT',
'https://raw.githubusercontent.com/Codeception/Codeception/master/LICENSE'
], [
'CodeceptJS',
'2015 DavertMik',
'MIT',
'https://raw.githubusercontent.com/Codeception/CodeceptJS/master/LICENSE'
], [
'CodeIgniter',
'2014-2016 British Columbia Institute of Technology',

@ -1,9 +0,0 @@
#= require views/pages/base
class app.views.CodeceptjsPage extends app.views.BasePage
prepare: ->
for el in @findAll('pre > code')
if /js/i.test(el.className)
@highlightCode(el, 'javascript')
return

@ -15,6 +15,7 @@ app.views.CPage =
app.views.CakephpPage =
app.views.ChaiPage =
app.views.CodeceptionPage =
app.views.CodeceptjsPage =
app.views.CoffeescriptPage =
app.views.CordovaPage =
app.views.CrystalPage =

@ -40,7 +40,6 @@
'pages/cakephp',
'pages/clojure',
'pages/codeception',
'pages/codeceptjs',
'pages/coffeescript',
'pages/cordova',
'pages/crystal',

@ -40,7 +40,6 @@
'pages/cakephp',
'pages/clojure',
'pages/codeception',
'pages/codeceptjs',
'pages/coffeescript',
'pages/cordova',
'pages/crystal',

@ -56,6 +56,7 @@
%icon-close-white { background-position: -2rem -5rem; }
%icon-back { background-position: -3rem -5rem; @extend %darkIconFix !optional; }
._icon-codeceptjs:before { background-position: -3rem 0; }
._icon-codeception:before { background-position: -4rem 0; }
._icon-sqlite:before { background-position: -5rem 0; @extend %darkIconFix !optional; }
._icon-async:before { background-position: -6rem 0; @extend %darkIconFix !optional; }

@ -1,3 +0,0 @@
._codeceptjs {
@extend %simple;
}

@ -20,6 +20,7 @@
._apache_pig,
._bower,
._chai,
._codeceptjs,
._docker,
._fish,
._gnu,

@ -2,16 +2,29 @@ module Docs
class Codeceptjs
class CleanHtmlFilter < Filter
def call
root_page? ? root : other
doc
end
if root_page?
doc.inner_html = ' '
return doc
end
def root
doc.inner_html = ' '
end
@doc = doc.at_css('div.reference div[role=main]')
css('hr').remove
unless at_css('h1')
at_css('h2').name = 'h1'
end
unless at_css('h2')
css('h3').each { |node| node.name = 'h2' }
css('h4').each { |node| node.name = 'h3' }
end
css('pre > code').each do |node|
node.parent['data-language'] = node['class'] if node['class']
node.parent.content = node.parent.content
end
def other
@doc = doc.at_css('div.reference').xpath('//div[@role="main"]')
doc
end
end

@ -2,26 +2,29 @@ module Docs
class Codeceptjs
class EntriesFilter < Docs::EntriesFilter
def get_name
(at_css('h1') || at_css('h2')).content
at_css('h1').content
end
def get_type
return "Reference" if %w(commands configuration reports translation).include? subpath.scan(/\w+/).first
return "Guides" unless slug.camelize =~ /Helpers::.+/
"Helpers::" + (at_css('h1') || at_css('h2')).content
if subpath == 'helpers/'
'Helpers'
elsif subpath.start_with?('helpers')
"Helpers: #{name}"
elsif subpath.in? %w(commands/ configuration/ reports/ translation/)
'Reference'
else
'Guide'
end
end
def additional_entries
return [] unless type =~ /Helpers::.*/
return [] unless subpath.start_with?('helpers') && subpath != 'helpers/'
helper = type.sub(/Helpers::/, '')+ '::'
css('h2').map do |node|
css('h2').each_with_object [] do |node, entries|
next if node['id'] == 'access-from-helpers'
[helper + node.content, node['id']]
end.compact
entries << ["#{node.content} (#{name})", node['id']]
end
end
end
end
end

@ -3,7 +3,7 @@ module Docs
self.name = 'CodeceptJS'
self.type = 'codeceptjs'
self.root_path = 'index.html'
self.release = '0.4'
self.release = '0.4.9'
self.base_url = 'http://codecept.io/'
self.links = {
home: 'http://codecept.io/',
@ -14,11 +14,11 @@ module Docs
options[:root_title] = 'CodeceptJS'
options[:title] = false
options[:skip_links] = ->(filter) { !filter.initial_page? }
options[:skip_patterns] = [/changelog/, /quickstart$/]
options[:skip_links] = ->(filter) { !filter.root_page? }
options[:skip_patterns] = [/changelog/, /quickstart\z/]
options[:attribution] = <<-HTML
&copy; 20152016 Michael Bodnarchuk and Contributors<br>
&copy; 2015 DavertMik &lt;davert@codegyre.com&gt; (http://codegyre.com)<br>
Licensed under the MIT License.
HTML
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Loading…
Cancel
Save