Skip to content

Commit 7a1ca03

Browse files
committed
Add Jasmine documentation
1 parent c13877f commit 7a1ca03

13 files changed

Lines changed: 88 additions & 1 deletion

File tree

assets/images/docs-2.png

3.75 KB
Loading

assets/images/[email protected]

10.8 KB
Loading

assets/javascripts/news.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
[
33
"2017-05-14",
4-
"New documentations: <a href=\"/jest/\">Jest</a> and <a href=\"/liquid/\">Liquid</a>"
4+
"New documentations: <a href=\"/jest/\">Jest</a>, <a href=\"/jasmine/\">Jasmine</a> and <a href=\"/liquid/\">Liquid</a>"
55
], [
66
"2017-04-30",
77
"New documentation: <a href=\"/openjdk/\">OpenJDK</a>"

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ credits = [
283283
'2015 InfluxData, Inc.',
284284
'MIT',
285285
'https://github.com/influxdata/docs.influxdata.com/blob/master/LICENSE'
286+
], [
287+
'Jasmine',
288+
'2008-2017 Pivotal Labs',
289+
'MIT',
290+
'https://raw.githubusercontent.com/jasmine/jasmine/master/MIT.LICENSE'
286291
], [
287292
'Jest',
288293
'2014-present Facebook Inc.',

assets/javascripts/views/pages/simple.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ app.views.ExpressPage =
2828
app.views.GoPage =
2929
app.views.ImmutablePage =
3030
app.views.InfluxdataPage =
31+
app.views.JasminePage =
3132
app.views.JestPage =
3233
app.views.KnockoutPage =
3334
app.views.KotlinPage =

assets/stylesheets/global/_icons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,4 @@
171171
._icon-padrino:before { background-position: -7rem -1rem; @extend %doc-icon-2; }
172172
._icon-angular:before { background-position: -8rem -1rem; @extend %doc-icon-2; }
173173
._icon-love:before { background-position: -9rem -1rem; @extend %doc-icon-2; }
174+
._icon-jasmine:before { background-position: 0 -2rem; @extend %doc-icon-2; }

assets/stylesheets/pages/_simple.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
._haxe,
2929
._immutable,
3030
._influxdata,
31+
._jasmine,
3132
._jest,
3233
._less,
3334
._lodash,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Docs
2+
class Jasmine
3+
class CleanHtmlFilter < Filter
4+
def call
5+
@doc = at_css('.docs')
6+
7+
at_css('h1').content = 'Jasmine' if root_page?
8+
9+
css('header', 'article', 'section:not([class])', 'div.description').each do |node|
10+
node.before(node.children).remove
11+
end
12+
13+
css('h3.subsection-title').each do |node|
14+
node.name = 'h2'
15+
end
16+
17+
css('h4.name').each do |node|
18+
node.name = 'h3'
19+
end
20+
21+
css('pre').each do |node|
22+
node.content = node.content
23+
node['data-language'] = 'javascript'
24+
end
25+
26+
doc
27+
end
28+
end
29+
end
30+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Docs
2+
class Jasmine
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
name = at_css('h1').content.strip
6+
name.remove! %r{\A\w+:\s}
7+
name
8+
end
9+
10+
def get_type
11+
at_css('h1').content.strip
12+
end
13+
14+
def additional_entries
15+
css('h3[id]').each_with_object [] do |node, entries|
16+
name = node.content.strip
17+
next if name.start_with?('new ')
18+
static = name.sub! '(static) ', ''
19+
name.sub! %r{\(.*\)}, '()'
20+
name.remove! %r{\s.*}
21+
name.prepend "#{self.name}#{static ? '.' : '#'}" unless slug == 'global'
22+
entries << [name, node['id']]
23+
end
24+
end
25+
end
26+
end
27+
end

lib/docs/scrapers/jasmine.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Docs
2+
class Jasmine < UrlScraper
3+
self.type = 'jasmine'
4+
self.release = '2.6.1'
5+
self.base_url = 'https://jasmine.github.io/api/2.6/'
6+
self.root_path = 'index.html'
7+
self.links = {
8+
home: 'https://jasmine.github.io/',
9+
code: 'https://github.com/jasmine/jasmine'
10+
}
11+
12+
html_filters.push 'jasmine/clean_html', 'jasmine/entries'
13+
14+
options[:container] = '.main-content'
15+
16+
options[:attribution] = <<-HTML
17+
&copy; 2008&ndash;2017 Pivotal Labs<br>
18+
Licensed under the MIT License.
19+
HTML
20+
end
21+
end

0 commit comments

Comments
 (0)