Skip to content

Commit

Permalink
fixed minor syntax highlighting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marzer committed Aug 17, 2023
1 parent d3c9d58 commit 2a7b351
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
'Topic :: Utilities',
]
dependencies = [
'misk >= 0.7.0',
'misk >= 0.8.1',
'bs4',
'jinja2',
'pygments',
Expand Down
7 changes: 7 additions & 0 deletions src/poxy/fixers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<span\s+class="k"\s*>(\s*using\s*)</span>(\s+)<span\s+class="n"\s*>([a-zA-Z_][a-zA-Z0-9_]*?)</span>(\s+)<span\s+class="o"\s*>(\s*=\s*)</span>',
r'<span class="k">\1</span>\2<span class="nc">\3</span>\4<span class="o">\5</span>',
text,
)

return text


Expand Down
23 changes: 23 additions & 0 deletions src/poxy/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,29 @@ def postprocess_xml(context: Context):
sectiondef.remove(member)
changed = True

# do a bit of cleanup of <programlisting>
for programlisting in compounddef.iterdescendants(tag="programlisting"):
# fix &amp;zwj; 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('&amp;zwj;', '')
new_text = descendant.text.replace('&zwj;', '')
if new_text != descendant.text:
descendant.text = new_text
changed = True
if descendant.tail:
new_text = descendant.tail.replace('&amp;zwj;', '')
new_text = descendant.tail.replace('&zwj;', '')
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] = {
Expand Down
2 changes: 1 addition & 1 deletion src/poxy/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.6
0.13.7
22 changes: 11 additions & 11 deletions tests/test_project/expected_html/classtest_1_1class__1.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h2><a href="#pub-types">Public types</a></h2>
<h2><a href="#pub-static-attribs">Public static variables</a></h2>
<dl class="m-doc">
<dt>
static <a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/types/byte.html" target="_blank">std::<wbr/>byte</a> <a class="m-doc" href="#ae05cfedbf34e9f128e87410c09ad3780">public_static_variable</a> <span class="m-label m-flat m-primary">constexpr</span>
static <a class="m-doc-external poxy-cppreference poxy-external" href="http://en.cppreference.com/w/cpp/types/byte.html" target="_blank">std::<wbr/>byte</a> <a class="m-doc" href="#ae05cfedbf34e9f128e87410c09ad3780">public_static_variable</a> <span class="m-label m-flat m-primary">constexpr</span>
</dt>
<dd>A public static variable.</dd>
</dl>
Expand Down Expand Up @@ -188,14 +188,14 @@ <h2><a href="#friends">Friends</a></h2>
<h2>Typedef documentation</h2>
<section class="m-doc-details" id="a52150fb93a5946c0d2fca381f99f426f"><div>
<h3>
using test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#a52150fb93a5946c0d2fca381f99f426f">public_typedef</a> = int
using <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#a52150fb93a5946c0d2fca381f99f426f">public_typedef</a> = int
</h3>
<p>A public typedef.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="aa57cecf6a75b7d9a7343b06706f3863c"><div>
<h3>
using test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#aa57cecf6a75b7d9a7343b06706f3863c">protected_typedef</a> = int <span class="m-label m-warning">protected</span>
using <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#aa57cecf6a75b7d9a7343b06706f3863c">protected_typedef</a> = int <span class="m-label m-warning">protected</span>
</h3>
<p>A protected typedef.</p>
<p>More info.</p>
Expand All @@ -205,28 +205,28 @@ <h3>
<h2>Function documentation</h2>
<section class="m-doc-details" id="af2caa02646ff203339faf41a0efc4b20"><div>
<h3>
<span class="m-doc-wrap-bumper">static <a class="m-doc" href="structtest_1_1struct__1.html">struct_<wbr/>1</a> test::<wbr/>class_1::<wbr/></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#af2caa02646ff203339faf41a0efc4b20">public_static_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-primary">constexpr</span></span></span>
<span class="m-doc-wrap-bumper">static <a class="m-doc" href="structtest_1_1struct__1.html">struct_<wbr/>1</a> <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#af2caa02646ff203339faf41a0efc4b20">public_static_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>A public static function.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="a6b372d2af2e8e874869f0ddf50a306fb"><div>
<h3>
<span class="m-doc-wrap-bumper">bool test::<wbr/>class_1::<wbr/></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#a6b372d2af2e8e874869f0ddf50a306fb">public_function</a>(</span><span class="m-doc-wrap">)</span></span>
<span class="m-doc-wrap-bumper">bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#a6b372d2af2e8e874869f0ddf50a306fb">public_function</a>(</span><span class="m-doc-wrap">)</span></span>
</h3>
<p>A public function.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="ac4b22b5c1e50ba1a06f0319566252bb8"><div>
<h3>
<span class="m-doc-wrap-bumper">static bool test::<wbr/>class_1::<wbr/></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#ac4b22b5c1e50ba1a06f0319566252bb8">protected_static_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-warning">protected</span> <span class="m-label m-primary">constexpr</span></span></span>
<span class="m-doc-wrap-bumper">static bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#ac4b22b5c1e50ba1a06f0319566252bb8">protected_static_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-warning">protected</span> <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>A protected static function.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="ab61d354f51a90bb49d38d22e7a7d7f48"><div>
<h3>
<span class="m-doc-wrap-bumper">bool test::<wbr/>class_1::<wbr/></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#ab61d354f51a90bb49d38d22e7a7d7f48">protected_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-warning">protected</span></span></span>
<span class="m-doc-wrap-bumper">bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span></span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a class="m-doc-self" href="#ab61d354f51a90bb49d38d22e7a7d7f48">protected_function</a>(</span><span class="m-doc-wrap">) <span class="m-label m-warning">protected</span></span></span>
</h3>
<p>A protected function.</p>
<p>More info.</p>
Expand All @@ -250,28 +250,28 @@ <h3>
<h2>Variable documentation</h2>
<section class="m-doc-details" id="ae05cfedbf34e9f128e87410c09ad3780"><div>
<h3>
static <a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/types/byte.html" target="_blank">std::<wbr/>byte</a> test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#ae05cfedbf34e9f128e87410c09ad3780">public_static_variable</a> <span class="m-label m-primary">constexpr</span>
static <a class="m-doc-external poxy-cppreference poxy-external" href="http://en.cppreference.com/w/cpp/types/byte.html" target="_blank">std::<wbr/>byte</a> <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#ae05cfedbf34e9f128e87410c09ad3780">public_static_variable</a> <span class="m-label m-primary">constexpr</span>
</h3>
<p>A public static variable.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="a1942e4b40fc0cc1b939b24d1c5f4e54c"><div>
<h3>
bool test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#a1942e4b40fc0cc1b939b24d1c5f4e54c">public_variable</a>
bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#a1942e4b40fc0cc1b939b24d1c5f4e54c">public_variable</a>
</h3>
<p>A public variable.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="a330993e9b2ae74c6db1a28553759fe96"><div>
<h3>
static bool test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#a330993e9b2ae74c6db1a28553759fe96">protected_static_variable</a> <span class="m-label m-warning">protected</span> <span class="m-label m-primary">constexpr</span>
static bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#a330993e9b2ae74c6db1a28553759fe96">protected_static_variable</a> <span class="m-label m-warning">protected</span> <span class="m-label m-primary">constexpr</span>
</h3>
<p>A protected static variable.</p>
<p>More info.</p>
</div></section>
<section class="m-doc-details" id="ae4d8ef41c2f2be17d38d9eac40e53699"><div>
<h3>
bool test::<wbr/>class_1::<wbr/><a class="m-doc-self" href="#ae4d8ef41c2f2be17d38d9eac40e53699">protected_variable</a> <span class="m-label m-warning">protected</span>
bool <span class="m-doc-details-prefix">test::<wbr/>class_1::<wbr/></span><a class="m-doc-self" href="#ae4d8ef41c2f2be17d38d9eac40e53699">protected_variable</a> <span class="m-label m-warning">protected</span>
</h3>
<p>A protected variable.</p>
<p>More info.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="m-col-l-10 m-push-l-1">
<h1>
<div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="code_8h.html">&lt;src/code.h&gt;</a></div>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<span class="m-breadcrumb"><a href="namespacetest.html">test</a>::<wbr/></span>template_class_1 <span class="m-thin">class</span>
</h1>
<p>A template class.</p>
Expand Down
12 changes: 6 additions & 6 deletions tests/test_project/expected_html/code_8h.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h2><a href="#nested-classes">Classes</a></h2>
</dt>
<dd>A class.</dd>
<dt>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
class <a class="m-doc" href="classtest_1_1template__class__1.html">test::template_class_1</a>
</dt>
<dd>A template class.</dd>
Expand All @@ -114,12 +114,12 @@ <h2><a href="#nested-classes">Classes</a></h2>
<h2><a href="#nested-concepts">Concepts</a></h2>
<dl class="m-doc">
<dt>
<div class="m-doc-template">template&lt;typename T&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
concept <a class="m-doc" href="concepttest_1_1concept__1.html">test::concept_1</a>
</dt>
<dd>A concept.</dd>
<dt>
<div class="m-doc-template">template&lt;typename T&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
concept <a class="m-doc" href="concepttest_1_1nested_1_1concept__2.html">test::nested::concept_2</a>
</dt>
<dd>A concept.</dd>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h2><a href="#typedef-members">Typedefs</a></h2>
</dt>
<dd>A C++11 'using' typedef.</dd>
<dt>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
using <a class="m-doc" href="namespacetest.html#ab80f438f7d1d6d6e3b184b7ce32df687">a_typedef_template</a> = T
</dt>
<dd>A C++11 'using' typedef template.</dd>
Expand All @@ -172,12 +172,12 @@ <h2><a href="#func-members">Functions</a></h2>
</dt>
<dd>A function with a deduced return type.</dd>
<dt>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span>, <span class="m-doc-template-param">typename U</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span>, <span class="m-doc-template-param">typename U</span></span>&gt;</div>
<span class="m-doc-wrap-bumper">auto <a class="m-doc" href="namespacetest.html#ae66b7e2e94f84934cff5de3e512ce0ee">do_the_other_thing</a>(</span><span class="m-doc-wrap">U u) -&gt; T <span class="m-label m-flat m-primary">constexpr</span> <span class="m-label m-flat m-success">noexcept</span></span>
</dt>
<dd>A function template.</dd>
<dt>
<span class="m-doc-wrap-bumper">auto <a class="m-doc" href="namespacetest.html#a011c6f27e90f228cd68be9def15bc076">do_the_thing</a>(</span><span class="m-doc-wrap">) -&gt; <a class="m-doc-external poxy-external" href="http://en.cppreference.com/w/cpp/types/integer.html" target="_blank">std::<wbr/>uint8_t</a></span>
<span class="m-doc-wrap-bumper">auto <a class="m-doc" href="namespacetest.html#a011c6f27e90f228cd68be9def15bc076">do_the_thing</a>(</span><span class="m-doc-wrap">) -&gt; <a class="m-doc-external poxy-cppreference poxy-external" href="http://en.cppreference.com/w/cpp/types/integer.html" target="_blank">std::<wbr/>uint8_t</a></span>
</dt>
<dd>A function.</dd>
<dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="m-col-l-10 m-push-l-1">
<h1>
<div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="code_8h.html">&lt;src/code.h&gt;</a></div>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<span class="m-breadcrumb"><a href="namespacetest.html">test</a>::<wbr/></span>concept_1 <span class="m-thin">concept</span>
</h1>
<p>A concept.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="m-col-l-10 m-push-l-1">
<h1>
<div class="m-doc-include m-code m-inverted m-right-m m-text-right"><span class="cp">#include</span> <a class="cpf" href="code_8h.html">&lt;src/code.h&gt;</a></div>
<div class="m-doc-template">template&lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<div class="m-doc-template">template &lt;<span class="m-doc-template-params"><span class="m-doc-template-param">typename T</span></span>&gt;</div>
<span class="m-breadcrumb"><a href="namespacetest.html">test</a>::<wbr/></span><span class="m-breadcrumb"><a href="namespacetest_1_1nested.html">nested</a>::<wbr/></span>concept_2 <span class="m-thin">concept</span>
</h1>
<p>A concept.</p>
Expand Down
Loading

0 comments on commit 2a7b351

Please sign in to comment.