-
Notifications
You must be signed in to change notification settings - Fork 493
Code documentation support #471
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
base: glad2
Are you sure you want to change the base?
Conversation
3ac71f0 to
3a15146
Compare
Forgot to add spaces when listing ('-') <dt> elements.
Also, the regex was improperly removing contiguous line breaks.
|
Thanks for putting in the work, initial thoughts:
|
Seems good to me. I'll be replacing DocsGL with that source. I understand that docs.gl is more a community driven documentation than a strict reference. I was also consider shipping both, but from a maintainer point of view docs.gl is not convenient. Working on resolving the other requested changes :) |
I assumed it is based on the same OpenGL-Refpages repo just already processed for better display on docs.gl but without additional curation. |
See https://docs.gl/about.html. It adds additional information to the official specs (even typo fixes) and allows contributions, but yeah, what was said about maintenance still holds. Still working on parsing Khronos reference. |
I needed the 'recover' kwarg, since some xml files were broken. See <https://lxml.de/api/lxml.etree.XMLParser-class.html>.
Dav1dde
left a comment
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.
Thanks for putting in all the work and sorry for being so unresponsive slow, I just don't have the mental bandwidth atm.
- load lxml module first, and fallback to xml module - don't extract zip file to parse the documents - fix other formatting issues that I encountered
No worries, thank you for taking the time to review it. I'm dogfooding this docs while I'm working in some OpenGL projects, so I'll be pushing fixes as I encounter more issues. For now I've implemented the requested changes. Wish the code was more elegant, but Khronos really worked hard to make their documentation format a parsing nightmare haha. |
|
Hello, apologies for reviving this old thread, but are the changes from this branch going to be added to the default branch? I'd love to have documentation generated and visible when hovering over functions to make development a little easier. |
|
Just an update on the OpenGL-RefPages situation. Khronos (perhaps understandably) hasn't been paying too much attention to the repo, but I pinged Jon Leech of Khronos last week, and he got the GL 4.6 pages and many, many other pending pull requests merged. There are still a couple PRs (glGet args, min tex sizes) with fixes pending, but now the original source is much more up-to-date. (BTW: I added GLAD to the OpenGL-RefPages tools list on the index page) |
|
Anyway, I have tested this branch against the updated specification, and it seems to work after the following changes:
diff --git a/glad/util.py b/glad/util.py
index bc5ca54..ff07843 100644
--- a/glad/util.py
+++ b/glad/util.py
@@ -267,6 +267,8 @@ math_symbols_map = {
'⌉': '⌉',
'∥': '∥',
'∣': '|',
+ '{': '{',
+ '}': '}',
}Probably the handling of entities could be made more robust. |
|
The main deficiency I see with this branch at this point, is that the I can see that 'docs' is not present in the |
|
Thanks for putting in the work! I've implemented the two changes you mentioned, but don't currently have the time to check the Happy to see this branch getting some attention again :) |

This PR adds support for optional code documentation as requested in #247.
Basically,
Specificationclasses can now include documentation from a language-agnosticSpecificationDocsclass, which knows how to retrieve and parse the specs documentation from a specific source.As a proof of concept I've implemented the
OpenGLRefpages(SpecificationDocs)class for theOpen GL Refpagesspecification, using https://github.com/KhronosGroup/OpenGL-Refpages as source. OpenGL-Refpages was definitely not created to be parser-friendly, but I managed to properly parse all the commands docs (without including tables and code blocks for now).Additional sources will be needed for other specifications. Currently I'm only planning to contribute with the GL spec docs. Others can be added later with no problems.
Looking forward to feedback and willing to implement any requested modification. Thanks!
Test with:
Thinks to know:
--docsflag is present. If the given specification doesn't support docs, only a warning is shown.