Skip to content

Commit 72ab343

Browse files
ednoThibaut
authored andcommitted
Codeception 2.2 documentation
1 parent cd8188b commit 72ab343

10 files changed

Lines changed: 133 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#= require views/pages/base
2+
3+
class app.views.CodeceptionPage extends app.views.BasePage
4+
LANGUAGE_RGX = /language-(\w+)/
5+
6+
prepare: ->
7+
for el in @findAll('pre > code')
8+
if el.className.match(LANGUAGE_RGX)
9+
@highlightCode(el, el.className.match(LANGUAGE_RGX)[1])
10+
return

assets/stylesheets/application-dark.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'pages/c',
4040
'pages/cakephp',
4141
'pages/clojure',
42+
'pages/codeception',
4243
'pages/coffeescript',
4344
'pages/cordova',
4445
'pages/crystal',

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'pages/c',
4040
'pages/cakephp',
4141
'pages/clojure',
42+
'pages/codeception',
4243
'pages/coffeescript',
4344
'pages/cordova',
4445
'pages/crystal',
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
._codeception {
2+
@extend %simple;
3+
4+
.warning, .alert {
5+
@extend %note;
6+
}
7+
8+
h4 {
9+
@extend %block-label;
10+
}
11+
12+
.alert-danger { @extend %note-red; }
13+
14+
.language-yaml {
15+
@extend .token;
16+
17+
.c1 {
18+
@extend .token.comment;
19+
}
20+
21+
.pi {
22+
@extend .token.operator;
23+
}
24+
25+
.s {
26+
@extend .token.string;
27+
}
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module Docs
2+
class Codeception
3+
class CleanHtmlFilter < Filter
4+
def call
5+
root_page? ? root : other
6+
doc
7+
end
8+
9+
def root
10+
doc.inner_html = ' '
11+
end
12+
13+
def other
14+
@doc = doc.at_css('div.page, div.content')
15+
css('.btn-group').remove
16+
doc
17+
end
18+
end
19+
end
20+
end
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module Docs
2+
class Codeception
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
(subpath.scan(/\d\d/).first || '') + ' ' + (at_css('h1') || at_css('h2')).content
6+
end
7+
8+
def get_type
9+
return 'Module::' + (at_css('h1') || at_css('h2')).content if subpath.start_with?('modules')
10+
return 'Guides' if subpath =~ /\d\d/
11+
(at_css('h1') || at_css('h2')).content
12+
end
13+
14+
def include_default_entry?
15+
return true if %w(Guides).include? type
16+
return true if type =~ /(Module)|(Util)/
17+
false
18+
end
19+
20+
def additional_entries
21+
22+
if type =~ /Module/
23+
prefix = type.sub(/Module::/, '')+ '::'
24+
pattern = '#actions ~ h4'
25+
elsif type =~ /Functions/
26+
prefix = ''
27+
pattern = 'h4'
28+
elsif type =~ /Util/
29+
prefix = type.sub(/Codeception\/Util/, '')+ '::'
30+
pattern = 'h3'
31+
elsif type =~ /(Commands)|(Configuration)/
32+
prefix = ''
33+
pattern = 'h2'
34+
else
35+
prefix = ''
36+
pattern = 'none'
37+
end
38+
39+
css(pattern).map do |node|
40+
[prefix + node.content, node['id']]
41+
end.compact
42+
43+
end
44+
45+
end
46+
end
47+
end

lib/docs/scrapers/codeception.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module Docs
2+
class Codeception < UrlScraper
3+
self.name = 'Codeception'
4+
self.type = 'codeception'
5+
self.root_path = 'index.html'
6+
self.release = '2.2'
7+
self.base_url = 'http://codeception.com/docs/'
8+
self.links = {
9+
home: 'http://codeception.com/',
10+
code: 'https://github.com/codeception/codeception'
11+
}
12+
13+
html_filters.push 'codeception/clean_html', 'codeception/entries', 'title'
14+
15+
options[:root_title] = 'Codeception'
16+
options[:title] = false
17+
options[:skip_patterns] = [/install/]
18+
19+
options[:attribution] = <<-HTML
20+
&copy; 2011–2016 Michael Bodnarchuk and Contributors<br>
21+
Licensed under the MIT License.
22+
HTML
23+
end
24+
end
521 Bytes
Loading
1.32 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.openhub.net/p/codeception

0 commit comments

Comments
 (0)