mirror of https://github.com/freeCodeCamp/devdocs
parent
c13877f833
commit
7a1ca03397
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,30 @@
|
||||
module Docs
|
||||
class Jasmine
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('.docs')
|
||||
|
||||
at_css('h1').content = 'Jasmine' if root_page?
|
||||
|
||||
css('header', 'article', 'section:not([class])', 'div.description').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('h3.subsection-title').each do |node|
|
||||
node.name = 'h2'
|
||||
end
|
||||
|
||||
css('h4.name').each do |node|
|
||||
node.name = 'h3'
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
node['data-language'] = 'javascript'
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
module Docs
|
||||
class Jasmine
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('h1').content.strip
|
||||
name.remove! %r{\A\w+:\s}
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
at_css('h1').content.strip
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h3[id]').each_with_object [] do |node, entries|
|
||||
name = node.content.strip
|
||||
next if name.start_with?('new ')
|
||||
static = name.sub! '(static) ', ''
|
||||
name.sub! %r{\(.*\)}, '()'
|
||||
name.remove! %r{\s.*}
|
||||
name.prepend "#{self.name}#{static ? '.' : '#'}" unless slug == 'global'
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Jasmine < UrlScraper
|
||||
self.type = 'jasmine'
|
||||
self.release = '2.6.1'
|
||||
self.base_url = 'https://jasmine.github.io/api/2.6/'
|
||||
self.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'https://jasmine.github.io/',
|
||||
code: 'https://github.com/jasmine/jasmine'
|
||||
}
|
||||
|
||||
html_filters.push 'jasmine/clean_html', 'jasmine/entries'
|
||||
|
||||
options[:container] = '.main-content'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2008–2017 Pivotal Labs<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 753 B |
After Width: | Height: | Size: 909 B |
@ -0,0 +1 @@
|
||||
https://github.com/jasmine/jasmine.github.io/tree/master/images
|
Loading…
Reference in new issue