From be409dfd1c6b168a1fd4eb9f1ed85a1694bf05d6 Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Mon, 11 Nov 2024 15:31:09 +0200 Subject: [PATCH] v0.19.3 --- .github/workflows/ci.yaml | 14 -------------- CHANGELOG.md | 5 +++++ src/poxy/fixers.py | 18 ++++++++++++------ src/poxy/project.py | 2 +- src/poxy/run.py | 10 +++++++--- src/poxy/version.txt | 2 +- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b45134..a319411 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,20 +2,6 @@ name: ci on: push: - branches: - - main - paths: - - "**.py" - - "**.css" - - "**.js" - - "**.json" - - "**.xml" - - "**/poxy/data/*" - - "**/workflows/**.yaml" - - "pyproject.toml" - pull_request: - branches: - - main paths: - "**.py" - "**.css" diff --git a/CHANGELOG.md b/CHANGELOG.md index 97dee00..017d18c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.19.3 - 2024-11-11 + +- fixed crash with nested C-style enums without a name (#39) (@tim-janik) +- fixed `POXY_IMPLEMENTATION_DETAIL_IMPL` appearing in HTML in some circumstances + ## v0.19.1 - 2024-10-30 - fixed `ModuleNotFoundError` error in Python 3.12 (#38) (@dekinet) diff --git a/src/poxy/fixers.py b/src/poxy/fixers.py index eaef7df..c3e1e44 100644 --- a/src/poxy/fixers.py +++ b/src/poxy/fixers.py @@ -1031,14 +1031,20 @@ class ImplementationDetails(PlainTextFixer): Replaces implementation details with appropriate shorthands. ''' - __shorthands = ((r'POXY_IMPLEMENTATION_DETAIL_IMPL', r'/* ... */'),) + __patterns = ( + re.compile( + r'<\s*a\s+class="m-doc"\s+href=".+?"\s*>POXY_(?:)?IMPLEMENTATION_(?:)?DETAIL_(?:)?IMPL<\s*/a\s*>', + re.I, + ), + re.compile(r'POXY_(?:)?IMPLEMENTATION_(?:)?DETAIL_(?:)?IMPL', re.I), + re.compile(r'poxyimplementationdetailimplplaceholder', re.I), + ) + + __replacement = r'/* ... */' def __call__(self, context: Context, text: str, path: Path) -> str: - for shorthand, replacement in self.__shorthands: - idx = text.find(shorthand) - while idx >= 0: - text = text[:idx] + replacement + text[idx + len(shorthand) :] - idx = text.find(shorthand) + for pattern in self.__patterns: + text = pattern.sub(self.__replacement, text) return text diff --git a/src/poxy/project.py b/src/poxy/project.py index 4b9fdaa..b643def 100644 --- a/src/poxy/project.py +++ b/src/poxy/project.py @@ -47,7 +47,7 @@ class Defaults(object): r'__has_builtin(...)': 0, r'__has_feature(...)': 0, r'__has_cpp_attribute(...)': 999999, - r'POXY_IMPLEMENTATION_DETAIL(...)': r'POXY_IMPLEMENTATION_DETAIL_IMPL', + r'POXY_IMPLEMENTATION_DETAIL(...)': r'poxyimplementationdetailimplplaceholder', r'POXY_IGNORE(...)': r'', } cpp_builtin_macros = { diff --git a/src/poxy/run.py b/src/poxy/run.py index 627e0c2..c51dac7 100644 --- a/src/poxy/run.py +++ b/src/poxy/run.py @@ -746,12 +746,17 @@ def postprocess_xml(context: Context): # 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 + # sort_members_by_name = lambda tag: tag.find(r'name').text + def sort_members_by_name(tag): + n = tag.find(r'name') + if n is None: + return '' + return '' if n.text is None else n.text + members = [tag for tag in section.findall(r'memberdef')] for tag in members: section.remove(tag) # fmt: off - # yapf: disable groups = [ ([tag for tag in members if tag.get(r'kind') == r'define'], True), # ([tag for tag in members if tag.get(r'kind') == r'typedef'], True), @@ -763,7 +768,6 @@ def postprocess_xml(context: Context): ([tag for tag in members if tag.get(r'kind') == r'function' and tag.get(r'static') == r'no'], True), ([tag for tag in members if tag.get(r'kind') == r'friend'], True) ] - # yapf: enable # fmt: on for group, sort in groups: if sort: diff --git a/src/poxy/version.txt b/src/poxy/version.txt index 41915c7..b72b05e 100644 --- a/src/poxy/version.txt +++ b/src/poxy/version.txt @@ -1 +1 @@ -0.19.1 +0.19.3