Skip to content

Commit 4e56a77

Browse files
committed
Finish Graphite scraper
1 parent 7d6e45c commit 4e56a77

File tree

7 files changed

+23
-29
lines changed

7 files changed

+23
-29
lines changed

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
"2018-07-29",
4-
"New documentations: <a href=\"/bash/\">Bash</a> and <a href=\"/pygame/\">Pygame</a>"
4+
"New documentations: <a href=\"/bash/\">Bash</a>, <a href=\"/graphite/\">Graphite</a> and <a href=\"/pygame/\">Pygame</a>"
55
], [
66
"2018-07-08",
77
"New documentations: <a href=\"/leaflet/\">Leaflet</a>, <a href=\"/terraform/\">Terraform</a> and <a href=\"/koa/\">Koa</a>"

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ credits = [
297297
'https://raw.githubusercontent.com/godotengine/godot/master/LICENSE.txt'
298298
], [
299299
'Graphite',
300-
'2008-2012 Chris Davis; 2011-2016 The Graphite Project',
300+
'2008-2012 Chris Davis<br>&copy; 2011-2016 The Graphite Project',
301301
'Apache',
302302
'https://raw.githubusercontent.com/graphite-project/graphite-web/master/LICENSE'
303303
], [

assets/stylesheets/global/_icons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
._icon-marionette:before { background-position: -6rem -5rem; }
9595
._icon-jsdoc:before,
9696
._icon-koa:before,
97+
._icon-graphite:before,
9798
._icon-mongoose:before { background-position: -7rem -5rem; }
9899
._icon-phpunit:before { background-position: -8rem -5rem; }
99100
._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
11
._graphite {
22
@extend %simple;
33

4-
h1 {
5-
@extend %lined-heading;
6-
}
7-
8-
.section:first-child h1 {
9-
margin-top: 0;
10-
}
11-
124
dl > dt {
13-
@extend %note, %note-blue;
14-
padding: 1px 0.5rem 2px 0.5rem;
15-
font-weight: bold;
16-
}
17-
18-
dl.function > dt {
19-
code {
20-
font-weight: bold;
21-
}
22-
em {
23-
font-style: normal;
24-
}
5+
@extend %block-label, %label-blue;
256
}
267
}

lib/docs/filters/graphite/clean_html.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ def call
55
# Remove the paragraph icon after all headers
66
css('.headerlink').remove
77

8-
# Extract the text from function titles to get rid of the inconsistent styling
98
css('dl.function > dt').each do |node|
10-
node['data-name'] = node.at_css('.descname').inner_html.to_s
11-
node.content = node.text
9+
node.content = node.content
10+
end
11+
12+
css('.section').each do |node|
13+
node.before(node.children).remove
14+
end
15+
16+
css('div[class*="highlight-"]').each do |node|
17+
node.content = node.content.strip
18+
node.name = 'pre'
19+
node['data-language'] = node['class'][/highlight\-(\w+)/, 1]
20+
node.remove_attribute('class')
1221
end
1322

1423
doc

lib/docs/filters/graphite/entries.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def additional_entries
3434

3535
# Functions
3636
css('dl.function > dt').each do |node|
37-
entries << [node['data-name'], node['id'], 'List of functions']
37+
name = node.at_css('.descname').content
38+
name << '()'
39+
entries << [name, node['id'], 'Functions']
3840
end
3941

4042
entries

lib/docs/scrapers/graphite.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ module Docs
22
class Graphite < UrlScraper
33
self.type = 'graphite'
44
self.release = '1.1.3'
5-
self.base_url = 'http://graphite.readthedocs.io/en/latest/'
5+
self.base_url = 'https://graphite.readthedocs.io/en/latest/'
66
self.links = {
77
code: 'https://github.com/graphite-project/graphite-web'
88
}
99

10-
html_filters.push 'graphite/clean_html', 'graphite/entries'
10+
html_filters.push 'graphite/entries', 'graphite/clean_html'
1111

1212
options[:container] = '.document > div'
1313
options[:skip] = %w(releases.html who-is-using.html composer.html search.html py-modindex.html genindex.html)
1414

1515
options[:attribution] = <<-HTML
16-
&copy; 2008-2012 Chris Davis; 2011-2016 The Graphite Project<br>
16+
&copy; 2008&ndash;2012 Chris Davis<br>
17+
&copy; 2011&ndash;2016 The Graphite Project<br>
1718
Licensed under the Apache License, Version 2.0.
1819
HTML
1920
end

0 commit comments

Comments
 (0)