Unified · Split
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | 'pages/coffeescript', |
| 47 | 47 | 'pages/cordova', |
| 48 | 48 | 'pages/crystal', |
| 49 | + 'pages/cypress', | |
| 49 | 50 | 'pages/d', |
| 50 | 51 | 'pages/d3', |
| 51 | 52 | 'pages/dart', |
| @@ -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 | +} | |
| @@ -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 | |
| @@ -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 | |
| @@ -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 | |
Binary file not shown.
Binary file not shown.
Binary file not shown.