Add Graphite documentation

pull/839/head
Jasper van Merle 7 years ago
parent 6ecd9d8cc2
commit db225290a3

2
.gitignore vendored

@ -8,3 +8,5 @@ public/fonts
public/docs/**/* public/docs/**/*
!public/docs/docs.json !public/docs/docs.json
!public/docs/**/index.json !public/docs/**/index.json
.idea
log

@ -290,6 +290,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',

@ -54,6 +54,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',

@ -54,6 +54,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,19 @@
._graphite {
@extend %simple;
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,45 @@
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').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')
entry = [title.children[0].to_s, title['id']]
# Separate sub-sections in additional types
if title.name == 'h3'
entry.push title.xpath('parent::div[@class="section"]/preceding::h2').last.children[0].to_s
end
entries << entry
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 > .section'
options[:skip] = %w(releases.html who-is-using.html composer.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