Skip to content

Commit 7081e7e

Browse files
authored
Add documentation for cypress.io (#875)
Add documentation for cypress.io Co-authored-by: Jasper van Merle <[email protected]>
2 parents 934cee4 + 11234ec commit 7081e7e

File tree

9 files changed

+124
-0
lines changed

9 files changed

+124
-0
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ credits = [
202202
'Apache',
203203
'https://raw.githubusercontent.com/crystal-lang/crystal/master/LICENSE'
204204
], [
205+
'Cypress',
206+
'2017 Cypress.io',
207+
'MIT',
208+
'https://raw.githubusercontent.com/cypress-io/cypress-documentation/develop/LICENSE.md'
209+
],
210+
[
205211
'D',
206212
'1999-2018 The D Language Foundation',
207213
'Boost',

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
'pages/coffeescript',
4646
'pages/cordova',
4747
'pages/crystal',
48+
'pages/cypress',
4849
'pages/d',
4950
'pages/d3',
5051
'pages/dart',
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
._cypress {
2+
@extend %simple;
3+
4+
.note {
5+
h1 {
6+
margin-left: inherit
7+
}
8+
9+
&.danger {
10+
@extend %note-red
11+
}
12+
13+
&.info {
14+
@extend %note-blue
15+
}
16+
17+
&.success {
18+
@extend %note-green
19+
}
20+
}
21+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Cypress
5+
class CleanHtmlFilter < Filter
6+
def call
7+
article_div = at_css('#article > div')
8+
@doc = article_div unless article_div.nil?
9+
10+
header = at_css('h1.article-title')
11+
doc.prepend_child(header) unless header.nil?
12+
13+
css('.article-edit-link').remove
14+
css('.article-footer').remove
15+
css('.article-footer-updated').remove
16+
17+
css('pre').each do |node|
18+
node.content = node.content
19+
node['data-language'] = 'javascript'
20+
end
21+
22+
doc
23+
end
24+
end
25+
end
26+
end

lib/docs/filters/cypress/entries.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Cypress
5+
class EntriesFilter < Docs::EntriesFilter
6+
SECTIONS = %w[
7+
commands
8+
core-concepts
9+
cypress-api
10+
events
11+
getting-started
12+
guides
13+
overview
14+
plugins
15+
references
16+
utilities
17+
].freeze
18+
19+
def get_name
20+
at_css('h1.article-title').content.strip
21+
end
22+
23+
def get_type
24+
path = context[:url].path
25+
26+
SECTIONS.each do |section|
27+
if path.match?("/#{section}/")
28+
return section.split('-').map(&:capitalize).join(' ')
29+
end
30+
end
31+
end
32+
end
33+
end
34+
end

lib/docs/scrapers/cypress.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Cypress < UrlScraper
5+
self.name = 'Cypress'
6+
self.type = 'cypress'
7+
self.release = '3.4.1'
8+
self.base_url = 'https://docs.cypress.io'
9+
self.root_path = '/api/api/table-of-contents.html'
10+
self.links = {
11+
home: 'https://www.cypress.io/',
12+
code: 'https://github.com/cypress-io/cypress',
13+
}
14+
15+
html_filters.push 'cypress/entries', 'cypress/clean_html'
16+
17+
options[:container] = '#content'
18+
options[:max_image_size] = 300_000
19+
options[:include_default_entry] = true
20+
21+
options[:skip_patterns] = [/examples\//]
22+
options[:skip_link] = ->(link) {
23+
href = link.attr(:href)
24+
href.nil? ? true : EntriesFilter::SECTIONS.none? { |section| href.match?("/#{section}/") }
25+
}
26+
27+
options[:attribution] = <<-HTML
28+
&copy; 2017 Cypress.io<br>
29+
Licensed under the MIT License.
30+
HTML
31+
32+
def get_latest_version(opts)
33+
get_latest_github_release('cypress-io', 'cypress', opts)
34+
end
35+
end
36+
end

public/icons/docs/cypress/16.png

1.16 KB
Loading
1.81 KB
Loading

public/icons/docs/cypress/SOURCE.ico

31.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)