diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index 39b2883c..b964b557 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,4 +1,8 @@
[
+ [
+ "2024-07-28",
+ "New documentation: OpenGL"
+ ],
[
"2024-06-12",
"New documentations: Next.js, click"
diff --git a/lib/docs/filters/opengl/clean_html.rb b/lib/docs/filters/opengl/clean_html.rb
index c7f300c5..60c870bf 100644
--- a/lib/docs/filters/opengl/clean_html.rb
+++ b/lib/docs/filters/opengl/clean_html.rb
@@ -2,7 +2,11 @@ module Docs
class Opengl
class CleanHtmlFilter < Filter
def call
- # Rmeove table from function definitions
+ return '
OpenGL
' if root_page?
+
+ @doc = at_css('.refentry') if at_css('.refentry')
+
+ # Remove table from function definitions
css('.funcprototype-table').each do |node|
node.css('td').each do |data|
data.replace(data.children)
@@ -15,6 +19,12 @@ module Docs
node.replace(node.children)
end
+ css('a').remove_attribute('target')
+
+ # needed for scraper's options[:attribution]
+ copyright = at_css('h2:contains("Copyright")')
+ copyright.parent['style'] = 'display: none' if copyright
+
doc
end
end
diff --git a/lib/docs/filters/opengl/entries.rb b/lib/docs/filters/opengl/entries.rb
index 0b56c7ee..32ae2e3c 100644
--- a/lib/docs/filters/opengl/entries.rb
+++ b/lib/docs/filters/opengl/entries.rb
@@ -15,6 +15,7 @@ module Docs
def additional_entries
entries = []
css('.fsfunc').each do |function|
+ next if function.text == name
entries << [ function.text, function.text ]
end
entries
diff --git a/lib/docs/scrapers/opengl.rb b/lib/docs/scrapers/opengl.rb
index 6ad6ee03..e860625f 100644
--- a/lib/docs/scrapers/opengl.rb
+++ b/lib/docs/scrapers/opengl.rb
@@ -1,6 +1,7 @@
module Docs
class Opengl < FileScraper
self.type = 'simple'
+ self.name = 'OpenGL'
self.root_path = 'index.php'
self.links = {
home: 'https://registry.khronos.org/OpenGL-Refpages/'
@@ -12,18 +13,19 @@ module Docs
options[:attribution] = ->(filter) {
# copyright is the last section in these pages
- return filter.css('.refsect1:last-child').css('p').inner_text
+ return filter.css('h2:contains("Copyright") ~ p').inner_text
}
- version '2.1' do
- self.root_path = 'index.html'
- self.release = '2.1'
- self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/"
- end
version '4' do
self.root_path = 'index.php'
self.release = '4'
self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/"
end
+
+ version '2.1' do
+ self.root_path = 'index.html'
+ self.release = '2.1'
+ self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/"
+ end
end
end