History

Vulkan API Reference

MACHIZAUD Andréa committed 9 years ago

Commit 2f62bca1 parent a4ba32e6 files · +90 −-2Browse files

Unified · Split

6 files
  1. lib/docs/filters/vulkan/clean_html.rb +14 −0
  2. lib/docs/filters/vulkan/entries.rb +42 −0
  3. lib/docs/scrapers/vulkan.rb +34 −0
  4. public/icons/docs/vulkan/16.png +0 −0
  5. public/icons/docs/vulkan/16@2x.png +0 −0
  6. public/icons/docs/vulkan/SOURCE +2 −0
lib/docs/filters/vulkan/clean_html.rb+14−0
@@ -0,0 +1,14 @@
1+module Docs
2+ class Vulkan
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Copyright is already added via attribution option
6+ css('#_copyright').map do |node|
7+ node.parent.remove
8+ end
9+
10+ doc
11+ end
12+ end
13+ end
14+end
lib/docs/filters/vulkan/entries.rb+42−0
@@ -0,0 +1,42 @@
1+module Docs
2+ class Vulkan
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('h1').content.strip
6+ name
7+ end
8+
9+ def get_type
10+ # As only documentation is single-paged, hardcode type
11+ initial_page? ? 'Vulkan' : 'Specifications'
12+ end
13+
14+ def include_default_entry?
15+ # additional_entries is responsible to extract relevant entries
16+ false
17+ end
18+
19+ def additional_entries
20+ if initial_page?
21+ # We pack each subsections into their corresponding category for apispec.html
22+ subsections = css('.sect2').map do |node|
23+ # Parse '.sect1' parent, to know what is the entry's type
24+ parent_node = node.parent.parent
25+ # Type is the parent's h2 header
26+ type = parent_node.at_css('h2').content.strip
27+ # Entry node is the one under h3
28+ header_node = node.at_css('h3')
29+ [header_node.content, header_node['id'], type]
30+ end
31+ else
32+ # We create a new category for vkspec.html page
33+ main_sections = css('.sect1').map do |node|
34+ # Entry node is the one under h2
35+ header_node = node.at_css('h2')
36+ [header_node.content, header_node['id'], 'Specifications']
37+ end
38+ end
39+ end
40+ end
41+ end
42+end
lib/docs/scrapers/vulkan.rb+34−0
@@ -0,0 +1,34 @@
1+module Docs
2+ # class Vulkan < FileScraper
3+ class Vulkan < UrlScraper
4+ self.name = 'Vulkan'
5+
6+ self.slug = 'vk'
7+ self.type = 'vulkan'
8+ self.links = {
9+ home: 'https://www.khronos.org/registry/vulkan/specs/',
10+ code: 'https://github.com/KhronosGroup/Vulkan-Docs'
11+ }
12+
13+ self.root_path = 'apispec.html'
14+
15+ self.release = '1.0.56'
16+ # self.dir = '/mnt/d/theblackunknown/Documents/GitHub/Vulkan-Docs/out/1.0/'
17+ self.base_url = 'https://www.khronos.org/registry/vulkan/specs/1.0/'
18+
19+ html_filters.push 'vulkan/entries', 'vulkan/clean_html'
20+
21+ # in apispec.html, skip #header and #footer
22+ options[:container] = '#content'
23+
24+ # If we only want API, we should skip this one
25+ options[:skip] = %w(
26+ html/vkspec.html
27+ )
28+
29+ options[:attribution] = <<-HTML
30+ Copyright &copy; 2014-2017 Khronos Group. <br>
31+ This work is licensed under a Creative Commons Attribution 4.0 International License
32+ HTML
33+ end
34+end
public/icons/docs/vulkan/16.png+0−0

Binary file not shown.

public/icons/docs/vulkan/16@2x.png+0−0

Binary file not shown.

public/icons/docs/vulkan/SOURCE+2−0
@@ -0,0 +1,2 @@
1+01_Vulkan_Icon_RGB_Aug1.svg hand-made, credit to Anne-Sophie BOSSÉ
2+Usage granted by James Riordon, Khronos Group Webmaster, until their Marketing have the time to review it