From 72ab3435725d1236123bba6678bd91cbb1c3f8fe Mon Sep 17 00:00:00 2001 From: edno Date: Wed, 30 Nov 2016 07:02:19 +0100 Subject: [PATCH] Codeception 2.2 documentation --- .../views/pages/codeception.coffee | 10 ++++ assets/stylesheets/application-dark.css.scss | 1 + assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_codeception.scss | 29 +++++++++++ lib/docs/filters/codeception/clean_html.rb | 20 ++++++++ lib/docs/filters/codeception/entries.rb | 47 ++++++++++++++++++ lib/docs/scrapers/codeception.rb | 24 +++++++++ public/icons/docs/codeception/16.png | Bin 0 -> 521 bytes public/icons/docs/codeception/16@2x.png | Bin 0 -> 1352 bytes public/icons/docs/codeception/SOURCE | 1 + 10 files changed, 133 insertions(+) create mode 100644 assets/javascripts/views/pages/codeception.coffee create mode 100644 assets/stylesheets/pages/_codeception.scss create mode 100644 lib/docs/filters/codeception/clean_html.rb create mode 100644 lib/docs/filters/codeception/entries.rb create mode 100644 lib/docs/scrapers/codeception.rb create mode 100644 public/icons/docs/codeception/16.png create mode 100644 public/icons/docs/codeception/16@2x.png create mode 100644 public/icons/docs/codeception/SOURCE diff --git a/assets/javascripts/views/pages/codeception.coffee b/assets/javascripts/views/pages/codeception.coffee new file mode 100644 index 00000000..bcc6e4c7 --- /dev/null +++ b/assets/javascripts/views/pages/codeception.coffee @@ -0,0 +1,10 @@ +#= 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/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 5846183b..23884a92 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -39,6 +39,7 @@ 'pages/c', 'pages/cakephp', 'pages/clojure', + 'pages/codeception', 'pages/coffeescript', 'pages/cordova', 'pages/crystal', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index ac52f946..bfa6cf8c 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -39,6 +39,7 @@ 'pages/c', 'pages/cakephp', 'pages/clojure', + 'pages/codeception', 'pages/coffeescript', 'pages/cordova', 'pages/crystal', diff --git a/assets/stylesheets/pages/_codeception.scss b/assets/stylesheets/pages/_codeception.scss new file mode 100644 index 00000000..9595bc4b --- /dev/null +++ b/assets/stylesheets/pages/_codeception.scss @@ -0,0 +1,29 @@ +._codeception { + @extend %simple; + + .warning, .alert { + @extend %note; + } + + h4 { + @extend %block-label; + } + + .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 new file mode 100644 index 00000000..1ac12c36 --- /dev/null +++ b/lib/docs/filters/codeception/clean_html.rb @@ -0,0 +1,20 @@ +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') + css('.btn-group').remove + doc + end + end + end +end diff --git a/lib/docs/filters/codeception/entries.rb b/lib/docs/filters/codeception/entries.rb new file mode 100644 index 00000000..0561c03f --- /dev/null +++ b/lib/docs/filters/codeception/entries.rb @@ -0,0 +1,47 @@ +module Docs + class Codeception + class EntriesFilter < Docs::EntriesFilter + def get_name + (subpath.scan(/\d\d/).first || '') + ' ' + (at_css('h1') || at_css('h2')).content + 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 + end + + def additional_entries + + if type =~ /Module/ + prefix = type.sub(/Module::/, '')+ '::' + pattern = '#actions ~ h4' + elsif type =~ /Functions/ + prefix = '' + pattern = 'h4' + elsif type =~ /Util/ + prefix = type.sub(/Codeception\/Util/, '')+ '::' + pattern = 'h3' + elsif type =~ /(Commands)|(Configuration)/ + prefix = '' + pattern = 'h2' + else + prefix = '' + pattern = 'none' + end + + 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 new file mode 100644 index 00000000..def14e8c --- /dev/null +++ b/lib/docs/scrapers/codeception.rb @@ -0,0 +1,24 @@ +module Docs + class Codeception < UrlScraper + self.name = 'Codeception' + self.type = 'codeception' + self.root_path = 'index.html' + self.release = '2.2' + self.base_url = 'http://codeception.com/docs/' + self.links = { + home: 'http://codeception.com/', + code: 'https://github.com/codeception/codeception' + } + + html_filters.push 'codeception/clean_html', 'codeception/entries', 'title' + + options[:root_title] = 'Codeception' + options[:title] = false + options[:skip_patterns] = [/install/] + + options[:attribution] = <<-HTML + © 2011–2016 Michael Bodnarchuk and Contributors
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/codeception/16.png b/public/icons/docs/codeception/16.png new file mode 100644 index 0000000000000000000000000000000000000000..e641ecbb4c776a54b67761a0bec04641ac3e6d40 GIT binary patch literal 521 zcmV+k0`~ohP)|o1GaZtS)BgUR=)5GQ*#tq?;R$4n{bOXYLM1mYF+mFihKWm|^0Yc7~pX z%?#}`wlXyJKW3=w@I=uzX&bxX+}$?fi*`Z`7n-}*jep+WC#9@}6piO+i{u-%8`**?xyB6j$bk14J&^j%Xp?%hKhK^Ym z7~1D5VGTx@0g?;%Aq+?Z#zy0Wiwupu|ABZFLs=&;&UlajdO>u--W{R~_RZyxYpP<*YpEAjd#00000 LNkvXXu0mjf+356) literal 0 HcmV?d00001 diff --git a/public/icons/docs/codeception/16@2x.png b/public/icons/docs/codeception/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..369f74fc2d5e4449418f7f56c14e3f4086c11632 GIT binary patch literal 1352 zcmV-O1-JT%P)*>|X{iE97jfc{3ZEfcKgN_Z5i%q|x^A6l`4tfSW^WU>?R! z33}H9G}|sfYph&tZgo_ALCq(g2c*To3;e>qf?#5NTR@ODdt(pb86HOaKn-j?l`wTH zVP<#G?aN{Ey@nQ#2RhdzKD0|{GXIE%meS=Ct3t5~RY=embIDh-Zcv7WL&{L{t|FL_ zSm_tdlbn3u34}!6jgE`0HjOl|VGh1W%xdGv{ zA`ri}JuvcY);$U~wNo7yZ!5#1R1k;{ATXlJ^9v_rzW7h*yf%xDfiY@9ClS#JOK5<~ ze-C=+?`X34P*U_X%BKg&j+REag*PHJ_4{p~Po&W2G`AwC4vC z=^Wok80^(&79ZYL2*!2_O|5;DXxm}}4;>@|Um@`K;U3n4Ny(N@9ufBKj*iX|fZ0qN z)Vz2~#fj;BfBZd2(((+iuFm<_-^SizxcY5Wv01eD{{m;sF@YH^;leS_TLIZ zpA?t#VoJ@4@g;xIWIaYe=E1Z|BtjVljIE@AE0S<`bnHe+B=v}drIAr>F(=M!;{{FD z{U=XuMWg<6G#dUuqt1!i+T1mpUTH)$W<*F87C9v=Xo|wgDe?qgR

2R`)XMbw{7b z1+xMm1ER9eDZ|Oxd{#JA7!YbRD!7G>)h=zBe?`6SC1{!F)(k=wPI?Q&NhvQ7|1=}T zx&F8_#}`l2XCBUrdl%i7VN_@|o~Bm(iU!>Xs;Xpb0-#_AcWw_RZs(B=%h=ce>?11D z@#AF2_efIj!+!ocES!(*xC4fcA+q3~an?MC2E7+rZ4p)CUDPvGYXXr^K9K7d?veva zlzbfSp(C);RMd9iI05LRN$3Vl{;#0#h?5aD(-5*Bb!5kl2JR6l8}u_ct2?kJ5OVj> zKAMEa;T_3LLJ#4(G)&2BND24C