History

Codeception 2.2 documentation

edno committed 9 years ago

Commit 72ab3431 parent cd8188b10 files · +131 −-2Browse files

Unified · Split

10 files
  1. assets/javascripts/views/pages/codeception.coffee +10 −0
  2. assets/stylesheets/application-dark.css.scss +1 −0
  3. assets/stylesheets/application.css.scss +1 −0
  4. assets/stylesheets/pages/_codeception.scss +29 −0
  5. lib/docs/filters/codeception/clean_html.rb +20 −0
  6. lib/docs/filters/codeception/entries.rb +47 −0
  7. lib/docs/scrapers/codeception.rb +24 −0
  8. public/icons/docs/codeception/16.png +0 −0
  9. public/icons/docs/codeception/16@2x.png +0 −0
  10. public/icons/docs/codeception/SOURCE +1 −0
assets/javascripts/views/pages/codeception.coffee+10−0
@@ -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+1−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
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+1−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 'pages/c',
4040 'pages/cakephp',
4141 'pages/clojure',
42+ 'pages/codeception',
4243 'pages/coffeescript',
4344 'pages/cordova',
4445 'pages/crystal',
assets/stylesheets/pages/_codeception.scss+29−0
@@ -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+}
lib/docs/filters/codeception/clean_html.rb+20−0
@@ -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
lib/docs/filters/codeception/entries.rb+47−0
@@ -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+24−0
@@ -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
public/icons/docs/codeception/16.png+0−0

Binary file not shown.

public/icons/docs/codeception/16@2x.png+0−0

Binary file not shown.

public/icons/docs/codeception/SOURCE+1−0
@@ -0,0 +1 @@
1+https://www.openhub.net/p/codeception