mirror of https://github.com/freeCodeCamp/devdocs
parent
22461b057d
commit
aa1be2f49d
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 143 KiB |
@ -0,0 +1,29 @@
|
||||
module Docs
|
||||
class Jest
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('.mainContainer .post')
|
||||
|
||||
at_css('h1').content = 'Jest' if root_page?
|
||||
|
||||
css('.edit-page-link', '.hash-link', 'hr').remove
|
||||
|
||||
css('.postHeader', 'article', 'div:not([class])').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('.anchor[name]').each do |node|
|
||||
node.parent['id'] = node['name']
|
||||
node.remove
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node['data-language'] = node['class'][/language-(\w+)/, 1]
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
module Docs
|
||||
class Jest
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('.mainContainer h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
type = at_css('.navItemActive').ancestors('.navGroup').first.at_css('h3').content
|
||||
|
||||
if type == 'Introduction'
|
||||
'Guides: Introduction'
|
||||
elsif type == 'API Reference'
|
||||
self.name
|
||||
else
|
||||
type
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless !root_page? && self.type == self.name # api page
|
||||
|
||||
at_css('.mainContainer ul').css('li > a').map do |node|
|
||||
name = node.at_css('code').content.strip
|
||||
name.sub! %r{\(.*\)}, '()'
|
||||
name.remove! %r{[\s=<].*}
|
||||
name.prepend 'jest ' if name.start_with?('--')
|
||||
name.prepend 'Config: ' if slug == 'configuration'
|
||||
id = node['href'].remove('#')
|
||||
[name, id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Jest < UrlScraper
|
||||
self.type = 'jest'
|
||||
self.release = '20.0.1'
|
||||
self.base_url = 'https://facebook.github.io/jest/docs/en/'
|
||||
self.root_path = 'getting-started.html'
|
||||
self.links = {
|
||||
home: 'https://facebook.github.io/jest/',
|
||||
code: 'https://github.com/facebook/jest'
|
||||
}
|
||||
|
||||
html_filters.push 'jest/entries', 'jest/clean_html'
|
||||
|
||||
options[:container] = '.docMainWrapper'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2014–present Facebook Inc.<br>
|
||||
Licensed under the BSD License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 784 B |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/facebook/jest/tree/master/website/src/jest/img
|
Loading…
Reference in new issue