-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
also: - blacklisted schema 0.7.5 because it's broken
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.5.2 | ||
0.5.3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -640,6 +640,40 @@ def _postprocess_xml(context): | |
changed = True | ||
break | ||
|
||
# fix functions where keywords like 'friend' have been erroneously included in the return type | ||
if 1: | ||
members = [m for m in section.findall(r'memberdef') if m.get(r'kind') in (r'friend', r'function')] | ||
keywords_behaving_badly = ( | ||
(r'constexpr ', r'constexpr', r'yes'), | ||
(r'consteval ', r'constexpr', r'yes'), | ||
(r'explicit ', r'explicit', r'yes'), | ||
(r'static ', r'static', r'yes'), | ||
(r'friend ', None, None), | ||
(r'inline ', r'inline', r'yes'), | ||
) | ||
for member in members: | ||
type = member.find(r'type') | ||
if type is None or type.text is None: | ||
continue | ||
matched_bad_keyword = True | ||
removed_constexpr = False | ||
while matched_bad_keyword: | ||
matched_bad_keyword = False | ||
for kw, attr, attr_value in keywords_behaving_badly: | ||
if type.text.startswith(kw): | ||
matched_bad_keyword = True | ||
changed = True | ||
type.text = type.text[len(kw):] | ||
if attr is not None: | ||
member.set(attr, attr_value) | ||
elif kw == r'friend ': | ||
member.set(r'kind', r'friend') | ||
if kw == r'constexpr ': | ||
removed_constexpr = True | ||
# hack: m.css seems to need 'constexpr' to be a part of the type and ignores the xml attribute O_o | ||
if removed_constexpr and not context.xml_only: | ||
type.text = rf'constexpr {type.text}' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mosra
|
||
|
||
# re-sort members to override Doxygen's weird and stupid sorting 'rules' | ||
if 1: | ||
sort_members_by_name = lambda tag: tag.find(r'name').text | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ pygments | |
html5lib | ||
lxml | ||
pytomlpp | ||
schema | ||
schema!=0.7.5 |
@mosra I forgot to ping you about this, only just remembered it re-reading the code now. The gist of it is that this code is fixing the XML in situations where Doxygen has mistakenly included some specifier/attribute as part of the type (e.g.
constexpr float
instead of justfloat
), removing it and setting the corresponding XML attribute instead.The
# hack:
bit deals with an edge case wherem.css
seemed to actually break when I did this forconstexpr
specifically, ignoring the doxygen XML attributeconstexpr="yes"
, and instead assumed that doxygen always got it wrong in the XML. It didn't happen in all cases,I think maybe only when the function was also afriend
or similar? My guess was that the doxygen attribute is newer and m.css wasn't aware of it (or at least wasn't in the fork I'm using)When I spend some time with poxy this weekend I'll try to give you a proper repro/bug report.