Skip to content

Commit 49cb077

Browse files
committed
Add Opengl documentation (gl4 + gl2.1)
1 parent ef799d1 commit 49cb077

File tree

7 files changed

+94
-0
lines changed

7 files changed

+94
-0
lines changed

docs/file-scrapers.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ curl https://v2.ocaml.org/releases/$VERSION/ocaml-$VERSION-refman-html.tar.gz |
161161
tar xz --transform 's/htmlman/ocaml/' --directory docs/
162162
```
163163

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~gl4
172+
mkdir $DEVDOCS_ROOT/docs/opengl~gl2.1
173+
cp -r OpenGL-Refpages/gl4/html/* "$DEVDOCS_ROOT/docs/opengl~gl4"
174+
cp -r OpenGL-Refpages/gl2.1/xhtml/* "$DEVDOCS_ROOT/docs/opengl~gl2.1"
175+
```
176+
164177
## OpenJDK
165178
Search 'Openjdk' in https://www.debian.org/distrib/packages, find the `openjdk-$VERSION-doc` package,
166179
download it, extract it with `dpkg -x $PACKAGE ./` and move `./usr/share/doc/openjdk-16-jre-headless/api/`

lib/docs/filters/opengl/clean_html.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module Docs
2+
class Opengl
3+
class CleanHtmlFilter < Filter
4+
def call
5+
# Rmeove table from function definitions
6+
css('.funcprototype-table').each do |node|
7+
node.css('td').each do |data|
8+
data.replace(data.children)
9+
end
10+
node.css('tr').each do |row|
11+
row.replace(row.children)
12+
end
13+
node.wrap('<div>')
14+
node.parent['id'] = node.css('.fsfunc').text
15+
node.replace(node.children)
16+
end
17+
18+
doc
19+
end
20+
end
21+
end
22+
end

lib/docs/filters/opengl/entries.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
entries << [ function.text, function.text ]
19+
end
20+
entries
21+
end
22+
end
23+
end
24+
end

lib/docs/scrapers/opengl.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module Docs
2+
class Opengl < FileScraper
3+
self.type = 'simple'
4+
self.root_path = 'index.php'
5+
self.links = {
6+
home: 'https://registry.khronos.org/OpenGL-Refpages/'
7+
}
8+
html_filters.push 'opengl/entries', 'opengl/clean_html'
9+
10+
# indexflat.php is a copy of index.php
11+
options[:skip] = %w(indexflat.php)
12+
13+
options[:attribution] = <<-HTML
14+
Copyright 2017-2021 The Khronos Group, Inc.. This work is licensed
15+
under a <a href="http://creativecommons.org/licenses/by/4.0/">Creative
16+
Commons Attribution 4.0 International License</a>.
17+
HTML
18+
19+
version 'gl2.1' do
20+
self.root_path = 'index.html'
21+
self.release = 'gl2.1'
22+
self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/"
23+
end
24+
version 'gl4' do
25+
self.root_path = 'index.php'
26+
self.release = 'gl4'
27+
self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/"
28+
end
29+
30+
def get_latest_version(opts)
31+
return 'v1.0.0'
32+
end
33+
end
34+
end

public/icons/docs/opengl/16.png

416 Bytes
Loading
559 Bytes
Loading

public/icons/docs/opengl/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.khronos.org/legal/trademarks/

0 commit comments

Comments
 (0)