# Doxygen doesn't add a space before <programlisting> if it's
# inline, add it manually in case there should be a space before
- # it. However, it does add a space after it always.
+ # it. However, it does add a space after it always so we don't need
+ # to.
+ #
+ # There doesn't need to be a space if it's a start of a tag, if
+ # there's already one, if there's an opening brace before or if
+ # <para> patching started a new paragraph right before.
if not code_block:
- if out.parsed and not out.parsed[-1].isspace() and not out.parsed[-1] in '([{':
+ if out.parsed and not out.parsed[-1].isspace() and not out.parsed[-1] in '([{' and not out.parsed.endswith('<p>'):
out.parsed += ' '
# Hammer unhighlighted code out of the block
<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'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"><os></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="p">}</span></pre><aside class="m-note m-info"><h4>Note</h4><p>Code block after a note doesn'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"><os></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>
</div>
</div>
</div>