mirror of https://github.com/freeCodeCamp/devdocs
parent
a4ba32ebca
commit
2f62bca5e4
@ -0,0 +1,14 @@
|
|||||||
|
module Docs
|
||||||
|
class Vulkan
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
# Copyright is already added via attribution option
|
||||||
|
css('#_copyright').map do |node|
|
||||||
|
node.parent.remove
|
||||||
|
end
|
||||||
|
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,42 @@
|
|||||||
|
module Docs
|
||||||
|
class Vulkan
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
def get_name
|
||||||
|
name = at_css('h1').content.strip
|
||||||
|
name
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
# As only documentation is single-paged, hardcode type
|
||||||
|
initial_page? ? 'Vulkan' : 'Specifications'
|
||||||
|
end
|
||||||
|
|
||||||
|
def include_default_entry?
|
||||||
|
# additional_entries is responsible to extract relevant entries
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
|
def additional_entries
|
||||||
|
if initial_page?
|
||||||
|
# We pack each subsections into their corresponding category for apispec.html
|
||||||
|
subsections = css('.sect2').map do |node|
|
||||||
|
# Parse '.sect1' parent, to know what is the entry's type
|
||||||
|
parent_node = node.parent.parent
|
||||||
|
# Type is the parent's h2 header
|
||||||
|
type = parent_node.at_css('h2').content.strip
|
||||||
|
# Entry node is the one under h3
|
||||||
|
header_node = node.at_css('h3')
|
||||||
|
[header_node.content, header_node['id'], type]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# We create a new category for vkspec.html page
|
||||||
|
main_sections = css('.sect1').map do |node|
|
||||||
|
# Entry node is the one under h2
|
||||||
|
header_node = node.at_css('h2')
|
||||||
|
[header_node.content, header_node['id'], 'Specifications']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,34 @@
|
|||||||
|
module Docs
|
||||||
|
# class Vulkan < FileScraper
|
||||||
|
class Vulkan < UrlScraper
|
||||||
|
self.name = 'Vulkan'
|
||||||
|
|
||||||
|
self.slug = 'vk'
|
||||||
|
self.type = 'vulkan'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://www.khronos.org/registry/vulkan/specs/',
|
||||||
|
code: 'https://github.com/KhronosGroup/Vulkan-Docs'
|
||||||
|
}
|
||||||
|
|
||||||
|
self.root_path = 'apispec.html'
|
||||||
|
|
||||||
|
self.release = '1.0.56'
|
||||||
|
# self.dir = '/mnt/d/theblackunknown/Documents/GitHub/Vulkan-Docs/out/1.0/'
|
||||||
|
self.base_url = 'https://www.khronos.org/registry/vulkan/specs/1.0/'
|
||||||
|
|
||||||
|
html_filters.push 'vulkan/entries', 'vulkan/clean_html'
|
||||||
|
|
||||||
|
# in apispec.html, skip #header and #footer
|
||||||
|
options[:container] = '#content'
|
||||||
|
|
||||||
|
# If we only want API, we should skip this one
|
||||||
|
options[:skip] = %w(
|
||||||
|
html/vkspec.html
|
||||||
|
)
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
Copyright © 2014-2017 Khronos Group. <br>
|
||||||
|
This work is licensed under a Creative Commons Attribution 4.0 International License
|
||||||
|
HTML
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,2 @@
|
|||||||
|
01_Vulkan_Icon_RGB_Aug1.svg hand-made, credit to Anne-Sophie BOSSÉ
|
||||||
|
Usage granted by James Riordon, Khronos Group Webmaster, until their Marketing have the time to review it
|
Loading…
Reference in new issue