mirror of https://github.com/freeCodeCamp/devdocs
Add documentation for cypress.io (#875)
Add documentation for cypress.io Co-authored-by: Jasper van Merle <jaspervmerle@gmail.com>pull/1053/head
commit
7081e7e1fb
@ -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,26 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Docs
|
||||||
|
class Cypress
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
article_div = at_css('#article > div')
|
||||||
|
@doc = article_div unless article_div.nil?
|
||||||
|
|
||||||
|
header = at_css('h1.article-title')
|
||||||
|
doc.prepend_child(header) unless header.nil?
|
||||||
|
|
||||||
|
css('.article-edit-link').remove
|
||||||
|
css('.article-footer').remove
|
||||||
|
css('.article-footer-updated').remove
|
||||||
|
|
||||||
|
css('pre').each do |node|
|
||||||
|
node.content = node.content
|
||||||
|
node['data-language'] = 'javascript'
|
||||||
|
end
|
||||||
|
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,34 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Docs
|
||||||
|
class Cypress
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
SECTIONS = %w[
|
||||||
|
commands
|
||||||
|
core-concepts
|
||||||
|
cypress-api
|
||||||
|
events
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,36 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Docs
|
||||||
|
class Cypress < UrlScraper
|
||||||
|
self.name = 'Cypress'
|
||||||
|
self.type = 'cypress'
|
||||||
|
self.release = '3.4.1'
|
||||||
|
self.base_url = 'https://docs.cypress.io'
|
||||||
|
self.root_path = '/api/api/table-of-contents.html'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://www.cypress.io/',
|
||||||
|
code: 'https://github.com/cypress-io/cypress',
|
||||||
|
}
|
||||||
|
|
||||||
|
html_filters.push 'cypress/entries', 'cypress/clean_html'
|
||||||
|
|
||||||
|
options[:container] = '#content'
|
||||||
|
options[:max_image_size] = 300_000
|
||||||
|
options[:include_default_entry] = true
|
||||||
|
|
||||||
|
options[:skip_patterns] = [/examples\//]
|
||||||
|
options[:skip_link] = ->(link) {
|
||||||
|
href = link.attr(:href)
|
||||||
|
href.nil? ? true : EntriesFilter::SECTIONS.none? { |section| href.match?("/#{section}/") }
|
||||||
|
}
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© 2017 Cypress.io<br>
|
||||||
|
Licensed under the MIT License.
|
||||||
|
HTML
|
||||||
|
|
||||||
|
def get_latest_version(opts)
|
||||||
|
get_latest_github_release('cypress-io', 'cypress', opts)
|
||||||
|
end
|
||||||
|
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