File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 © 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments