Add Opengl documentation (gl4 + gl2.1)
Unified · Split
| @@ -1,4 +1,8 @@ | |||
| 1 | [ | 1 | [ |
| 2 | [ | ||
| 3 | "2024-07-28", | ||
| 4 | "New documentation: <a href=\"/opengl/\">OpenGL</a>" | ||
| 5 | ], | ||
| 2 | [ | 6 | [ |
| 3 | "2024-06-12", | 7 | "2024-06-12", |
| 4 | "New documentations: <a href=\"/nextjs/\">Next.js</a>, <a href=\"/click/\">click</a>" | 8 | "New documentations: <a href=\"/nextjs/\">Next.js</a>, <a href=\"/click/\">click</a>" |
| @@ -161,6 +161,19 @@ curl https://v2.ocaml.org/releases/$VERSION/ocaml-$VERSION-refman-html.tar.gz | · 160 unmodified lines | |||
| 161 | tar xz --transform 's/htmlman/ocaml/' --directory docs/ | 161 | tar xz --transform 's/htmlman/ocaml/' --directory docs/ |
| 162 | ``` | 162 | ``` |
| 163 | 163 | ||
| 164 | ## Opengl | ||
| 165 | |||
| 166 | Clone https://github.com/KhronosGroup/OpenGL-Refpages.git | ||
| 167 | |||
| 168 | ```sh | ||
| 169 | DEVDOCS_ROOT=/path/to/devdocs | ||
| 170 | git clone https://github.com/KhronosGroup/OpenGL-Refpages.git | ||
| 171 | mkdir $DEVDOCS_ROOT/docs/opengl~4 | ||
| 172 | mkdir $DEVDOCS_ROOT/docs/opengl~2.1 | ||
| 173 | cp -r OpenGL-Refpages/gl4/html/* "$DEVDOCS_ROOT/docs/opengl~4" | ||
| 174 | cp -r OpenGL-Refpages/gl2.1/xhtml/* "$DEVDOCS_ROOT/docs/opengl~2.1" | ||
| 175 | ``` | ||
| 176 | |||
| 164 | ## OpenJDK | 177 | ## OpenJDK |
| 165 | Search 'Openjdk' in https://www.debian.org/distrib/packages, find the `openjdk-$VERSION-doc` package, | 178 | Search 'Openjdk' in https://www.debian.org/distrib/packages, find the `openjdk-$VERSION-doc` package, |
| 166 | download it, extract it with `dpkg -x $PACKAGE ./` and move `./usr/share/doc/openjdk-16-jre-headless/api/` | 179 | download it, extract it with `dpkg -x $PACKAGE ./` and move `./usr/share/doc/openjdk-16-jre-headless/api/` |
| @@ -0,0 +1,32 @@ | |||
| 1 | module Docs | ||
| 2 | class Opengl | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | return '<h1>OpenGL</h1>' if root_page? | ||
| 6 | |||
| 7 | @doc = at_css('.refentry') if at_css('.refentry') | ||
| 8 | |||
| 9 | # Remove table from function definitions | ||
| 10 | css('.funcprototype-table').each do |node| | ||
| 11 | node.css('td').each do |data| | ||
| 12 | data.replace(data.children) | ||
| 13 | end | ||
| 14 | node.css('tr').each do |row| | ||
| 15 | row.replace(row.children) | ||
| 16 | end | ||
| 17 | node.wrap('<div>') | ||
| 18 | node.parent['id'] = node.css('.fsfunc').text | ||
| 19 | node.replace(node.children) | ||
| 20 | end | ||
| 21 | |||
| 22 | css('a').remove_attribute('target') | ||
| 23 | |||
| 24 | # needed for scraper's options[:attribution] | ||
| 25 | copyright = at_css('h2:contains("Copyright")') | ||
| 26 | copyright.parent['style'] = 'display: none' if copyright | ||
| 27 | |||
| 28 | doc | ||
| 29 | end | ||
| 30 | end | ||
| 31 | end | ||
| 32 | end | ||
| @@ -0,0 +1,25 @@ | |||
| 1 | module Docs | ||
| 2 | class Opengl | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | slug.chomp('.xhtml').chomp('.xml') | ||
| 6 | end | ||
| 7 | |||
| 8 | # gl4 also has documentation of GLSL, this string is present under Version Support | ||
| 9 | def get_type | ||
| 10 | return 'GLSL' if html.include?('OpenGL Shading Language Version') | ||
| 11 | 'OpenGL' | ||
| 12 | end | ||
| 13 | |||
| 14 | # functions like glUniform1f, glUniform2f, glUniform... have the same documentation | ||
| 15 | def additional_entries | ||
| 16 | entries = [] | ||
| 17 | css('.fsfunc').each do |function| | ||
| 18 | next if function.text == name | ||
| 19 | entries << [ function.text, function.text ] | ||
| 20 | end | ||
| 21 | entries | ||
| 22 | end | ||
| 23 | end | ||
| 24 | end | ||
| 25 | end | ||
| @@ -0,0 +1,31 @@ | |||
| 1 | module Docs | ||
| 2 | class Opengl < FileScraper | ||
| 3 | self.type = 'simple' | ||
| 4 | self.name = 'OpenGL' | ||
| 5 | self.root_path = 'index.php' | ||
| 6 | self.links = { | ||
| 7 | home: 'https://registry.khronos.org/OpenGL-Refpages/' | ||
| 8 | } | ||
| 9 | html_filters.push 'opengl/entries', 'opengl/clean_html' | ||
| 10 | |||
| 11 | # indexflat.php is a copy of index.php | ||
| 12 | options[:skip] = %w(indexflat.php) | ||
| 13 | |||
| 14 | options[:attribution] = ->(filter) { | ||
| 15 | # copyright is the last section in these pages | ||
| 16 | return filter.css('h2:contains("Copyright") ~ p').inner_text | ||
| 17 | } | ||
| 18 | |||
| 19 | version '4' do | ||
| 20 | self.root_path = 'index.php' | ||
| 21 | self.release = '4' | ||
| 22 | self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/" | ||
| 23 | end | ||
| 24 | |||
| 25 | version '2.1' do | ||
| 26 | self.root_path = 'index.html' | ||
| 27 | self.release = '2.1' | ||
| 28 | self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/" | ||
| 29 | end | ||
| 30 | end | ||
| 31 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://www.khronos.org/legal/trademarks/ | ||