-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Opengl documentation (gl4 + gl2.1) #2136
Open
Suraj-Yadav
wants to merge
2
commits into
freeCodeCamp:main
Choose a base branch
from
Suraj-Yadav:opengl
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Docs | ||
class Opengl | ||
class CleanHtmlFilter < Filter | ||
def call | ||
# Rmeove table from function definitions | ||
css('.funcprototype-table').each do |node| | ||
node.css('td').each do |data| | ||
data.replace(data.children) | ||
end | ||
node.css('tr').each do |row| | ||
row.replace(row.children) | ||
end | ||
node.wrap('<div>') | ||
node.parent['id'] = node.css('.fsfunc').text | ||
node.replace(node.children) | ||
end | ||
|
||
doc | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Docs | ||
class Opengl | ||
class EntriesFilter < Docs::EntriesFilter | ||
def get_name | ||
slug.chomp('.xhtml').chomp('.xml') | ||
end | ||
|
||
# gl4 also has documentation of GLSL, this string is present under Version Support | ||
def get_type | ||
return 'GLSL' if html.include?('OpenGL Shading Language Version') | ||
'OpenGL' | ||
end | ||
|
||
# functions like glUniform1f, glUniform2f, glUniform... have the same documentation | ||
def additional_entries | ||
entries = [] | ||
css('.fsfunc').each do |function| | ||
entries << [ function.text, function.text ] | ||
end | ||
entries | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Docs | ||
class Opengl < FileScraper | ||
self.type = 'simple' | ||
self.root_path = 'index.php' | ||
self.links = { | ||
home: 'https://registry.khronos.org/OpenGL-Refpages/' | ||
} | ||
html_filters.push 'opengl/entries', 'opengl/clean_html' | ||
|
||
# indexflat.php is a copy of index.php | ||
options[:skip] = %w(indexflat.php) | ||
|
||
options[:attribution] = <<-HTML | ||
Copyright 2017-2021 The Khronos Group, Inc.. This work is licensed | ||
under a <a href="http://creativecommons.org/licenses/by/4.0/">Creative | ||
Commons Attribution 4.0 International License</a>. | ||
HTML | ||
|
||
version 'gl2.1' do | ||
self.root_path = 'index.html' | ||
self.release = 'gl2.1' | ||
self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/" | ||
end | ||
version 'gl4' do | ||
Suraj-Yadav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.root_path = 'index.php' | ||
self.release = 'gl4' | ||
self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/" | ||
end | ||
|
||
def get_latest_version(opts) | ||
return 'v1.0.0' | ||
Suraj-Yadav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
end | ||
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://www.khronos.org/legal/trademarks/ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contradicts the licenses mentioned on https://github.com/KhronosGroup/OpenGL-Refpages#licenses
https://registry.khronos.org/OpenGL-Refpages/gl4/html/barrier.xhtml mentions "Open Publication License", https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBlendColor.xhtml mentions "SGI Free Software B License"
See the
lib/docs/scrapers/crystal.rb
scraper how to output different licenses depending on the URL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have written logic to extract copyright from the page, but I am getting this warning
Docs::AttributionFilter is re-parsing the document.
Unfortunately, I don't think there is any way to do this without parsing the document, as the value changes without any pattern in the URL.