diff --git a/assets/images/docs.png b/assets/images/docs.png index 826d4faa..78c65c68 100644 Binary files a/assets/images/docs.png and b/assets/images/docs.png differ diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png index ca6b4931..c740162c 100644 Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 92933f02..37c6c8fb 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2016-12-04", - "New documentation: SQLite" + "New documentations: SQLite and Codeception" ], [ "2016-11-20", "New documentations: Yarn, Immutable.js and Async" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 2cab5f0c..1e8ef751 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -154,6 +154,11 @@ credits = [ '2000-2016 Kitware, Inc.
© 2000-2011 Insight Software Consortium', 'BSD', 'https://cmake.org/licensing/' + ], [ + 'Codeception', + '2011-2016 Michael Bodnarchuk and contributors', + 'MIT', + 'https://raw.githubusercontent.com/Codeception/Codeception/master/LICENSE' ], [ 'CodeIgniter', '2014-2016 British Columbia Institute of Technology', diff --git a/assets/javascripts/views/pages/codeception.coffee b/assets/javascripts/views/pages/codeception.coffee deleted file mode 100644 index bcc6e4c7..00000000 --- a/assets/javascripts/views/pages/codeception.coffee +++ /dev/null @@ -1,10 +0,0 @@ -#= require views/pages/base - -class app.views.CodeceptionPage extends app.views.BasePage - LANGUAGE_RGX = /language-(\w+)/ - - prepare: -> - for el in @findAll('pre > code') - if el.className.match(LANGUAGE_RGX) - @highlightCode(el, el.className.match(LANGUAGE_RGX)[1]) - return diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee index 3a860cd8..2a1fe24a 100644 --- a/assets/javascripts/views/pages/simple.coffee +++ b/assets/javascripts/views/pages/simple.coffee @@ -14,6 +14,7 @@ app.views.BowerPage = app.views.CPage = app.views.CakephpPage = app.views.ChaiPage = +app.views.CodeceptionPage = app.views.CoffeescriptPage = app.views.CordovaPage = app.views.CrystalPage = diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index a6e8c7df..8798ef36 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -56,6 +56,7 @@ %icon-close-white { background-position: -2rem -5rem; } %icon-back { background-position: -3rem -5rem; @extend %darkIconFix !optional; } +._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; } ._icon-http:before { background-position: -7rem 0; @extend %darkIconFix !optional; } diff --git a/assets/stylesheets/pages/_codeception.scss b/assets/stylesheets/pages/_codeception.scss index 9595bc4b..73576a47 100644 --- a/assets/stylesheets/pages/_codeception.scss +++ b/assets/stylesheets/pages/_codeception.scss @@ -1,29 +1,7 @@ ._codeception { @extend %simple; - .warning, .alert { - @extend %note; - } - - h4 { - @extend %block-label; - } - + h4 { @extend %block-label; } + .warning, .alert { @extend %note; } .alert-danger { @extend %note-red; } - - .language-yaml { - @extend .token; - - .c1 { - @extend .token.comment; - } - - .pi { - @extend .token.operator; - } - - .s { - @extend .token.string; - } - } } diff --git a/lib/docs/filters/codeception/clean_html.rb b/lib/docs/filters/codeception/clean_html.rb index 1ac12c36..6ec5ba62 100644 --- a/lib/docs/filters/codeception/clean_html.rb +++ b/lib/docs/filters/codeception/clean_html.rb @@ -2,17 +2,40 @@ module Docs class Codeception class CleanHtmlFilter < Filter def call - root_page? ? root : other - doc - end - - def root - doc.inner_html = ' ' - end - - def other @doc = doc.at_css('div.page, div.content') + + while doc.element_children.length == 1 + doc.first_element_child.before(doc.first_element_child.children).remove + end + + if root_page? + at_css('h1').content = 'Codeception Documentation' + end + + 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('.btn-group').remove + + css('.alert:last-child').each do |node| + node.remove if node.content.include?('taken from the source code') + end + + css('.highlight').each do |node| + node.before(node.children).remove + end + + css('pre > code').each do |node| + node.parent['data-language'] = node['data-lang'] + node.parent.content = node.parent.content + end + doc end end diff --git a/lib/docs/filters/codeception/entries.rb b/lib/docs/filters/codeception/entries.rb index 0561c03f..f1d2beda 100644 --- a/lib/docs/filters/codeception/entries.rb +++ b/lib/docs/filters/codeception/entries.rb @@ -2,46 +2,48 @@ module Docs class Codeception class EntriesFilter < Docs::EntriesFilter def get_name - (subpath.scan(/\d\d/).first || '') + ' ' + (at_css('h1') || at_css('h2')).content + name = (at_css('h1') || at_css('h2')).content + + if number = subpath[/\A\d+/] + name.prepend "#{number.to_i}. " + end + + name end def get_type - return 'Module::' + (at_css('h1') || at_css('h2')).content if subpath.start_with?('modules') - return 'Guides' if subpath =~ /\d\d/ - (at_css('h1') || at_css('h2')).content - end - - def include_default_entry? - return true if %w(Guides).include? type - return true if type =~ /(Module)|(Util)/ - false + if subpath =~ /\d\d/ + 'Guides' + elsif subpath.start_with?('modules') + "Module: #{name}" + elsif name.include?('Util') + "Util Class: #{name.split('\\').last}" + else + "Reference: #{name}" + end end def additional_entries - if type =~ /Module/ - prefix = type.sub(/Module::/, '')+ '::' + prefix = "#{name}::" pattern = '#actions ~ h4' elsif type =~ /Functions/ prefix = '' - pattern = 'h4' - elsif type =~ /Util/ - prefix = type.sub(/Codeception\/Util/, '')+ '::' + pattern = '#page h4' + elsif name =~ /Util/ + prefix = "#{name.remove('Codeception\\Util\\')}::" pattern = 'h3' elsif type =~ /(Commands)|(Configuration)/ - prefix = '' - pattern = 'h2' - else prefix = '' - pattern = 'none' + pattern = 'h2' end + return [] unless pattern + css(pattern).map do |node| [prefix + node.content, node['id']] end.compact - end - end end end diff --git a/lib/docs/scrapers/codeception.rb b/lib/docs/scrapers/codeception.rb index def14e8c..408711c6 100644 --- a/lib/docs/scrapers/codeception.rb +++ b/lib/docs/scrapers/codeception.rb @@ -2,22 +2,20 @@ module Docs class Codeception < UrlScraper self.name = 'Codeception' self.type = 'codeception' - self.root_path = 'index.html' - self.release = '2.2' + self.release = '2.2.6' self.base_url = 'http://codeception.com/docs/' + self.root_path = 'index.html' self.links = { home: 'http://codeception.com/', code: 'https://github.com/codeception/codeception' } - html_filters.push 'codeception/clean_html', 'codeception/entries', 'title' + html_filters.push 'codeception/entries', 'codeception/clean_html' - options[:root_title] = 'Codeception' - options[:title] = false options[:skip_patterns] = [/install/] options[:attribution] = <<-HTML - © 2011–2016 Michael Bodnarchuk and Contributors
+ © 2011–2016 Michael Bodnarchuk and contributors
Licensed under the MIT License. HTML end diff --git a/public/icons/docs/codeception/16.png b/public/icons/docs/codeception/16.png index e641ecbb..37c4bf78 100644 Binary files a/public/icons/docs/codeception/16.png and b/public/icons/docs/codeception/16.png differ diff --git a/public/icons/docs/codeception/16@2x.png b/public/icons/docs/codeception/16@2x.png index 369f74fc..6a24d01e 100644 Binary files a/public/icons/docs/codeception/16@2x.png and b/public/icons/docs/codeception/16@2x.png differ