Add Graphite documentation

pull/832/merge
Jasper van Merle 7 years ago committed by Thibaut Courouble
parent a71f48ea10
commit 7d6e45c325

@ -295,6 +295,11 @@ credits = [
'2014-2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors', '2014-2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors',
'MIT', 'MIT',
'https://raw.githubusercontent.com/godotengine/godot/master/LICENSE.txt' 'https://raw.githubusercontent.com/godotengine/godot/master/LICENSE.txt'
], [
'Graphite',
'2008-2012 Chris Davis; 2011-2016 The Graphite Project',
'Apache',
'https://raw.githubusercontent.com/graphite-project/graphite-web/master/LICENSE'
], [ ], [
'Grunt', 'Grunt',
'GruntJS Team', 'GruntJS Team',

@ -55,6 +55,7 @@
'pages/git', 'pages/git',
'pages/github', 'pages/github',
'pages/go', 'pages/go',
'pages/graphite',
'pages/haskell', 'pages/haskell',
'pages/jekyll', 'pages/jekyll',
'pages/jquery', 'pages/jquery',

@ -55,6 +55,7 @@
'pages/git', 'pages/git',
'pages/github', 'pages/github',
'pages/go', 'pages/go',
'pages/graphite',
'pages/haskell', 'pages/haskell',
'pages/jekyll', 'pages/jekyll',
'pages/jquery', 'pages/jquery',

@ -0,0 +1,26 @@
._graphite {
@extend %simple;
h1 {
@extend %lined-heading;
}
.section:first-child h1 {
margin-top: 0;
}
dl > dt {
@extend %note, %note-blue;
padding: 1px 0.5rem 2px 0.5rem;
font-weight: bold;
}
dl.function > dt {
code {
font-weight: bold;
}
em {
font-style: normal;
}
}
}

@ -0,0 +1,18 @@
module Docs
class Graphite
class CleanHtmlFilter < Filter
def call
# Remove the paragraph icon after all headers
css('.headerlink').remove
# Extract the text from function titles to get rid of the inconsistent styling
css('dl.function > dt').each do |node|
node['data-name'] = node.at_css('.descname').inner_html.to_s
node.content = node.text
end
doc
end
end
end
end

@ -0,0 +1,44 @@
module Docs
class Graphite
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').children[0].to_s
end
def get_type
get_name
end
def additional_entries
entries = []
# Sections
css('.section > .section').each do |node|
title = node.at_css('h2, h3')
next if title.nil?
# Move the id attribute to the title
# If this is excluded, the complete section will be highlighted in yellow when someone navigates to it
title['id'] = node['id']
node.remove_attribute('id')
parent_title_selector = "parent::div[@class='section']/preceding::#{title.name == 'h2' ? 'h1' : 'h2'}"
entries << [
title.children[0].to_s,
title['id'],
title.xpath(parent_title_selector).last.children[0].to_s
]
end
# Functions
css('dl.function > dt').each do |node|
entries << [node['data-name'], node['id'], 'List of functions']
end
entries
end
end
end
end

@ -0,0 +1,20 @@
module Docs
class Graphite < UrlScraper
self.type = 'graphite'
self.release = '1.1.3'
self.base_url = 'http://graphite.readthedocs.io/en/latest/'
self.links = {
code: 'https://github.com/graphite-project/graphite-web'
}
html_filters.push 'graphite/clean_html', 'graphite/entries'
options[:container] = '.document > div'
options[:skip] = %w(releases.html who-is-using.html composer.html search.html py-modindex.html genindex.html)
options[:attribution] = <<-HTML
&copy; 2008-2012 Chris Davis; 2011-2016 The Graphite Project<br>
Licensed under the Apache License, Version 2.0.
HTML
end
end
Loading…
Cancel
Save