Bug 9475 – Should retain source formatting in ddoc's unittests
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-07T16:11:00Z
Last change time
2013-03-14T11:34:50Z
Keywords
ddoc, pull
Assigned to
andrej.mitrovich
Creator
hsteoh
Comments
Comment #0 by hsteoh — 2013-02-07T16:11:02Z
Code:
-------------------------------
/**
* Main program
*/
void main() { }
/// Example
unittest
{
foreach (i; 0 .. 10)
{
documentedFunction();
}
}
-----------------------------------
Output:
-------------------------------
<br><br>
<dl><dt><big><a name="main"></a>void <u>main</u>();
</big></dt>
<dd>Main program<br><br>
<b>Example:</b><pre class="d_code"><font color=blue>foreach</font> (i; 0 .. 10)
{
documentedFunction();
}
</pre><br><br>
</dd>
</dl>
-------------------------------
Notice that the indentation of the loop body has been lost. This makes example code have bad indentation in the generated docs.
Comment #1 by andrej.mitrovich — 2013-02-08T06:42:54Z
*** Issue 9472 has been marked as a duplicate of this issue. ***
Comment #2 by andrej.mitrovich — 2013-02-08T06:48:06Z
Hooray, seems to work now!
Are there any missing cases (why did you say it was just a "partial fix")?
Comment #5 by andrej.mitrovich — 2013-03-14T10:01:32Z
(In reply to comment #4)
> Hooray, seems to work now!
>
> Are there any missing cases (why did you say it was just a "partial fix")?
It was because code was not indented properly, but this has since been fixed thanks to Kenji's indentation code which I've borrowed.