chiark / gitweb /
m.code: adapt to pygments 2.10 to 2.18.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 16 Sep 2024 11:59:57 +0000 (13:59 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 16 Sep 2024 12:13:33 +0000 (14:13 +0200)
The new versions properly qualify whitespace as such instead of as text,
and do so gradually, which is responsible for most changes in the
output. Besides that, until 2.14 there were certain cases of empty
<span> in the output, which 2.14 fixes, so I add a postprocessing step
to clean those up to not need to further branch the tests.

The CI now tests various pygments versions, with only the last job
taking the latest version.

29 files changed:
doc/build-status.html.in
documentation/doxygen.py
documentation/test_doxygen/contents_blockquote/index-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_blockquote/index.html
documentation/test_doxygen/contents_code/index-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_code/index.html
documentation/test_doxygen/contents_code/warnings-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_code/warnings.html
documentation/test_doxygen/contents_code_filters/index-pygments210.html [new file with mode: 0644]
documentation/test_doxygen/contents_code_filters/index.html
documentation/test_doxygen/contents_code_language/index-pygments213.html [new file with mode: 0644]
documentation/test_doxygen/contents_code_language/index-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_code_language/index.html
documentation/test_doxygen/contents_custom/index-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_custom/index.html
documentation/test_doxygen/contents_tagfile/index-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/contents_tagfile/index.html
documentation/test_doxygen/example/path-prefix_2CMakeLists_8txt-example-pygments210.html [new file with mode: 0644]
documentation/test_doxygen/example/path-prefix_2CMakeLists_8txt-example.html
documentation/test_doxygen/example/path-prefix_2main_8cpp-example-pygments29.html [new file with mode: 0644]
documentation/test_doxygen/example/path-prefix_2main_8cpp-example.html
documentation/test_doxygen/test_contents.py
documentation/test_doxygen/test_example.py
package/ci/circleci.yml
plugins/m/code.py
plugins/m/test/code/page-210.html [new file with mode: 0644]
plugins/m/test/code/page-29.html [new file with mode: 0644]
plugins/m/test/code/page.html
plugins/m/test/test_code.py

index b64d60a68443763a18c0d4ede0e9df49aee9591a..70a3875ae61f4b838ce5693118e16b32858962d6 100644 (file)
@@ -3,12 +3,12 @@
     <tr>
       <th style="border-bottom-width: 0;"></th>
       <!-- try to keep these consistent with package/ci/circleci.yml -->
-      <th><abbr title="pybind11 2.3.0, doxygen 1.8.16">Python<br />3.6</abbr></th>
-      <th><abbr title="pybind11 2.3.0, doxygen 1.8.16">Python<br />3.7</abbr></th>
-      <th><abbr title="pybind11 2.4.3, doxygen 1.8.17">Python<br />3.8</abbr></th>
-      <th><abbr title="pybind11 2.5.0, doxygen 1.8.18">Python<br />3.9</abbr></th>
-      <th><abbr title="pybind11 2.11.1, doxygen 1.9.3">Python<br />3.10</abbr></th>
-      <th><abbr title="pybind11 2.11.1, doxygen 1.9.8">Python<br />3.11</abbr></th>
+      <th><abbr title="pygments 2.9.0, pybind11 2.3.0, doxygen 1.8.16">Python<br />3.6</abbr></th>
+      <th><abbr title="pygments 2.9.0, pybind11 2.3.0, doxygen 1.8.16">Python<br />3.7</abbr></th>
+      <th><abbr title="pygments 2.9.0, pybind11 2.4.3, doxygen 1.8.17">Python<br />3.8</abbr></th>
+      <th><abbr title="pygments 2.10.0, pybind11 2.5.0, doxygen 1.8.18">Python<br />3.9</abbr></th>
+      <th><abbr title="pygments 2.11.0, pybind11 2.11.1, doxygen 1.9.3">Python<br />3.10</abbr></th>
+      <th><abbr title="pygments 2.17.0, pybind11 2.11.1, doxygen 1.9.8">Python<br />3.11</abbr></th>
       <th><abbr title="pybind11 2.11.1, doxygen 1.11.0">Python<br />3.12</abbr></th>
     </tr>
     <tr>
index 17faec3c81fa533db17131b8effc196a9a5d83ea..88a2d80df84a585f19af6d8ca32a9894f2f00193 100755 (executable)
@@ -1375,6 +1375,13 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             if filter: code = filter(code)
 
             highlighted = highlight(code, lexer, formatter).rstrip()
+            # Pygments < 2.14 leave useless empty spans in the output. Filter
+            # them out to have the markup consistent across versions for easier
+            # testing.
+            # TODO same is in m.code, remove once support for < 2.14 is dropped
+            highlighted = (highlighted
+                .replace('<span class="w"></span>', '')
+                .replace('<span class="cp"></span>', ''))
             # Strip whitespace around if inline code, strip only trailing
             # whitespace if a block
             if not code_block: highlighted = highlighted.lstrip()
diff --git a/documentation/test_doxygen/contents_blockquote/index-pygments29.html b/documentation/test_doxygen/contents_blockquote/index-pygments29.html
new file mode 100644 (file)
index 0000000..350ff81
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<p>Mainly containing tests for Doxygen 1.9 parsing regressions and weirdness.</p><blockquote><p>A blockquote. In 1.9 it has a ZWJ added in the XML, which should get stripped away again.</p></blockquote><pre>Preformatted text after a blockquote. In 1.9 it will get parsed just as a
+regular paragraph unless there&#x27;s a dot before.
+</pre><blockquote><p>Another blockquote.</p></blockquote><pre class="m-code"><span class="c1">// code block that shouldn&#39;t be treated as inline</span></pre><blockquote><pre class="m-code"><span class="c1">// quoted code block that should be neither inline nor in a paragraph</span></pre></blockquote><p>A delimiting paragraph, just to not have a blockqoute right after another blockquote.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span> <span class="o">+</span> <span class="n">code</span></code> in a usual paragraph.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span> <span class="o">+</span> <span class="n">code</span></code> <strong>with a tag after.</strong></p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 350ff819c53ffc60f655b4ad34e205ec58797daf..e008ef9eb64dafe7002a2b701e9f0564410a9f29 100644 (file)
@@ -24,7 +24,7 @@
         </h1>
 <p>Mainly containing tests for Doxygen 1.9 parsing regressions and weirdness.</p><blockquote><p>A blockquote. In 1.9 it has a ZWJ added in the XML, which should get stripped away again.</p></blockquote><pre>Preformatted text after a blockquote. In 1.9 it will get parsed just as a
 regular paragraph unless there&#x27;s a dot before.
-</pre><blockquote><p>Another blockquote.</p></blockquote><pre class="m-code"><span class="c1">// code block that shouldn&#39;t be treated as inline</span></pre><blockquote><pre class="m-code"><span class="c1">// quoted code block that should be neither inline nor in a paragraph</span></pre></blockquote><p>A delimiting paragraph, just to not have a blockqoute right after another blockquote.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span> <span class="o">+</span> <span class="n">code</span></code> in a usual paragraph.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span> <span class="o">+</span> <span class="n">code</span></code> <strong>with a tag after.</strong></p>
+</pre><blockquote><p>Another blockquote.</p></blockquote><pre class="m-code"><span class="c1">// code block that shouldn&#39;t be treated as inline</span></pre><blockquote><pre class="m-code"><span class="c1">// quoted code block that should be neither inline nor in a paragraph</span></pre></blockquote><p>A delimiting paragraph, just to not have a blockqoute right after another blockquote.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">code</span></code> in a usual paragraph.</p><blockquote><p>Another blockquote.</p></blockquote><p><code class="m-code"><span class="s">&quot;inline&quot;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">code</span></code> <strong>with a tag after.</strong></p>
       </div>
     </div>
   </div>
diff --git a/documentation/test_doxygen/contents_code/index-pygments29.html b/documentation/test_doxygen/contents_code/index-pygments29.html
new file mode 100644 (file)
index 0000000..4d8ef82
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<pre class="m-code"><span class="c1">// A code block.</span>
+<span class="c1">// Spanning multiple lines.</span></pre><p><code class="m-code"><span class="n">Inline</span><span class="o">=</span><span class="n">code</span><span class="p">;</span></code> at the start of a line. Then a code that is inside of <code class="m-code"><span class="nb">true</span> <span class="o">||</span> <span class="nb">false</span></code> a text, should be delimited by spaces. But not when it is in (<code class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">exit</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span></code>) parentheses.</p><pre class="m-code">    <span class="c1">// a block</span>
+        <span class="c1">// that is indented</span>
+    <span class="c1">// but has a lot of trailing whitespace which should be removed</span>
+<span class="p">}</span></pre><aside class="m-note m-info"><h4>Note</h4><p>Code block after a note doesn&#x27;t start a new paragraph in the XML but should be treated as a block:</p></aside><pre class="m-code"><span class="c1">// this is a new block</span></pre><aside class="m-note m-dim"><h4><a href="todo.html#_todo000001" class="m-doc">Todo</a></h4><p>However, code block after an xrefitem is delimited properly by Doxygen:</p></aside><pre class="m-code"><span class="c1">// code?</span></pre><blockquote><p>And code block after a blockquote as well:</p></blockquote><pre class="m-code"><span class="c1">// another block</span></pre><aside class="m-note m-warning"><h4>Attention</h4><p>Inline code after a note should not be treated as block, though:</p></aside><p>The <code class="m-code"><span class="k">constexpr</span></code> functions are pure.</p><aside class="m-note m-danger"><h4>Warning</h4><p>Inline code right after a block should be part of a paragraph:</p></aside><p><code class="m-code"><span class="kr">inline</span></code> variables are a thing?</p><p>Code block inside a list (has to be done using HTML):</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;os&gt;</span></pre></li><li><p>Another paragraph.</p><p>Yet another</p></li><li>A single paragraph, rendered without the wrapping tag</li></ul><aside class="m-note m-info"><h4>Note</h4><p>Code block inside a note:</p><pre class="m-code"><span class="c1">// code block</span></pre><p>Another paragraph of that note.</p></aside>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 9c072f6e9753c380cee2897dad77294d8a93f60c..329259e95703a6a89a011fade205764b9f45910c 100644 (file)
           My Project
         </h1>
 <pre class="m-code"><span class="c1">// A code block.</span>
-<span class="c1">// Spanning multiple lines.</span></pre><p><code class="m-code"><span class="n">Inline</span><span class="o">=</span><span class="n">code</span><span class="p">;</span></code> at the start of a line. Then a code that is inside of <code class="m-code"><span class="nb">true</span> <span class="o">||</span> <span class="nb">false</span></code> a text, should be delimited by spaces. But not when it is in (<code class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">exit</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span></code>) parentheses.</p><pre class="m-code">    <span class="c1">// a block</span>
-        <span class="c1">// that is indented</span>
-    <span class="c1">// but has a lot of trailing whitespace which should be removed</span>
-<span class="p">}</span></pre><aside class="m-note m-info"><h4>Note</h4><p>Code block after a note doesn&#x27;t start a new paragraph in the XML but should be treated as a block:</p></aside><pre class="m-code"><span class="c1">// this is a new block</span></pre><aside class="m-note m-dim"><h4><a href="todo.html#_todo000001" class="m-doc">Todo</a></h4><p>However, code block after an xrefitem is delimited properly by Doxygen:</p></aside><pre class="m-code"><span class="c1">// code?</span></pre><blockquote><p>And code block after a blockquote as well:</p></blockquote><pre class="m-code"><span class="c1">// another block</span></pre><aside class="m-note m-warning"><h4>Attention</h4><p>Inline code after a note should not be treated as block, though:</p></aside><p>The <code class="m-code"><span class="k">constexpr</span></code> functions are pure.</p><aside class="m-note m-danger"><h4>Warning</h4><p>Inline code right after a block should be part of a paragraph:</p></aside><p><code class="m-code"><span class="kr">inline</span></code> variables are a thing?</p><p>Code block inside a list (has to be done using HTML):</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;os&gt;</span><span class="cp"></span></pre></li><li><p>Another paragraph.</p><p>Yet another</p></li><li>A single paragraph, rendered without the wrapping tag</li></ul><aside class="m-note m-info"><h4>Note</h4><p>Code block inside a note:</p><pre class="m-code"><span class="c1">// code block</span></pre><p>Another paragraph of that note.</p></aside>
+<span class="c1">// Spanning multiple lines.</span></pre><p><code class="m-code"><span class="n">Inline</span><span class="o">=</span><span class="n">code</span><span class="p">;</span></code> at the start of a line. Then a code that is inside of <code class="m-code"><span class="nb">true</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="nb">false</span></code> a text, should be delimited by spaces. But not when it is in (<code class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">exit</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span></code>) parentheses.</p><pre class="m-code"><span class="w">    </span><span class="c1">// a block</span>
+<span class="w">        </span><span class="c1">// that is indented</span>
+<span class="w">    </span><span class="c1">// but has a lot of trailing whitespace which should be removed</span>
+<span class="p">}</span></pre><aside class="m-note m-info"><h4>Note</h4><p>Code block after a note doesn&#x27;t start a new paragraph in the XML but should be treated as a block:</p></aside><pre class="m-code"><span class="c1">// this is a new block</span></pre><aside class="m-note m-dim"><h4><a href="todo.html#_todo000001" class="m-doc">Todo</a></h4><p>However, code block after an xrefitem is delimited properly by Doxygen:</p></aside><pre class="m-code"><span class="c1">// code?</span></pre><blockquote><p>And code block after a blockquote as well:</p></blockquote><pre class="m-code"><span class="c1">// another block</span></pre><aside class="m-note m-warning"><h4>Attention</h4><p>Inline code after a note should not be treated as block, though:</p></aside><p>The <code class="m-code"><span class="k">constexpr</span></code> functions are pure.</p><aside class="m-note m-danger"><h4>Warning</h4><p>Inline code right after a block should be part of a paragraph:</p></aside><p><code class="m-code"><span class="kr">inline</span></code> variables are a thing?</p><p>Code block inside a list (has to be done using HTML):</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;os&gt;</span></pre></li><li><p>Another paragraph.</p><p>Yet another</p></li><li>A single paragraph, rendered without the wrapping tag</li></ul><aside class="m-note m-info"><h4>Note</h4><p>Code block inside a note:</p><pre class="m-code"><span class="c1">// code block</span></pre><p>Another paragraph of that note.</p></aside>
       </div>
     </div>
   </div>
diff --git a/documentation/test_doxygen/contents_code/warnings-pygments29.html b/documentation/test_doxygen/contents_code/warnings-pygments29.html
new file mode 100644 (file)
index 0000000..f578422
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Code that produces warnings | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          Code that produces warnings
+        </h1>
+<pre class="m-code"><span class="c1">// Code without language</span>
+<span class="c1">// description</span></pre><p>A paragraph.</p><pre class="m-code"><span class="n">multi</span><span class="o">=</span><span class="n">line</span><span class="p">;</span>
+<span class="n">code</span><span class="o">=</span><span class="s">&quot;that is a part of a paragraph.&quot;</span><span class="p">;</span></pre><p>Improper code block inside a list that needs to be extracted out:</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;os&gt;</span>
+<span class="c1">// hello again</span></pre></li></ul>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 928024602490915c904c6833d696700d3e6bb467..58e0f9e8402fdca6a419101db6888cef8d1148f0 100644 (file)
@@ -24,7 +24,7 @@
         </h1>
 <pre class="m-code"><span class="c1">// Code without language</span>
 <span class="c1">// description</span></pre><p>A paragraph.</p><pre class="m-code"><span class="n">multi</span><span class="o">=</span><span class="n">line</span><span class="p">;</span>
-<span class="n">code</span><span class="o">=</span><span class="s">&quot;that is a part of a paragraph.&quot;</span><span class="p">;</span></pre><p>Improper code block inside a list that needs to be extracted out:</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;os&gt;</span><span class="cp"></span>
+<span class="n">code</span><span class="o">=</span><span class="s">&quot;that is a part of a paragraph.&quot;</span><span class="p">;</span></pre><p>Improper code block inside a list that needs to be extracted out:</p><ul><li><p>A paragraph.</p><pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;os&gt;</span>
 <span class="c1">// hello again</span></pre></li></ul>
       </div>
     </div>
diff --git a/documentation/test_doxygen/contents_code_filters/index-pygments210.html b/documentation/test_doxygen/contents_code_filters/index-pygments210.html
new file mode 100644 (file)
index 0000000..c8d5dc8
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<p>Adding typographically correct spaces before and a color swatch after &mdash; and for inline as well: <code class="m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span> <span class="p">}</span></code></p><pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index c8d5dc86c383d0fe303f7ca254e949eb43ffe646..03b8babc4efea27cef9a2fdf6090620cf03100e5 100644 (file)
@@ -22,8 +22,8 @@
         <h1>
           My Project
         </h1>
-<p>Adding typographically correct spaces before and a color swatch after &mdash; and for inline as well: <code class="m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span> <span class="p">}</span></code></p><pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
-    <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
+<p>Adding typographically correct spaces before and a color swatch after &mdash; and for inline as well: <code class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span><span class="w"> </span><span class="p">}</span></code></p><pre class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
 <span class="p">}</span></pre>
       </div>
     </div>
diff --git a/documentation/test_doxygen/contents_code_language/index-pygments213.html b/documentation/test_doxygen/contents_code_language/index-pygments213.html
new file mode 100644 (file)
index 0000000..164451c
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<pre class="m-code"><span class="c1">// Special handling of some extensions</span></pre><p><code class="m-code"><span class="na">Inline</span><span class="o">=</span><span class="s">code</span></code> of different <code class="m-code"><span class="nb">cd</span> dir</code> languages.</p><p>Code file with a custom language:</p><pre class="m-code"><span class="ch">#!/bin/bash</span>
+
+<span class="k">if</span> <span class="o">[</span> -d <span class="s1">&#39;/user&#39;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span> <span class="nb">echo</span> <span class="s2">&quot;Hello&quot;</span><span class="p">;</span> <span class="k">fi</span>
+<span class="nb">false</span></pre><p>Look:</p><pre class="m-code"><span class="kt">void</span><span class="w"> </span><span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>A paragraph following a one line snippet should not be merged with it.</p><pre class="m-code"><span class="kt">void</span><span class="w"> </span><span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>This one also not.</p><pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;cmath&gt;</span>
+
+<span class="kt">void</span><span class="w"> </span><span class="nf">bar</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>And this should not produce a warning.</p><p>Another paragraph.</p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/documentation/test_doxygen/contents_code_language/index-pygments29.html b/documentation/test_doxygen/contents_code_language/index-pygments29.html
new file mode 100644 (file)
index 0000000..a460902
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<pre class="m-code"><span class="c1">// Special handling of some extensions</span></pre><p><code class="m-code"><span class="na">Inline</span><span class="o">=</span><span class="s">code</span></code> of different <code class="m-code"><span class="nb">cd</span> dir</code> languages.</p><p>Code file with a custom language:</p><pre class="m-code"><span class="ch">#!/bin/bash</span>
+
+<span class="k">if</span> <span class="o">[</span> -d <span class="s1">&#39;/user&#39;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span> <span class="nb">echo</span> <span class="s2">&quot;Hello&quot;</span><span class="p">;</span> <span class="k">fi</span>
+<span class="nb">false</span></pre><p>Look:</p><pre class="m-code"><span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>A paragraph following a one line snippet should not be merged with it.</p><pre class="m-code"><span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>This one also not.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;cmath&gt;</span>
+
+<span class="kt">void</span> <span class="nf">bar</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>And this should not produce a warning.</p><p>Another paragraph.</p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 828fa10f16c13c1fd4bf5d2255ba841b883cebfa..b97a5e779de8432e012d9f1f8a6f8b9d6afebcac 100644 (file)
         <h1>
           My Project
         </h1>
-<pre class="m-code"><span class="c1">// Special handling of some extensions</span></pre><p><code class="m-code"><span class="na">Inline</span><span class="o">=</span><span class="s">code</span></code> of different <code class="m-code"><span class="nb">cd</span> dir</code> languages.</p><p>Code file with a custom language:</p><pre class="m-code"><span class="ch">#!/bin/bash</span>
+<pre class="m-code"><span class="c1">// Special handling of some extensions</span></pre><p><code class="m-code"><span class="na">Inline</span><span class="o">=</span><span class="s">code</span></code> of different <code class="m-code"><span class="nb">cd</span><span class="w"> </span>dir</code> languages.</p><p>Code file with a custom language:</p><pre class="m-code"><span class="ch">#!/bin/bash</span>
 
-<span class="k">if</span> <span class="o">[</span> -d <span class="s1">&#39;/user&#39;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span> <span class="nb">echo</span> <span class="s2">&quot;Hello&quot;</span><span class="p">;</span> <span class="k">fi</span>
-<span class="nb">false</span></pre><p>Look:</p><pre class="m-code"><span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>A paragraph following a one line snippet should not be merged with it.</p><pre class="m-code"><span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>This one also not.</p><pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;cmath&gt;</span><span class="cp"></span>
+<span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-d<span class="w"> </span><span class="s1">&#39;/user&#39;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="k">then</span><span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;Hello&quot;</span><span class="p">;</span><span class="w"> </span><span class="k">fi</span>
+<span class="nb">false</span></pre><p>Look:</p><pre class="m-code"><span class="kt">void</span><span class="w"> </span><span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>A paragraph following a one line snippet should not be merged with it.</p><pre class="m-code"><span class="kt">void</span><span class="w"> </span><span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>This one also not.</p><pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;cmath&gt;</span>
 
-<span class="kt">void</span> <span class="nf">bar</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">}</span></pre><p>And this should not produce a warning.</p><p>Another paragraph.</p>
+<span class="kt">void</span><span class="w"> </span><span class="nf">bar</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"> </span><span class="p">}</span></pre><p>And this should not produce a warning.</p><p>Another paragraph.</p>
       </div>
     </div>
   </div>
diff --git a/documentation/test_doxygen/contents_custom/index-pygments29.html b/documentation/test_doxygen/contents_custom/index-pygments29.html
new file mode 100644 (file)
index 0000000..d27e67f
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<div class="m-note m-dim m-text-center">This paragraph <em>is</em> rendered in a dim note, centered.</div><p>This paragraph contains a <span class="m-text m-danger"><em>red</em> text</span> in a normal text flow and then <strong class="m-text m-em m-small">small strong italics</strong>, <em class="m-text m-info">blue italics</em> and <a href="https://mcss.mosra.cz" class="m-text m-big">https:/<wbr />/<wbr />mcss.mosra.cz</a> (big-ass link). A styled page ref: <a href="math.html" class="m-label m-success">The math page</a>.</p><div class="m-button m-primary"><a href="#"><div class="m-big">A button</div><div class="m-small"><span class="m-text m-em">with</span> <strong class="m-text m-em">subtitle</strong></div></a></div><p>A paragraph that is not affected by the inline classes from above.</p><p class="m-text m-strong m-noindent">Bold, non-indented paragraph.</p><p class="m-text m-primary"><strong>Bold text that should not have</strong> the same class as the paragraph.</p><p>A paragraph that doesn&#x27;t have any class applied. Next, a full-width image:</p><img class="m-image m-fullwidth" src="ship-small.jpg" alt="Image" /><figure class="m-figure m-flat"><img src="ship-small.jpg" alt="Image" /><figcaption>A flat figure</figcaption></figure><p>A fullwidth table:</p><table class="m-table m-fullwidth"><thead><tr><th>Table header</th><th>Another</th></tr></thead><tbody><tr><td>Cell</td><td>Another cell</td></tr><tr><td>Next row</td><td>Last.</td></tr></tbody></table><p>An unstyled list:</p><ul class="m-unstyled"><li>First item without a dot</li><li>Second item without a dot</li></ul><aside class="m-block m-info"><h3>A info block with some paragraphs inside</h3><div><p>Hello.</p><p>This is good, finally.</p></div></aside><aside class="m-frame"><h3>Note</h3><p>A note styled as a frame.</p></aside><p>This has to be here otherwise doxygen puts the next <code>@m_class</code> call into the above note. WHAT THE HELL!!!</p><aside class="m-block m-success"><h3><a href="licenses.html#_licenses000001" class="m-doc">Third-party license info</a></h3><p>This package is licensed under MIT. All is good.</p></aside><div class="m-code-figure"><pre class="m-code"><span class="c1">// this is the code</span>
+<span class="n">printf</span><span class="p">(</span><span class="s">&quot;The answer to the universe and everything is %d.&quot;</span><span class="p">,</span> <span class="mi">5</span><span class="o">*</span><span class="mi">9</span><span class="p">)</span></pre><p>The answer to the universe and everything is 42.</p></div><p>A paragraph containing a footnote <a href="#note27" class="m-footnote">27</a> reference.</p><dl class="m-footnote"><dt>27.</dt><dd><a name="note27"></a>And a styled footnote, overriding the default styling which is used for TODO pages and other xrefitems, like <a href="licenses.html" class="m-doc">Third-party license info</a>.</dd></dl>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index d27e67f1b9c9737b84eea10b24cc98f53098a1d8..56723c5041d8672e59309d6ee35658edecacdfdc 100644 (file)
@@ -23,7 +23,7 @@
           My Project
         </h1>
 <div class="m-note m-dim m-text-center">This paragraph <em>is</em> rendered in a dim note, centered.</div><p>This paragraph contains a <span class="m-text m-danger"><em>red</em> text</span> in a normal text flow and then <strong class="m-text m-em m-small">small strong italics</strong>, <em class="m-text m-info">blue italics</em> and <a href="https://mcss.mosra.cz" class="m-text m-big">https:/<wbr />/<wbr />mcss.mosra.cz</a> (big-ass link). A styled page ref: <a href="math.html" class="m-label m-success">The math page</a>.</p><div class="m-button m-primary"><a href="#"><div class="m-big">A button</div><div class="m-small"><span class="m-text m-em">with</span> <strong class="m-text m-em">subtitle</strong></div></a></div><p>A paragraph that is not affected by the inline classes from above.</p><p class="m-text m-strong m-noindent">Bold, non-indented paragraph.</p><p class="m-text m-primary"><strong>Bold text that should not have</strong> the same class as the paragraph.</p><p>A paragraph that doesn&#x27;t have any class applied. Next, a full-width image:</p><img class="m-image m-fullwidth" src="ship-small.jpg" alt="Image" /><figure class="m-figure m-flat"><img src="ship-small.jpg" alt="Image" /><figcaption>A flat figure</figcaption></figure><p>A fullwidth table:</p><table class="m-table m-fullwidth"><thead><tr><th>Table header</th><th>Another</th></tr></thead><tbody><tr><td>Cell</td><td>Another cell</td></tr><tr><td>Next row</td><td>Last.</td></tr></tbody></table><p>An unstyled list:</p><ul class="m-unstyled"><li>First item without a dot</li><li>Second item without a dot</li></ul><aside class="m-block m-info"><h3>A info block with some paragraphs inside</h3><div><p>Hello.</p><p>This is good, finally.</p></div></aside><aside class="m-frame"><h3>Note</h3><p>A note styled as a frame.</p></aside><p>This has to be here otherwise doxygen puts the next <code>@m_class</code> call into the above note. WHAT THE HELL!!!</p><aside class="m-block m-success"><h3><a href="licenses.html#_licenses000001" class="m-doc">Third-party license info</a></h3><p>This package is licensed under MIT. All is good.</p></aside><div class="m-code-figure"><pre class="m-code"><span class="c1">// this is the code</span>
-<span class="n">printf</span><span class="p">(</span><span class="s">&quot;The answer to the universe and everything is %d.&quot;</span><span class="p">,</span> <span class="mi">5</span><span class="o">*</span><span class="mi">9</span><span class="p">)</span></pre><p>The answer to the universe and everything is 42.</p></div><p>A paragraph containing a footnote <a href="#note27" class="m-footnote">27</a> reference.</p><dl class="m-footnote"><dt>27.</dt><dd><a name="note27"></a>And a styled footnote, overriding the default styling which is used for TODO pages and other xrefitems, like <a href="licenses.html" class="m-doc">Third-party license info</a>.</dd></dl>
+<span class="n">printf</span><span class="p">(</span><span class="s">&quot;The answer to the universe and everything is %d.&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="o">*</span><span class="mi">9</span><span class="p">)</span></pre><p>The answer to the universe and everything is 42.</p></div><p>A paragraph containing a footnote <a href="#note27" class="m-footnote">27</a> reference.</p><dl class="m-footnote"><dt>27.</dt><dd><a name="note27"></a>And a styled footnote, overriding the default styling which is used for TODO pages and other xrefitems, like <a href="licenses.html" class="m-doc">Third-party license info</a>.</dd></dl>
       </div>
     </div>
   </div>
diff --git a/documentation/test_doxygen/contents_tagfile/index-pygments29.html b/documentation/test_doxygen/contents_tagfile/index-pygments29.html
new file mode 100644 (file)
index 0000000..37cac36
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          My Project
+        </h1>
+<p>See <a href="https://doc.magnum.graphics/corrade/Assert_8h.html#a83f7361970111951c88f1564a4f148e8" class="m-doc-external">CORRADE_<wbr />ASSERT()</a> for more information.</p><pre class="m-code"><span class="n">Corrade</span><span class="o">::</span><span class="n">Utility</span><span class="o">::</span><span class="n">Resource</span> <span class="n">rx</span><span class="p">;</span></pre>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 37cac36c4472d4155acf7d3b4813058dd6bbe8f5..1ff83c9be4737251a5879766653ab7a4e6d6ed03 100644 (file)
@@ -22,7 +22,7 @@
         <h1>
           My Project
         </h1>
-<p>See <a href="https://doc.magnum.graphics/corrade/Assert_8h.html#a83f7361970111951c88f1564a4f148e8" class="m-doc-external">CORRADE_<wbr />ASSERT()</a> for more information.</p><pre class="m-code"><span class="n">Corrade</span><span class="o">::</span><span class="n">Utility</span><span class="o">::</span><span class="n">Resource</span> <span class="n">rx</span><span class="p">;</span></pre>
+<p>See <a href="https://doc.magnum.graphics/corrade/Assert_8h.html#a83f7361970111951c88f1564a4f148e8" class="m-doc-external">CORRADE_<wbr />ASSERT()</a> for more information.</p><pre class="m-code"><span class="n">Corrade</span><span class="o">::</span><span class="n">Utility</span><span class="o">::</span><span class="n">Resource</span><span class="w"> </span><span class="n">rx</span><span class="p">;</span></pre>
       </div>
     </div>
   </div>
diff --git a/documentation/test_doxygen/example/path-prefix_2CMakeLists_8txt-example-pygments210.html b/documentation/test_doxygen/example/path-prefix_2CMakeLists_8txt-example-pygments210.html
new file mode 100644 (file)
index 0000000..65d0ceb
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page &raquo; The Example &raquo; CMakeLists.txt source | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <link rel="next" href="path-prefix_2configure_8h_8cmake-example.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          <span class="m-breadcrumb"><a href="page.html">A page</a> &raquo;</span>
+          <span class="m-breadcrumb"><a href="example.html">The Example</a> &raquo;</span>
+          CMakeLists.txt <span class="m-thin">source</span>
+        </h1>
+<pre class="m-code"><span class="nb">configure_file</span><span class="p">(</span><span class="o">${</span><span class="nv">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="s">/configure.h.cmake</span>
+               <span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="s">/configure.h</span><span class="p">)</span>
+
+<span class="nb">add_executable</span><span class="p">(</span><span class="s">app</span> <span class="s">main.cpp</span><span class="p">)</span>
+<span class="nb">target_include_directories</span><span class="p">(</span><span class="s">app</span> <span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="p">)</span></pre>
+        <div class="m-note m-dim m-thin m-text-center"><a href="example.html" class="m-doc">The Example</a> | <a href="path-prefix_2configure_8h_8cmake-example.html" class="m-doc">configure.h.cmake &raquo;</a></div>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 65d0cebc79f8553709afc7a2dfd882f17fd876a5..bb09d1351dc240df3205f0d272dd811cdade13dc 100644 (file)
           CMakeLists.txt <span class="m-thin">source</span>
         </h1>
 <pre class="m-code"><span class="nb">configure_file</span><span class="p">(</span><span class="o">${</span><span class="nv">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="s">/configure.h.cmake</span>
-               <span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="s">/configure.h</span><span class="p">)</span>
+<span class="w">               </span><span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="s">/configure.h</span><span class="p">)</span>
 
-<span class="nb">add_executable</span><span class="p">(</span><span class="s">app</span> <span class="s">main.cpp</span><span class="p">)</span>
-<span class="nb">target_include_directories</span><span class="p">(</span><span class="s">app</span> <span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="p">)</span></pre>
+<span class="nb">add_executable</span><span class="p">(</span><span class="s">app</span><span class="w"> </span><span class="s">main.cpp</span><span class="p">)</span>
+<span class="nb">target_include_directories</span><span class="p">(</span><span class="s">app</span><span class="w"> </span><span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="p">)</span></pre>
         <div class="m-note m-dim m-thin m-text-center"><a href="example.html" class="m-doc">The Example</a> | <a href="path-prefix_2configure_8h_8cmake-example.html" class="m-doc">configure.h.cmake &raquo;</a></div>
       </div>
     </div>
diff --git a/documentation/test_doxygen/example/path-prefix_2main_8cpp-example-pygments29.html b/documentation/test_doxygen/example/path-prefix_2main_8cpp-example-pygments29.html
new file mode 100644 (file)
index 0000000..948e5bf
--- /dev/null
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A page &raquo; The Example &raquo; main.cpp source | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+  <link rel="prev" href="path-prefix_2configure_8h_8cmake-example.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          <span class="m-breadcrumb"><a href="page.html">A page</a> &raquo;</span>
+          <span class="m-breadcrumb"><a href="example.html">The Example</a> &raquo;</span>
+          main.cpp <span class="m-thin">source</span>
+        </h1>
+<pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;configure.h&quot;</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="cp">#ifdef SAY_HELLO</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;hello?&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="cp">#endif</span>
+<span class="p">}</span></pre>
+        <div class="m-note m-dim m-thin m-text-center"><a href="path-prefix_2configure_8h_8cmake-example.html" class="m-doc">&laquo; configure.h.cmake</a> | <a href="example.html" class="m-doc">The Example</a></div>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index d9b1fc5b6b892b940c8fb4aac45b0663dcf062bd..0c6a3f51f03ff370ffa843477d8477ca93fdb36d 100644 (file)
           <span class="m-breadcrumb"><a href="example.html">The Example</a> &raquo;</span>
           main.cpp <span class="m-thin">source</span>
         </h1>
-<pre class="m-code"><span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+<pre class="m-code"><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;iostream&gt;</span>
 
-<span class="cp">#include</span> <span class="cpf">&quot;configure.h&quot;</span><span class="cp"></span>
+<span class="cp">#include</span><span class="w"> </span><span class="cpf">&quot;configure.h&quot;</span>
 
-<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
-    <span class="cp">#ifdef SAY_HELLO</span>
-    <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;hello?&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
-    <span class="cp">#endif</span>
+<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="cp">#ifdef SAY_HELLO</span>
+<span class="w">    </span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="s">&quot;hello?&quot;</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+<span class="w">    </span><span class="cp">#endif</span>
 <span class="p">}</span></pre>
         <div class="m-note m-dim m-thin m-text-center"><a href="path-prefix_2configure_8h_8cmake-example.html" class="m-doc">&laquo; configure.h.cmake</a> | <a href="example.html" class="m-doc">The Example</a></div>
       </div>
index 0bddd3b35968a5dd5bc88c16bbdb7d1ea85fa81f..996b5aba5d2d0a901e50aa24733eb718233bc38c 100644 (file)
@@ -25,6 +25,7 @@
 
 import os
 import pickle
+import pygments
 import re
 import shutil
 import subprocess
@@ -84,13 +85,24 @@ class Internal(IntegrationTestCase):
 class Code(IntegrationTestCase):
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments29.html'))
 
     def test_warnings(self):
         with self.assertLogs() as cm:
             self.run_doxygen(wildcard='warnings.xml')
 
-        self.assertEqual(*self.actual_expected_contents('warnings.html'))
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('warnings.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('warnings.html', 'warnings-pygments29.html'))
         self.assertEqual(cm.output, [
             "WARNING:root:warnings.xml: no filename attribute in <programlisting>, assuming C++",
             "WARNING:root:warnings.xml: inline code has multiple lines, fallback to a code block",
@@ -102,7 +114,15 @@ class CodeLanguage(IntegrationTestCase):
                          "https://github.com/doxygen/doxygen/pull/621")
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text. Pygments 2.14+ further improve on that.
+        if parse_version(pygments.__version__) >= parse_version("2.14"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        elif parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments213.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments29.html'))
 
     @unittest.skipUnless(parse_version(doxygen_version()) > parse_version("1.8.13"),
                          "https://github.com/doxygen/doxygen/pull/623")
@@ -291,12 +311,24 @@ class MathCached(IntegrationTestCase):
 class Tagfile(IntegrationTestCase):
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments29.html'))
 
 class Custom(IntegrationTestCase):
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments29.html'))
 
     @unittest.skipUnless(shutil.which('latex'),
                          "Math rendering requires LaTeX installed")
@@ -568,9 +600,22 @@ class CodeFilters(IntegrationTestCase):
                 'CSS': _add_color_swatch,
             }
         })
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text. Compared to elsewhere, in this case the difference is only with
+        # 2.11+.
+        if parse_version(pygments.__version__) >= parse_version("2.11"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments210.html'))
 
 class Blockquote(IntegrationTestCase):
     def test(self):
         self.run_doxygen(wildcard='indexpage.xml')
-        self.assertEqual(*self.actual_expected_contents('index.html'))
+
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('index.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('index.html', 'index-pygments29.html'))
index 93cdc25b81e0f4688492a83cf52686e0f6bf0cd8..f05a0e08dab972aa82f328912232c492df444bc8 100644 (file)
@@ -23,6 +23,7 @@
 #   DEALINGS IN THE SOFTWARE.
 #
 
+import pygments
 import unittest
 
 from . import IntegrationTestCase, doxygen_version, parse_version
@@ -32,12 +33,23 @@ class Example(IntegrationTestCase):
         self.run_doxygen(index_pages=[], wildcard='*.xml')
 
         self.assertEqual(*self.actual_expected_contents('path-prefix_2configure_8h_8cmake-example.html'))
-        self.assertEqual(*self.actual_expected_contents('path-prefix_2main_8cpp-example.html'))
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text
+        if parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('path-prefix_2main_8cpp-example.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('path-prefix_2main_8cpp-example.html', 'path-prefix_2main_8cpp-example-pygments29.html'))
 
     @unittest.skipUnless(parse_version(doxygen_version()) > parse_version("1.8.13"),
                          "needs to have file extension exposed in the XML")
     def test_other(self):
         self.run_doxygen(index_pages=[], wildcard='*.xml')
 
-        self.assertEqual(*self.actual_expected_contents('path-prefix_2CMakeLists_8txt-example.html'))
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text. Compared to elsewhere, in this case the difference is only with
+        # 2.11+.
+        if parse_version(pygments.__version__) >= parse_version("2.11"):
+            self.assertEqual(*self.actual_expected_contents('path-prefix_2CMakeLists_8txt-example.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('path-prefix_2CMakeLists_8txt-example.html', 'path-prefix_2CMakeLists_8txt-example-pygments210.html'))
         self.assertEqual(*self.actual_expected_contents('a_8txt-example.html'))
index e3cc43b6add329dfbcf23e41a38c85e62bc7360f..c406dee15fc910ef26fbaf69bdb7be7ab0b0b892 100644 (file)
@@ -66,16 +66,17 @@ commands:
       pelican-version:
         type: string
         default: ""
+      pygments-version:
+        type: string
+        default: ""
       qrcode-version:
         type: string
         default: ""
     steps:
     - run:
         name: Install Python dependencies
-        # Pygments 2.11 (and apparently 2.10 as well) treats certain whitespace
-        # differently, I have to update the expected output first.
         command: |
-          pip install jinja2 docutils<< parameters.docutils-version >> pygments==2.9.0 pelican<< parameters.pelican-version >> Pyphen Pillow coverage codecov qrcode<< parameters.qrcode-version >> matplotlib<< parameters.matplotlib-version >> attrs<< parameters.attrs-version >> numpy<< parameters.numpy-version >>
+          pip install jinja2 docutils<< parameters.docutils-version >> pygments<< parameters.pygments-version >> pelican<< parameters.pelican-version >> Pyphen Pillow coverage codecov qrcode<< parameters.qrcode-version >> matplotlib<< parameters.matplotlib-version >> attrs<< parameters.attrs-version >> numpy<< parameters.numpy-version >>
     - run:
         name: Fix unheard-of cursed issues
         # otherwise i get Error: unsupported locale setting
@@ -208,6 +209,11 @@ jobs:
         pelican-version: ==4.2.0
         # Ubuntu 18.04 has docutils 0.14
         docutils-version: ==0.14
+        # Pygments 2.9 are the last before 2.10+ starts classifying whitespace
+        # differently. Ubuntu 18.04 has pygments 2.2.0, but when requesting
+        # that one, the pelican version doesn't play well with Jinja, and I
+        # just don't have patience to deal with that for such an old version.
+        pygments-version: ==2.9.0
     - checkout
     - test-theme
     - test-plugins
@@ -235,6 +241,11 @@ jobs:
         # 7.4 has different output, however on 3.7 and older it's too annoying
         # to check what version is installed, so pin to 7.3
         qrcode-version: ==7.3.1
+        # Pygments 2.9 are the last before 2.10+ starts classifying whitespace
+        # differently. Ubuntu 20.04 has pygments 2.3.1, but that one has a
+        # slight difference in output and it doesn't make sense to add another
+        # test variant for such an old version.
+        pygments-version: ==2.9.0
     - checkout
     - test-theme
     - test-plugins
@@ -258,6 +269,9 @@ jobs:
         # Docutils 0.18.0 dropped `in_footnote_list` and made some changes that
         # 0.18.1 reverted again, test we're not affected by those
         docutils-version: ==0.18.0
+        # Pygments 2.9 are the last before 2.10+ starts classifying whitespace
+        # differently
+        pygments-version: ==2.9.0
     - checkout
     - test-theme
     - test-plugins
@@ -281,6 +295,8 @@ jobs:
         matplotlib-version: ==3.9.2
         # NumPy 2.0 only works with pybind 2.12+
         numpy-version: ==1.26.4
+        # Pygments 2.10 classifies whitespace differently than 2.9 and 2.11
+        pygments-version: ==2.10.0
     - checkout
     - test-theme
     - test-plugins
@@ -300,6 +316,8 @@ jobs:
     - install-python-deps:
         # NumPy 2.0 doesn't work with pybind 2.11, see below
         numpy-version: ==1.26.4
+        # Ubuntu 22.04 has pygments 2.11
+        pygments-version: ==2.11.0
     - checkout
     - test-theme
     - test-plugins
@@ -324,6 +342,8 @@ jobs:
     - install-python-deps:
         # NumPy 2.0 doesn't work with pybind 2.11, see below
         numpy-version: ==1.26.4
+        # Ubuntu 24.04 has pygments 2.17
+        pygments-version: ==2.17.0
     - checkout
     - test-theme
     - test-plugins
index e6c764b52d71aefaf6097e9a4554510025dfcc67..39f0314acc9c2cb78206428dc4643dd486307555 100644 (file)
@@ -108,6 +108,12 @@ def _highlight(code, language, options, *, is_block, filters=[]):
     if f: code = f(code)
 
     highlighted = highlight(code, lexer, formatter).rstrip()
+    # Pygments < 2.14 leave useless empty spans in the output. Filter them out
+    # to have the markup consistent across versions for easier testing.
+    # TODO same is in doxygen.py, remove once support for < 2.14 is dropped
+    highlighted = (highlighted
+        .replace('<span class="w"></span>', '')
+        .replace('<span class="cp"></span>', ''))
     # Strip whitespace around if inline code, strip only trailing whitespace if
     # a block
     if not is_block: highlighted = highlighted.lstrip()
diff --git a/plugins/m/test/code/page-210.html b/plugins/m/test/code/page-210.html
new file mode 100644 (file)
index 0000000..779360c
--- /dev/null
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>m.code | A Pelican Blog</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,400i,600%7CSource+Sans+Pro:400,400i,600,600i" />
+  <link rel="stylesheet" href="static/m-dark.css" />
+  <link rel="canonical" href="page.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+<article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>m.code</h1>
+<!-- content -->
+<pre class="m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span></pre>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Legacy <code class="m-code"><span class="nc">:hl_lines:</span></code> option should work the same:</p>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Same as above, but for a <code class="m-code"><span class="p">..</span> <span class="ow">include</span><span class="p">::</span></code>, which should also support line
+highlighting:</p>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span></code>. Syntax highlighting:</p>
+<pre class="m-code"><span class="c1"># Comment</span>
+<span class="n">var</span> <span class="o">=</span> <span class="s2">&quot;string</span><span class="si">{}</span><span class="s2">escape</span><span class="se">\n</span><span class="s2">&quot;</span></pre>
+<pre class="m-code">// this language is not highlighted</pre>
+<p>Properly preserve backslashes: <code class="m-code"><span class="k">\frac</span><span class="nb">{</span>a<span class="nb">}{</span>b<span class="nb">}</span></code> ... and backticks:
+<code class="m-code"><span class="na">:ref:</span><span class="nv">`a function &lt;os.path.join()&gt;`</span></code></p>
+<p>Don't trim leading spaces in blocks:</p>
+<pre class="m-code"><span class="w">        </span><span class="n">nope</span><span class="p">();</span>
+<span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
+<span class="p">}</span></pre>
+<section id="code-with-no-language-specified">
+<h2><a href="#code-with-no-language-specified">Code with no language specified</a></h2>
+<pre class="m-code">This is a plain block.</pre>
+<pre class="m-code m-text m-info">This is a plain block,
+    which is colored.</pre>
+<p>This is a <code class="m-code">plain inline code</code> and <code class="m-code m-text m-success">one which is also colored</code>.</p>
+</section>
+<section id="advanced-file-inclusion">
+<h2><a href="#advanced-file-inclusion">Advanced file inclusion</a></h2>
+<section id="sphinx-gallery-alike-self-contained-code-file">
+<h3><a href="#sphinx-gallery-alike-self-contained-code-file">&quot;Sphinx Gallery&quot;-alike self-contained code file</a></h3>
+<p>This is a reST markup explaining the following code, with the initial
+<code>#&lt;space&gt;</code> stripped, and on blank lines only the <code>#</code> stripped:</p>
+<p>## However in this case both leading <code>##</code> will be kept.</p>
+<p>The <code>math.sin()</code> calculates a sin, <em>of course</em>, and the initial indentation
+of it is stripped also:</p>
+<pre class="m-code"><span class="n">sin</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mf">0.13587</span><span class="p">)</span>
+<span class="n">two_sins</span> <span class="o">=</span> <span class="n">sin</span> <span class="o">+</span> <span class="n">sin</span></pre>
+<p>In comparison, here's the default output without <code class="m-code"><span class="nc">:strip-prefix:</span></code>:</p>
+<pre class="m-code">    <span class="n">sin</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mf">0.13587</span><span class="p">)</span>
+    <span class="n">two_sins</span> <span class="o">=</span> <span class="n">sin</span> <span class="o">+</span> <span class="n">sin</span></pre>
+</section>
+</section>
+<section id="filters">
+<h2><a href="#filters">Filters</a></h2>
+<p>Applied by default, adding typographically correct spaces before and a color
+swatch after --- and for inline as well: <code class="m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+<p>Applied explicitly and then by default --- and for inline as well:
+<code class="css-filtered m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+<p>Includes too:</p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+</section>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
diff --git a/plugins/m/test/code/page-29.html b/plugins/m/test/code/page-29.html
new file mode 100644 (file)
index 0000000..56c8ed9
--- /dev/null
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>m.code | A Pelican Blog</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,400i,600%7CSource+Sans+Pro:400,400i,600,600i" />
+  <link rel="stylesheet" href="static/m-dark.css" />
+  <link rel="canonical" href="page.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+<article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>m.code</h1>
+<!-- content -->
+<pre class="m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span></pre>
+<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Legacy <code class="m-code"><span class="nc">:hl_lines:</span></code> option should work the same:</p>
+<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Same as above, but for a <code class="m-code"><span class="p">..</span> <span class="ow">include</span><span class="p">::</span></code>, which should also support line
+highlighting:</p>
+<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
+<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span> <span class="kt">int</span> <span class="n">foo</span> <span class="o">=</span> <span class="mi">5</span><span class="p">;</span></code>. Syntax highlighting:</p>
+<pre class="m-code"><span class="c1"># Comment</span>
+<span class="n">var</span> <span class="o">=</span> <span class="s2">&quot;string</span><span class="si">{}</span><span class="s2">escape</span><span class="se">\n</span><span class="s2">&quot;</span></pre>
+<pre class="m-code">// this language is not highlighted</pre>
+<p>Properly preserve backslashes: <code class="m-code"><span class="k">\frac</span><span class="nb">{</span>a<span class="nb">}{</span>b<span class="nb">}</span></code> ... and backticks:
+<code class="m-code"><span class="na">:ref:</span><span class="nv">`a function &lt;os.path.join()&gt;`</span></code></p>
+<p>Don't trim leading spaces in blocks:</p>
+<pre class="m-code">        <span class="n">nope</span><span class="p">();</span>
+    <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+<span class="p">}</span></pre>
+<section id="code-with-no-language-specified">
+<h2><a href="#code-with-no-language-specified">Code with no language specified</a></h2>
+<pre class="m-code">This is a plain block.</pre>
+<pre class="m-code m-text m-info">This is a plain block,
+    which is colored.</pre>
+<p>This is a <code class="m-code">plain inline code</code> and <code class="m-code m-text m-success">one which is also colored</code>.</p>
+</section>
+<section id="advanced-file-inclusion">
+<h2><a href="#advanced-file-inclusion">Advanced file inclusion</a></h2>
+<section id="sphinx-gallery-alike-self-contained-code-file">
+<h3><a href="#sphinx-gallery-alike-self-contained-code-file">&quot;Sphinx Gallery&quot;-alike self-contained code file</a></h3>
+<p>This is a reST markup explaining the following code, with the initial
+<code>#&lt;space&gt;</code> stripped, and on blank lines only the <code>#</code> stripped:</p>
+<p>## However in this case both leading <code>##</code> will be kept.</p>
+<p>The <code>math.sin()</code> calculates a sin, <em>of course</em>, and the initial indentation
+of it is stripped also:</p>
+<pre class="m-code"><span class="n">sin</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mf">0.13587</span><span class="p">)</span>
+<span class="n">two_sins</span> <span class="o">=</span> <span class="n">sin</span> <span class="o">+</span> <span class="n">sin</span></pre>
+<p>In comparison, here's the default output without <code class="m-code"><span class="nc">:strip-prefix:</span></code>:</p>
+<pre class="m-code">    <span class="n">sin</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mf">0.13587</span><span class="p">)</span>
+    <span class="n">two_sins</span> <span class="o">=</span> <span class="n">sin</span> <span class="o">+</span> <span class="n">sin</span></pre>
+</section>
+</section>
+<section id="filters">
+<h2><a href="#filters">Filters</a></h2>
+<p>Applied by default, adding typographically correct spaces before and a color
+swatch after --- and for inline as well: <code class="m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+<p>Applied explicitly and then by default --- and for inline as well:
+<code class="css-filtered m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+<p>Includes too:</p>
+<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
+    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<span class="p">}</span></pre>
+</section>
+<!-- /content -->
+      </div>
+    </div>
+  </div>
+</article>
+</main>
+</body>
+</html>
index 56c8ed9320e875e0e6718e4c57fef346887dfeee..5b764f57f5e366d44e00fb6338e9ecae2566b567 100644 (file)
       <div class="m-col-l-10 m-push-l-1">
         <h1>m.code</h1>
 <!-- content -->
-<pre class="m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
-    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<pre class="m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
 <span class="p">}</span></pre>
-<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
-<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
 </span><span class="p">}</span></pre>
 <p>Legacy <code class="m-code"><span class="nc">:hl_lines:</span></code> option should work the same:</p>
-<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
-<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
 </span><span class="p">}</span></pre>
 <p>Same as above, but for a <code class="m-code"><span class="p">..</span> <span class="ow">include</span><span class="p">::</span></code>, which should also support line
 highlighting:</p>
-<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
-<span class="hll">    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<pre class="m-inverted m-code"><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
+<span class="hll"><span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
 </span><span class="p">}</span></pre>
-<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span> <span class="kt">int</span> <span class="n">foo</span> <span class="o">=</span> <span class="mi">5</span><span class="p">;</span></code>. Syntax highlighting:</p>
+<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span></code>. Syntax highlighting:</p>
 <pre class="m-code"><span class="c1"># Comment</span>
 <span class="n">var</span> <span class="o">=</span> <span class="s2">&quot;string</span><span class="si">{}</span><span class="s2">escape</span><span class="se">\n</span><span class="s2">&quot;</span></pre>
 <pre class="m-code">// this language is not highlighted</pre>
 <p>Properly preserve backslashes: <code class="m-code"><span class="k">\frac</span><span class="nb">{</span>a<span class="nb">}{</span>b<span class="nb">}</span></code> ... and backticks:
 <code class="m-code"><span class="na">:ref:</span><span class="nv">`a function &lt;os.path.join()&gt;`</span></code></p>
 <p>Don't trim leading spaces in blocks:</p>
-<pre class="m-code">        <span class="n">nope</span><span class="p">();</span>
-    <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+<pre class="m-code"><span class="w">        </span><span class="n">nope</span><span class="p">();</span>
+<span class="w">    </span><span class="k">return</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
 <span class="p">}</span></pre>
 <section id="code-with-no-language-specified">
 <h2><a href="#code-with-no-language-specified">Code with no language specified</a></h2>
@@ -74,18 +74,18 @@ of it is stripped also:</p>
 <section id="filters">
 <h2><a href="#filters">Filters</a></h2>
 <p>Applied by default, adding typographically correct spaces before and a color
-swatch after --- and for inline as well: <code class="m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
-<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
-    <span class="k">color</span><span class="p">:</span> <span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
+swatch after --- and for inline as well: <code class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span><span class="w"> </span><span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#ff3366<span class="m-code-color" style="background-color: #ff3366;"></span></span><span class="p">;</span>
 <span class="p">}</span></pre>
 <p>Applied explicitly and then by default --- and for inline as well:
-<code class="css-filtered m-code"><span class="nt">p</span> <span class="p">{</span> <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span> <span class="p">}</span></code></p>
-<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
-    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<code class="css-filtered m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span><span class="w"> </span><span class="p">}</span></code></p>
+<pre class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
 <span class="p">}</span></pre>
 <p>Includes too:</p>
-<pre class="m-code"><span class="nt">p</span> <span class="p">{</span>
-    <span class="k">color</span><span class="p">:</span> <span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
+<pre class="m-code"><span class="nt">p</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span class="k">color</span><span class="p">:</span><span class="w"> </span><span class="mh">#3bd267<span class="m-code-color" style="background-color: #3bd267;"></span></span><span class="p">;</span>
 <span class="p">}</span></pre>
 </section>
 <!-- /content -->
index 9a4303667558bda2c2d6d22820cb94ff598d5cec..8e8f5b2e19b449205c5e030640269122ba0cb890 100644 (file)
 #   DEALINGS IN THE SOFTWARE.
 #
 
+import pygments
 import re
 
-from . import PelicanPluginTestCase
+from . import PelicanPluginTestCase, parse_version
 
 _css_colors_src = re.compile(r"""<span class="mh">#(?P<hex>[0-9a-f]{6})</span>""")
 _css_colors_dst = r"""<span class="mh">#\g<hex><span class="m-code-color" style="background-color: #\g<hex>;"></span></span>"""
@@ -54,5 +55,12 @@ class Code(PelicanPluginTestCase):
             },
         })
 
-        self.assertEqual(*self.actual_expected_contents('page.html'))
+        # Pygments 2.10+ properly highlight Whitespace as such, and not as
+        # Text. The whitespace classification is further improved in 2.11.
+        if parse_version(pygments.__version__) >= parse_version("2.11"):
+            self.assertEqual(*self.actual_expected_contents('page.html'))
+        elif parse_version(pygments.__version__) >= parse_version("2.10"):
+            self.assertEqual(*self.actual_expected_contents('page.html', 'page-210.html'))
+        else:
+            self.assertEqual(*self.actual_expected_contents('page.html', 'page-29.html'))
         self.assertEqual(*self.actual_expected_contents('ansi.html'))