diff --git a/assets/javascripts/views/pages/codeceptjs.coffee b/assets/javascripts/views/pages/codeceptjs.coffee new file mode 100644 index 00000000..18bb626e --- /dev/null +++ b/assets/javascripts/views/pages/codeceptjs.coffee @@ -0,0 +1,9 @@ +#= 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 diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 23884a92..68c6350d 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -40,6 +40,7 @@ 'pages/cakephp', 'pages/clojure', 'pages/codeception', + 'pages/codeceptjs', 'pages/coffeescript', 'pages/cordova', 'pages/crystal', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index bfa6cf8c..90ffb5c0 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -40,6 +40,7 @@ 'pages/cakephp', 'pages/clojure', 'pages/codeception', + 'pages/codeceptjs', 'pages/coffeescript', 'pages/cordova', 'pages/crystal', diff --git a/assets/stylesheets/pages/_codeceptjs.scss b/assets/stylesheets/pages/_codeceptjs.scss new file mode 100644 index 00000000..a3916d90 --- /dev/null +++ b/assets/stylesheets/pages/_codeceptjs.scss @@ -0,0 +1,3 @@ +._codeceptjs { + @extend %simple; +} diff --git a/lib/docs/filters/codeceptjs/clean_html.rb b/lib/docs/filters/codeceptjs/clean_html.rb new file mode 100644 index 00000000..4d1d8485 --- /dev/null +++ b/lib/docs/filters/codeceptjs/clean_html.rb @@ -0,0 +1,19 @@ +module Docs + class Codeceptjs + class CleanHtmlFilter < Filter + def call + root_page? ? root : other + doc + end + + def root + doc.inner_html = ' ' + end + + def other + @doc = doc.at_css('div.reference').xpath('//div[@role="main"]') + doc + end + end + end +end diff --git a/lib/docs/filters/codeceptjs/entries.rb b/lib/docs/filters/codeceptjs/entries.rb new file mode 100644 index 00000000..2927d094 --- /dev/null +++ b/lib/docs/filters/codeceptjs/entries.rb @@ -0,0 +1,27 @@ +module Docs + class Codeceptjs + class EntriesFilter < Docs::EntriesFilter + def get_name + (at_css('h1') || at_css('h2')).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 + end + + def additional_entries + return [] unless type =~ /Helpers::.*/ + + helper = type.sub(/Helpers::/, '')+ '::' + + css('h2').map do |node| + next if node['id'] == 'access-from-helpers' + [helper + node.content, node['id']] + end.compact + end + + end + end +end diff --git a/lib/docs/scrapers/codeceptjs.rb b/lib/docs/scrapers/codeceptjs.rb new file mode 100644 index 00000000..8aa2a562 --- /dev/null +++ b/lib/docs/scrapers/codeceptjs.rb @@ -0,0 +1,25 @@ +module Docs + class Codeceptjs < UrlScraper + self.name = 'CodeceptJS' + self.type = 'codeceptjs' + self.root_path = 'index.html' + self.release = '0.4' + self.base_url = 'http://codecept.io/' + self.links = { + home: 'http://codecept.io/', + code: 'https://github.com/codeception/codeceptjs' + } + + html_filters.push 'codeceptjs/clean_html', 'codeceptjs/entries', 'title' + + options[:root_title] = 'CodeceptJS' + options[:title] = false + options[:skip_links] = ->(filter) { !filter.initial_page? } + options[:skip_patterns] = [/changelog/, /quickstart$/] + + options[:attribution] = <<-HTML + © 2015–2016 Michael Bodnarchuk and Contributors
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/codeceptjs/16.png b/public/icons/docs/codeceptjs/16.png new file mode 100644 index 00000000..4be32d5e Binary files /dev/null and b/public/icons/docs/codeceptjs/16.png differ diff --git a/public/icons/docs/codeceptjs/16@2x.png b/public/icons/docs/codeceptjs/16@2x.png new file mode 100644 index 00000000..119b2df2 Binary files /dev/null and b/public/icons/docs/codeceptjs/16@2x.png differ diff --git a/public/icons/docs/codeceptjs/SOURCE b/public/icons/docs/codeceptjs/SOURCE new file mode 100644 index 00000000..c7e6d443 --- /dev/null +++ b/public/icons/docs/codeceptjs/SOURCE @@ -0,0 +1 @@ +http://codecept.io/images/cjs-base.png