Skip to content

Commit d3196c5

Browse files
author
Juan González
committed
Add documentation for cypress.io
1 parent e8d52c9 commit d3196c5

File tree

8 files changed

+113
-0
lines changed

8 files changed

+113
-0
lines changed

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
'pages/coffeescript',
4747
'pages/cordova',
4848
'pages/crystal',
49+
'pages/cypress',
4950
'pages/d',
5051
'pages/d3',
5152
'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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Cypress
5+
class CleanHtmlFilter < Filter
6+
def call
7+
css('.article-edit-link').remove
8+
css('#sidebar').remove
9+
css('article footer').remove
10+
css('#article-toc').remove
11+
css('.article-footer-updated').remove
12+
13+
doc
14+
end
15+
end
16+
end
17+
end

lib/docs/filters/cypress/entries.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
examples
12+
getting-started
13+
guides
14+
overview
15+
plugins
16+
references
17+
utilities
18+
].freeze
19+
20+
def get_name
21+
at_css('h1.article-title').content.strip
22+
end
23+
24+
def get_type
25+
path = context[:url].path
26+
27+
SECTIONS.each do |section|
28+
if path.match?("/#{section}/")
29+
return section.split('-').map(&:capitalize).join(' ')
30+
end
31+
end
32+
end
33+
34+
def additional_entries
35+
css('.sidebar-li > a').map do |node|
36+
[node['href']]
37+
end
38+
end
39+
end
40+
end
41+
end

lib/docs/scrapers/cypress.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Cypress < UrlScraper
5+
# Follow the instructions on https://github.com/cypress-io/cypress-documentation/blob/develop/CONTRIBUTING.md
6+
# to run the cypress documentation server locally in the following URL:
7+
# self.base_url = 'http://localhost:2222'
8+
self.base_url = 'https://docs.cypress.io'
9+
10+
self.name = 'Cypress'
11+
self.type = 'cypress'
12+
self.root_path = '/api/introduction/api.html'
13+
14+
html_filters.push 'cypress/clean_html', 'cypress/entries'
15+
16+
options[:root_title] = 'Cypress'
17+
options[:container] = '#content'
18+
19+
options[:include_default_entry] = true
20+
21+
options[:skip_link] = lambda do |link|
22+
href = link.attr(:href)
23+
24+
EntriesFilter::SECTIONS.none? { |section| href.match?("/#{section}/") }
25+
end
26+
27+
options[:attribution] = <<-HTML
28+
© 2018 <a href="https://cypress.io">Cypress.io</a>
29+
- Licensed under the
30+
<a href="https://github.com/cypress-io/cypress-documentation/blob/develop/LICENSE.md">MIT License</a>.
31+
HTML
32+
end
33+
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)