mirror of https://github.com/freeCodeCamp/devdocs
parent
e8d52c9cfd
commit
d3196c53ed
@ -0,0 +1,21 @@
|
||||
._cypress {
|
||||
@extend %simple;
|
||||
|
||||
.note {
|
||||
h1 {
|
||||
margin-left: inherit
|
||||
}
|
||||
|
||||
&.danger {
|
||||
@extend %note-red
|
||||
}
|
||||
|
||||
&.info {
|
||||
@extend %note-blue
|
||||
}
|
||||
|
||||
&.success {
|
||||
@extend %note-green
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in new issue