chiark / gitweb /
doxygen: *actually* not strip leading whitespace in a block.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 16 Mar 2019 12:44:24 +0000 (13:44 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Fri, 29 Mar 2019 12:44:31 +0000 (13:44 +0100)
The condition was inverted and the test was not testing anything. Ugh.

doxygen/dox2html5.py
doxygen/test/contents_code/index.html
doxygen/test/contents_code/input.dox

index 237797a655be59db12b3d571d39167a3432375f6..36794c0b065bbc60ddf57db826df5a6d232b2273 100755 (executable)
@@ -1433,7 +1433,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             # Strip whitespace around if inline code, strip only trailing
             # whitespace if a block
             highlighted = highlighted.rstrip()
-            if code_block: highlighted = highlighted.lstrip()
+            if not code_block: highlighted = highlighted.lstrip()
             out.parsed += '<{0} class="{1}{2}">{3}</{0}>'.format(
                 'pre' if code_block else 'code',
                 class_,
index ef6eb5ef52632fea6e45b672ef6062403830d629..a49ce4ced78157bd8f5910f1d6adf91b1dadf241 100644 (file)
@@ -23,8 +23,7 @@
           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="p">{</span>
-    <span class="c1">// a 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-dox">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>
index c3805fa5898e90bcfcabc39529c96df9b123c525..db4500e9f0bea92e21856a5853605328b1c67c50 100644 (file)
@@ -10,7 +10,6 @@ is inside of @code{.cpp} true || false @endcode a text, should be delimited by
 spaces. But not when it is in (@code{.cpp} std::exit(2); @endcode) parentheses.
 
 @code{.cpp}
-    {
         // a block
             // that is indented
         // but has a lot of trailing whitespace which should be removed