[devdocsgjs/main: 444/1867] Add documentation for cypress.io
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 444/1867] Add documentation for cypress.io
- Date: Fri, 19 Nov 2021 23:47:15 +0000 (UTC)
commit d3196c53ed3948d42223053a042ef180f79db2d3
Author: Juan González <juan gonzalez xing com>
Date: Tue Sep 25 17:51:35 2018 +0200
Add documentation for cypress.io
assets/stylesheets/application.css.scss | 1 +
assets/stylesheets/pages/_cypress.scss | 21 ++++++++++++++++
lib/docs/filters/cypress/clean_html.rb | 17 +++++++++++++
lib/docs/filters/cypress/entries.rb | 41 ++++++++++++++++++++++++++++++++
lib/docs/scrapers/cypress.rb | 33 +++++++++++++++++++++++++
public/icons/docs/cypress/16.png | Bin 0 -> 1183 bytes
public/icons/docs/cypress/16 2x png | Bin 0 -> 1858 bytes
public/icons/docs/cypress/SOURCE.ico | Bin 0 -> 32038 bytes
8 files changed, 113 insertions(+)
---
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index fd6ffffd..72feda6a 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -46,6 +46,7 @@
'pages/coffeescript',
'pages/cordova',
'pages/crystal',
+ 'pages/cypress',
'pages/d',
'pages/d3',
'pages/dart',
diff --git a/assets/stylesheets/pages/_cypress.scss b/assets/stylesheets/pages/_cypress.scss
new file mode 100644
index 00000000..aa1108d2
--- /dev/null
+++ b/assets/stylesheets/pages/_cypress.scss
@@ -0,0 +1,21 @@
+._cypress {
+ @extend %simple;
+
+ .note {
+ h1 {
+ margin-left: inherit
+ }
+
+ &.danger {
+ @extend %note-red
+ }
+
+ &.info {
+ @extend %note-blue
+ }
+
+ &.success {
+ @extend %note-green
+ }
+ }
+}
diff --git a/lib/docs/filters/cypress/clean_html.rb b/lib/docs/filters/cypress/clean_html.rb
new file mode 100644
index 00000000..6a36d24c
--- /dev/null
+++ b/lib/docs/filters/cypress/clean_html.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Docs
+ class Cypress
+ class CleanHtmlFilter < Filter
+ def call
+ css('.article-edit-link').remove
+ css('#sidebar').remove
+ css('article footer').remove
+ css('#article-toc').remove
+ css('.article-footer-updated').remove
+
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/cypress/entries.rb b/lib/docs/filters/cypress/entries.rb
new file mode 100644
index 00000000..a854acd7
--- /dev/null
+++ b/lib/docs/filters/cypress/entries.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+module Docs
+ class Cypress
+ class EntriesFilter < Docs::EntriesFilter
+ SECTIONS = %w[
+ commands
+ core-concepts
+ cypress-api
+ events
+ examples
+ getting-started
+ guides
+ overview
+ plugins
+ references
+ utilities
+ ].freeze
+
+ def get_name
+ at_css('h1.article-title').content.strip
+ end
+
+ def get_type
+ path = context[:url].path
+
+ SECTIONS.each do |section|
+ if path.match?("/#{section}/")
+ return section.split('-').map(&:capitalize).join(' ')
+ end
+ end
+ end
+
+ def additional_entries
+ css('.sidebar-li > a').map do |node|
+ [node['href']]
+ end
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/cypress.rb b/lib/docs/scrapers/cypress.rb
new file mode 100644
index 00000000..d6db296a
--- /dev/null
+++ b/lib/docs/scrapers/cypress.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module Docs
+ class Cypress < UrlScraper
+ # Follow the instructions on
https://github.com/cypress-io/cypress-documentation/blob/develop/CONTRIBUTING.md
+ # to run the cypress documentation server locally in the following URL:
+ # self.base_url = 'http://localhost:2222'
+ self.base_url = 'https://docs.cypress.io'
+
+ self.name = 'Cypress'
+ self.type = 'cypress'
+ self.root_path = '/api/introduction/api.html'
+
+ html_filters.push 'cypress/clean_html', 'cypress/entries'
+
+ options[:root_title] = 'Cypress'
+ options[:container] = '#content'
+
+ options[:include_default_entry] = true
+
+ options[:skip_link] = lambda do |link|
+ href = link.attr(:href)
+
+ EntriesFilter::SECTIONS.none? { |section| href.match?("/#{section}/") }
+ end
+
+ options[:attribution] = <<-HTML
+ © 2018 <a href="https://cypress.io">Cypress.io</a>
+ - Licensed under the
+ <a href="https://github.com/cypress-io/cypress-documentation/blob/develop/LICENSE.md">MIT License</a>.
+ HTML
+ end
+end
diff --git a/public/icons/docs/cypress/16.png b/public/icons/docs/cypress/16.png
new file mode 100644
index 00000000..4da1b400
Binary files /dev/null and b/public/icons/docs/cypress/16.png differ
diff --git a/public/icons/docs/cypress/16 2x png b/public/icons/docs/cypress/16 2x png
new file mode 100644
index 00000000..a327f375
Binary files /dev/null and b/public/icons/docs/cypress/16 2x png differ
diff --git a/public/icons/docs/cypress/SOURCE.ico b/public/icons/docs/cypress/SOURCE.ico
new file mode 100644
index 00000000..45749a77
Binary files /dev/null and b/public/icons/docs/cypress/SOURCE.ico differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]