mirror of https://github.com/freeCodeCamp/devdocs
The associated filter categorizes all API docs under a single "API reference" type. I originally had a separate type per class (the godot API docs are organized by class), but that resulted in >300 types.pull/656/head
parent
1c6c7c06e1
commit
d69f4f6473
@ -0,0 +1,11 @@
|
||||
module Docs
|
||||
class Godot
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('.document .section')
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
module Docs
|
||||
class Godot
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('.document h1').content
|
||||
name.remove! "\u{00B6}" # Remove the pilcrow
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
if slug.start_with?('learning')
|
||||
'Learning'
|
||||
else
|
||||
'API Reference'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless slug.start_with?('classes')
|
||||
class_name = at_css('h1').content
|
||||
class_name.remove! "\u{00B6}" # Remove the pilcrow
|
||||
entries = []
|
||||
|
||||
# Each page represents a class, and class methods are defined in
|
||||
# individual sections.
|
||||
css('.simple[id]').each do |node|
|
||||
fn_name = node.at_css('strong')
|
||||
entries << [class_name + '.' + fn_name + '()', node['id']]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,25 @@
|
||||
module Docs
|
||||
class Godot < UrlScraper
|
||||
self.type = 'sphinx_simple'
|
||||
self.links = {
|
||||
home: 'https://godotengine.org/',
|
||||
code: 'https://github.com/godotengine/godot'
|
||||
}
|
||||
|
||||
html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
|
||||
|
||||
# `learning/` contains the guided learning materials, and `classes/`
|
||||
# contains the API reference.
|
||||
options[:only_patterns] = [/\Alearning\//, /\Aclasses\//]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© Copyright 2014–2017, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0).
|
||||
HTML
|
||||
|
||||
version '2.1' do
|
||||
self.release = '2.1'
|
||||
self.base_url = "http://docs.godotengine.org/en/#{self.version}/"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1 @@
|
||||
https://godotengine.org/themes/godotengine/assets/favicon.png
|
Loading…
Reference in new issue