From 2f62bca5e4259d8dae045b3cf7be9173f1fa9b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MACHIZAUD=20Andr=C3=A9a?= Date: Sat, 29 Jul 2017 23:18:23 +0200 Subject: [PATCH] Vulkan API Reference --- lib/docs/filters/vulkan/clean_html.rb | 14 +++++++++ lib/docs/filters/vulkan/entries.rb | 42 ++++++++++++++++++++++++++ lib/docs/scrapers/vulkan.rb | 34 +++++++++++++++++++++ public/icons/docs/vulkan/16.png | Bin 0 -> 1372 bytes public/icons/docs/vulkan/16@2x.png | Bin 0 -> 1172 bytes public/icons/docs/vulkan/SOURCE | 2 ++ 6 files changed, 92 insertions(+) create mode 100644 lib/docs/filters/vulkan/clean_html.rb create mode 100644 lib/docs/filters/vulkan/entries.rb create mode 100644 lib/docs/scrapers/vulkan.rb create mode 100644 public/icons/docs/vulkan/16.png create mode 100644 public/icons/docs/vulkan/16@2x.png create mode 100644 public/icons/docs/vulkan/SOURCE 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 0000000000000000000000000000000000000000..a917a92df278114d3ccd86fa07e022c6e517548d GIT binary patch literal 1372 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>^>xPct&t1EaJ7;64c z1+oQPn>`1SvX>nD$%IJ2it6Ucx5|J$tcN}1S6;lAA)ON1Dn{huy; z=zH+tf8GoXQt5T_iEqmoCj39}@v1mTx2hL|U%#;DkN^LtaHt6a1%TN_Qbzph|3BUa zwSgdKfB<9Zo&};OkH}&M20djE zW~^9hUj`IpFY)wsWq-)Q$iX1^cd>mYQ0RlFi(`ny<>Ukh_8y-zI%{&?$jphkW3xwr z(XNisQ87_4(6ErxQ*%PYmYy|p_B1V;w5e;=EGrKO=V0$>_i+FF2QHkr!J?9om6n&7 znVOrNo&Ns8izjCeJb3i#*}I1?pT2$k`nkM-gvc2IAt^CAK}k_rVQKOC6J|^~Ghx!K zY4aw|oH}>%?CJ3V5g}&+f}+CW0wY6XgQLUmU$}AQ%!Nz0uHCzM^XlEpx3AkLK3Z~; zCwQ6PY`f%VYi<@lJ2!iO!ox*JdAz6TMej>`y6S57wRO?^6P0h6&o;}yxhwZ~-`w40 z?{9K{yua@+JD;3Y&65`!AM->oFxbfY?&V$kV~ZCyIvL{FKbJN)!ziKy_Az<`4}A#swFF8YDqB t1m~xflqVLYGL)B>>t*I;7bhncr0V4trO$q6BL!5%;OXk;vd$@?2>|op!lM8H literal 0 HcmV?d00001 diff --git a/public/icons/docs/vulkan/16@2x.png b/public/icons/docs/vulkan/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..022b838ac5ec64dd682a03a9de2c334672c73e3f GIT binary patch literal 1172 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmUKs7M+SzC{oH>NSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fg!ItFh?!xdN1Q+aGJ{c&& zS>O>_%)p?h48n{ROYO^mg6t)pzOL*KIT$$@1ph9!&tza=j`MVJ42d}W_S)_2m{1Y6 z5BEDi25tT7B-|=;RBY{w1uJfNIj(jM?5xPX!2Z62V_!#oLw{FOg=0;iOGu68M*n3I ztXuDGolwv_L+1|O^E$1S zz?-KdTW3D+_H`kwaSJaxfM{oOPUw<&e%<$JD zrq-(;*wUUcFOX$7dz|*>FiYJ5C7-P?s$H|96O(^r*qwaM5XJJB;ksAMt7Cx{y7MG` zJpcaXj(?ywr}gTM=J^jF*f6B{p7cMc71LC#{Ls_FtRZE^qxl~D#CLCCzJKKXx)rw+ zueI$dW$-TK&pUpz@KNgxmTiw?_jKl3T;TLDyAd7Pn112D;)f+yZg2G16t8r9qJ^NX z5Py})v2vrRpG6Hf!~It&2HZ@@e_GmEaCTa9gw)FKAET%I6YpeqPj+RP*(dhZ<#pKc z%|WxaeE+b-<=w9mo}T^_Y}MNAXXG||+BAwQd)Bk8d30{Yk*5`=d|%k@4m&@b%{rr7 zwei()p*>CRhEXc7rk#jl3pkv-@nee3QbjLg!4jVE#K<+@A6jQxb-n6M=9s-mXgli< z?hguf;!h>Btp0wV^rdTZuJ+&Sz1oFL>oS;ZMcOmfqU0XPO=EehZPUKh^?-W;-#PAf z+lf00?)B_8amnVr*6N?Q_{WAhTX`0lyt@67A@9K6ADbl(Z>?ZVKenvY(QJ~~9^n{; zv;PhBuI?x`cj9(v)%b`{F5nZIMN#c$wF$useIaRhsmseMyn1TrPHoa{=d(rW`-MGpUvHw$|QKTRHKx zwVHiSJMTZ%sb$<^lUE3o0yCd#iEBhjN@7W>RdP`(kYX@0Ff`XSu+TLy3^6dbGBL3- zw9qy%vNABxOxfp&q9HdwB{QuOMS}%Uot2?EM1z5G!9}13NstY}`DrEPiAAXl<>lpi gnR(g8$%zH2dih1^v)|cB0TnTLy85}Sb4q9e02-9_=Kufz literal 0 HcmV?d00001 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