diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1475a..55fd1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.13.7 - 2023-08-17 + +- fixed minor syntax highlighting issues + ## v0.13.6 - 2023-08-10 - update m.css to fix libgs.so lookup (#31) (@wroyca, @mosra) diff --git a/pyproject.toml b/pyproject.toml index c22ec3d..30884f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ 'Topic :: Utilities', ] dependencies = [ - 'misk >= 0.7.0', + 'misk >= 0.8.1', 'bs4', 'jinja2', 'pygments', diff --git a/src/poxy/fixers.py b/src/poxy/fixers.py index 0f41112..ebc5a3e 100644 --- a/src/poxy/fixers.py +++ b/src/poxy/fixers.py @@ -1139,6 +1139,13 @@ def __call__(self, context: Context, text: str, path: Path) -> str: text, ) + # hack to make basic "using XXXX = ..." directives look nice + text = re.sub( + r'(\s*using\s*)(\s+)([a-zA-Z_][a-zA-Z0-9_]*?)(\s+)(\s*=\s*)', + r'\1\2\3\4\5', + text, + ) + return text diff --git a/src/poxy/run.py b/src/poxy/run.py index 810a9a3..3474ccc 100644 --- a/src/poxy/run.py +++ b/src/poxy/run.py @@ -469,6 +469,29 @@ def postprocess_xml(context: Context): sectiondef.remove(member) changed = True + # do a bit of cleanup of + for programlisting in compounddef.iterdescendants(tag="programlisting"): + # fix ‍ mangling (zero-width joiners don't make sense in code blocks anyways) + for descendant in programlisting.iterdescendants(): + if descendant.text: + new_text = descendant.text.replace('‍', '') + new_text = descendant.text.replace('‍', '') + if new_text != descendant.text: + descendant.text = new_text + changed = True + if descendant.tail: + new_text = descendant.tail.replace('‍', '') + new_text = descendant.tail.replace('‍', '') + if new_text != descendant.tail: + descendant.tail = new_text + changed = True + # delete highlight blocks that contribute absolutely nothing: + for highlight in programlisting.iterdescendants(tag="highlight"): + if not highlight.text and not highlight.tail and not len(highlight): + highlight.getparent().remove(highlight) + changed = True + continue + # add entry to compounds etc if compound_id not in context.compounds: context.compounds[compound_id] = { diff --git a/src/poxy/version.txt b/src/poxy/version.txt index ebf55b3..5daaa7b 100644 --- a/src/poxy/version.txt +++ b/src/poxy/version.txt @@ -1 +1 @@ -0.13.6 +0.13.7 diff --git a/tests/test_project/expected_html/classtest_1_1class__1.html b/tests/test_project/expected_html/classtest_1_1class__1.html index ca5e5d2..0b7fe8e 100644 --- a/tests/test_project/expected_html/classtest_1_1class__1.html +++ b/tests/test_project/expected_html/classtest_1_1class__1.html @@ -94,7 +94,7 @@

Public types

Public static variables

- static std::byte public_static_variable constexpr + static std::byte public_static_variable constexpr
A public static variable.
@@ -188,14 +188,14 @@

Friends

Typedef documentation

- using test::class_1::public_typedef = int + using test::class_1::public_typedef = int

A public typedef.

More info.

- using test::class_1::protected_typedef = int protected + using test::class_1::protected_typedef = int protected

A protected typedef.

More info.

@@ -205,28 +205,28 @@

Function documentation

- static struct_1 test::class_1::public_static_function() constexpr + static struct_1 test::class_1::public_static_function() constexpr

A public static function.

More info.

- bool test::class_1::public_function() + bool test::class_1::public_function()

A public function.

More info.

- static bool test::class_1::protected_static_function() protected constexpr + static bool test::class_1::protected_static_function() protected constexpr

A protected static function.

More info.

- bool test::class_1::protected_function() protected + bool test::class_1::protected_function() protected

A protected function.

More info.

@@ -250,28 +250,28 @@

Variable documentation

- static std::byte test::class_1::public_static_variable constexpr + static std::byte test::class_1::public_static_variable constexpr

A public static variable.

More info.

- bool test::class_1::public_variable + bool test::class_1::public_variable

A public variable.

More info.

- static bool test::class_1::protected_static_variable protected constexpr + static bool test::class_1::protected_static_variable protected constexpr

A protected static variable.

More info.

- bool test::class_1::protected_variable protected + bool test::class_1::protected_variable protected

A protected variable.

More info.

diff --git a/tests/test_project/expected_html/classtest_1_1template__class__1.html b/tests/test_project/expected_html/classtest_1_1template__class__1.html index 9349f83..aa652eb 100644 --- a/tests/test_project/expected_html/classtest_1_1template__class__1.html +++ b/tests/test_project/expected_html/classtest_1_1template__class__1.html @@ -56,7 +56,7 @@

#include <src/code.h>
-
template<typename T>
+
template <typename T>
test::template_class_1 class

A template class.

diff --git a/tests/test_project/expected_html/code_8h.html b/tests/test_project/expected_html/code_8h.html index 5a33665..2b376d0 100644 --- a/tests/test_project/expected_html/code_8h.html +++ b/tests/test_project/expected_html/code_8h.html @@ -104,7 +104,7 @@

Classes

A class.
-
template<typename T>
+
template <typename T>
class test::template_class_1
A template class.
@@ -114,12 +114,12 @@

Classes

Concepts

-
template<typename T>
+
template <typename T>
concept test::concept_1
A concept.
-
template<typename T>
+
template <typename T>
concept test::nested::concept_2
A concept.
@@ -154,7 +154,7 @@

Typedefs

A C++11 'using' typedef.
-
template<typename T>
+
template <typename T>
using a_typedef_template = T
A C++11 'using' typedef template.
@@ -172,12 +172,12 @@

Functions

A function with a deduced return type.
-
template<typename T, typename U>
+
template <typename T, typename U>
auto do_the_other_thing(U u) -> T constexpr noexcept
A function template.
- auto do_the_thing() -> std::uint8_t + auto do_the_thing() -> std::uint8_t
A function.
diff --git a/tests/test_project/expected_html/concepttest_1_1concept__1.html b/tests/test_project/expected_html/concepttest_1_1concept__1.html index 505172b..3cfb928 100644 --- a/tests/test_project/expected_html/concepttest_1_1concept__1.html +++ b/tests/test_project/expected_html/concepttest_1_1concept__1.html @@ -56,7 +56,7 @@

#include <src/code.h>
-
template<typename T>
+
template <typename T>
test::concept_1 concept

A concept.

diff --git a/tests/test_project/expected_html/concepttest_1_1nested_1_1concept__2.html b/tests/test_project/expected_html/concepttest_1_1nested_1_1concept__2.html index 246f891..452542d 100644 --- a/tests/test_project/expected_html/concepttest_1_1nested_1_1concept__2.html +++ b/tests/test_project/expected_html/concepttest_1_1nested_1_1concept__2.html @@ -56,7 +56,7 @@

#include <src/code.h>
-
template<typename T>
+
template <typename T>
test::nested::concept_2 concept

A concept.

diff --git a/tests/test_project/expected_html/namespacetest.html b/tests/test_project/expected_html/namespacetest.html index 6e2baea..18cac6e 100644 --- a/tests/test_project/expected_html/namespacetest.html +++ b/tests/test_project/expected_html/namespacetest.html @@ -135,7 +135,7 @@

Classes

A struct.
-
template<typename T>
+
template <typename T>
class template_class_1
A template class.
@@ -145,7 +145,7 @@

Classes

Concepts

-
template<typename T>
+
template <typename T>
concept concept_1
A concept.
@@ -180,7 +180,7 @@

Typedefs

A C++11 'using' typedef.
-
template<typename T>
+
template <typename T>
using a_typedef_template = T
A C++11 'using' typedef template.
@@ -198,12 +198,12 @@

Functions

A function with a deduced return type.
-
template<typename T, typename U>
+
template <typename T, typename U>
auto do_the_other_thing(U u) -> T constexpr noexcept
A function template.
- auto do_the_thing() -> std::uint8_t + auto do_the_thing() -> std::uint8_t
A function.
@@ -225,7 +225,7 @@

Variables

Enum documentation

- enum class test::scoped_enum: unsigned + enum class test::scoped_enum: unsigned
#include <src/code.h>

A C++11 scoped enum.

@@ -256,7 +256,7 @@

- enum test::unscoped_enum + enum test::unscoped_enum
#include <src/code.h>

A pre-C++11 unscoped enum.

@@ -290,7 +290,7 @@

Typedef documentation

- typedef int test::a_shit_typedef + typedef int test::a_shit_typedef
#include <src/code.h>

An old-school typedef.

@@ -298,7 +298,7 @@

- using test::a_typedef = int + using test::a_typedef = int
#include <src/code.h>

A C++11 'using' typedef.

@@ -308,9 +308,9 @@

#include <src/code.h>
- template<typename T> + template <typename T>
- using test::a_typedef_template = T + using test::a_typedef_template = T

A C++11 'using' typedef template.

More info.

@@ -320,7 +320,7 @@

Function documentation

- void test::a_friend_function() + void test::a_friend_function()
#include <src/code.h>

A function that appears as a friend to a test::class_1.

@@ -328,7 +328,7 @@

- auto test::a_function_with_a_deduced_return_type() + auto test::a_function_with_a_deduced_return_type()
#include <src/code.h>

A function with a deduced return type.

@@ -338,9 +338,9 @@

#include <src/code.h>
- template<typename T, typename U> + template <typename T, typename U>
- T test::do_the_other_thing(U u) constexpr noexcept + T test::do_the_other_thing(U u) constexpr noexcept

A function template.

@@ -377,7 +377,7 @@

- std::uint8_t test::do_the_thing() + std::uint8_t test::do_the_thing()
#include <src/code.h>

A function.

@@ -385,7 +385,7 @@

- int test::do_the_thing_automatically() + int test::do_the_thing_automatically()
#include <src/code.h>

A function with a trailing return type.

@@ -396,7 +396,7 @@

Variable documentation

- bool test::inline_variable constexpr + bool test::inline_variable constexpr
#include <src/code.h>

An inline variable.

diff --git a/tests/test_project/expected_html/namespacetest_1_1nested.html b/tests/test_project/expected_html/namespacetest_1_1nested.html index 89c8701..4d89707 100644 --- a/tests/test_project/expected_html/namespacetest_1_1nested.html +++ b/tests/test_project/expected_html/namespacetest_1_1nested.html @@ -74,7 +74,7 @@

Contents

Concepts

-
template<typename T>
+
template <typename T>
concept concept_2
A concept.
diff --git a/tests/test_project/expected_html/structtest_1_1struct__1.html b/tests/test_project/expected_html/structtest_1_1struct__1.html index e07ed08..761514a 100644 --- a/tests/test_project/expected_html/structtest_1_1struct__1.html +++ b/tests/test_project/expected_html/structtest_1_1struct__1.html @@ -100,7 +100,7 @@

Public static variables

Enum documentation

- enum class test::struct_1::nested_enum + enum class test::struct_1::nested_enum

A C++11 scoped enum.

More info.

@@ -133,7 +133,7 @@

Variable documentation

- static bool test::struct_1::static_variable constexpr + static bool test::struct_1::static_variable constexpr

A static variable.

More info.

diff --git a/tests/test_project/expected_xml/namespacetest.xml b/tests/test_project/expected_xml/namespacetest.xml index de58aa0..166569d 100644 --- a/tests/test_project/expected_xml/namespacetest.xml +++ b/tests/test_project/expected_xml/namespacetest.xml @@ -267,7 +267,7 @@ A namespace. - More info. Here's some C++: intfoo(){return42_a_numeric_udl;}//codeblockformattingshouldbepreserved;//thislineshouldbeindentedbythreetabs,theabovebytwo.constchar*bar()noexcept{return""_a_string_udl;}usingsome_typedef=int;//'some_typedef'shouldbecolouredasatypetemplate<typenameT>usingtemplated_typedef=int;//'T'and'templated_typedef'shouldbecolouredastypesclassqux{staticintfunc();staticboolfunc2(int);staticvoidfunc3();qux(){func();if(func2(7)){qux::func3();}}}; thisshouldbea.shblock.eachlineshouldbeindendedbyonemoretabthanthelast.ihaveputtheblockopenersandclosersrightnexttoeachotherwithoutablanklineinbetweenbecausethisbreaksparsinginm.cssbutpoxyhasafixforit.additionallyitshouldappear'glued'totheaboveC++block,becausemagic. + More info. Here's some C++: intfoo(){return42_a_numeric_udl;}//codeblockformattingshouldbepreserved;//thislineshouldbeindentedbythreetabs,theabovebytwo.constchar*bar()noexcept{return""_a_string_udl;}usingsome_typedef=int;//'some_typedef'shouldbecolouredasatypetemplate<typenameT>usingtemplated_typedef=int;//'T'and'templated_typedef'shouldbecolouredastypesclassqux{staticintfunc();staticboolfunc2(int);staticvoidfunc3();qux(){func();if(func2(7)){qux::func3();}}}; thisshouldbea.shblock.eachlineshouldbeindendedbyonemoretabthanthelast.ihaveputtheblockopenersandclosersrightnexttoeachotherwithoutablanklineinbetweenbecausethisbreaksparsinginm.cssbutpoxyhasafixforit.additionallyitshouldappear'glued'totheaboveC++block,becausemagic. test::class_1