Update OpenGL documentation (4)

pull/2136/head
Simon Legner 6 months ago
parent 20840ba127
commit d3a731d5d0

@ -1,4 +1,8 @@
[
[
"2024-07-28",
"New documentation: <a href=\"/opengl/\">OpenGL</a>"
],
[
"2024-06-12",
"New documentations: <a href=\"/nextjs/\">Next.js</a>, <a href=\"/click/\">click</a>"

@ -2,7 +2,11 @@ module Docs
class Opengl
class CleanHtmlFilter < Filter
def call
# Rmeove table from function definitions
return '<h1>OpenGL</h1>' 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

@ -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

@ -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

Loading…
Cancel
Save