diff --git a/lib/docs/filters/vulkan/clean_html.rb b/lib/docs/filters/vulkan/clean_html.rb new file mode 100644 index 00000000..b2e0a8a2 --- /dev/null +++ b/lib/docs/filters/vulkan/clean_html.rb @@ -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 diff --git a/lib/docs/filters/vulkan/entries.rb b/lib/docs/filters/vulkan/entries.rb new file mode 100644 index 00000000..973b274d --- /dev/null +++ b/lib/docs/filters/vulkan/entries.rb @@ -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 diff --git a/lib/docs/scrapers/vulkan.rb b/lib/docs/scrapers/vulkan.rb new file mode 100644 index 00000000..0140f09f --- /dev/null +++ b/lib/docs/scrapers/vulkan.rb @@ -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.
+ This work is licensed under a Creative Commons Attribution 4.0 International License + HTML + end +end diff --git a/public/icons/docs/vulkan/16.png b/public/icons/docs/vulkan/16.png new file mode 100644 index 00000000..a917a92d Binary files /dev/null and b/public/icons/docs/vulkan/16.png differ diff --git a/public/icons/docs/vulkan/16@2x.png b/public/icons/docs/vulkan/16@2x.png new file mode 100644 index 00000000..022b838a Binary files /dev/null and b/public/icons/docs/vulkan/16@2x.png differ diff --git a/public/icons/docs/vulkan/SOURCE b/public/icons/docs/vulkan/SOURCE new file mode 100644 index 00000000..7deef193 --- /dev/null +++ b/public/icons/docs/vulkan/SOURCE @@ -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