Skip to content

Commit

Permalink
fixed crash regression with Doxygen 1.9.7
Browse files Browse the repository at this point in the history
also:
-   fixed issues with [tag] substitution
-   minor style fixes
  • Loading branch information
marzer committed Jul 29, 2023
1 parent 3dee872 commit fe0905d
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 132 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.13.1 - 2023-07-29

- fixed crash regression with Doxygen 1.9.7
- fixed issues with \[tag\] substitution
- minor style fixes

## v0.13.0 - 2023-07-28

- migrated to `pyproject.toml`
Expand Down
13 changes: 11 additions & 2 deletions src/poxy/css/poxy-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ a:hover {
}

article div > section {
margin-top: 2rem;
margin-top: 2.5rem;
}
article div > section:first-of-type {
margin-top: initial;
}
article div > section > section {
margin-bottom: 2.25rem;
margin-top: 2.25rem;
}
article div > section > section:first-of-type {
margin-top: initial;
}

a.poxy-external {
Expand Down Expand Up @@ -397,6 +403,9 @@ section.m-doc-details div .m-table.m-fullwidth.m-flat tbody td:first-of-type wbr
}

/* support for those pretty "about the author" blocks as seen in other m.css pages */
.poxy-about-the-author {
margin-top: 4rem;
}
.poxy-about-the-author .socials {
display: block;
padding-top: 0.5rem;
Expand Down
26 changes: 20 additions & 6 deletions src/poxy/doxygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,22 @@ def test_path(p):
return path.val


def version() -> str:
def version() -> tuple[int, int, int]:
if not hasattr(version, "val"):
proc = subprocess.run([str(path()), r'--version'], capture_output=True, encoding=r'utf-8', check=True)
ret = proc.stdout.strip() if proc.stdout is not None else ''
if not ret and proc.stderr.strip():
raise Error(rf'doxygen exited with error: {proc.stderr.strip()}')
version.val = ret
ret = re.fullmatch(r'\s*[v]?\s*([0-9]+)\s*\.\s*([0-9]+)\s*\.\s*([0-9])(\s.+?)?', ret, flags=re.I)
assert ret
version.val = (int(ret[1]), int(ret[2]), int(ret[3]))
return version.val


def version_string() -> str:
return rf'{version()[0]}.{version()[1]}.{version()[2]}'


# =======================================================================================================================
# Doxyfile
# =======================================================================================================================
Expand Down Expand Up @@ -411,7 +417,9 @@ def parse_type(node: graph.Node, elem, resolve_auto_as=None):
# extract constexpr, constinit, static, mutable etc out of the type if doxygen has leaked it
while type_elem.text:
text = rf' {type_elem.text} '
match = re.search(r'\s(?:(?:const(?:expr|init|eval)|static|mutable|explicit|virtual|inline|friend)\s)+', text)
match = re.search(
r'\s(?:(?:const(?:expr|init|eval)|static|mutable|explicit|virtual|inline|friend)\s)+', text
)
if match is None:
break
type_elem.text = (text[: match.start()] + r' ' + text[match.end() :]).strip()
Expand Down Expand Up @@ -463,7 +471,9 @@ def parse_location(node: graph.Node, elem):
node = g.get_or_create_node(id=compound.get(r'refid'), type=KINDS_TO_NODE_TYPES[compound.get(r'kind')])

if node.type is graph.File: # files use their local name?? doxygen is so fucking weird
node.local_name = tail(extract_subelement_text(compound, r'name').strip().replace('\\', r'/').rstrip(r'/'), r'/') #
node.local_name = tail(
extract_subelement_text(compound, r'name').strip().replace('\\', r'/').rstrip(r'/'), r'/'
) #
else:
node.qualified_name = extract_subelement_text(compound, r'name')

Expand All @@ -472,7 +482,9 @@ def parse_location(node: graph.Node, elem):
member_kind = member_elem.get(r'kind')
if member_kind == r'enumvalue':
continue
member = g.get_or_create_node(id=member_elem.get(r'refid'), type=KINDS_TO_NODE_TYPES[member_kind], parent=node)
member = g.get_or_create_node(
id=member_elem.get(r'refid'), type=KINDS_TO_NODE_TYPES[member_kind], parent=node
)
name = extract_subelement_text(member_elem, r'name')
if name:
if member.type is graph.Define:
Expand Down Expand Up @@ -1088,7 +1100,9 @@ def make_location(elem, node: graph.Node):
)
for node_type in _ordered(*COMPOUND_NODE_TYPES):
for node in g(node_type):
compound = xml_utils.make_child(root, r'compound', refid=node.id, kind=NODE_TYPES_TO_KINDS[node.type]) #
compound = xml_utils.make_child(
root, r'compound', refid=node.id, kind=NODE_TYPES_TO_KINDS[node.type]
) #
xml_utils.make_child(compound, r'name').text = node.qualified_name
if node.type is graph.Directory:
continue
Expand Down
Loading

0 comments on commit fe0905d

Please sign in to comment.