Thread overview
[Issue 1117] New: ddoc generates corrupted docs if code examples contain attributes with colons
Apr 09, 2007
d-bugmail
Sep 29, 2007
d-bugmail
Oct 28, 2009
Don
Oct 29, 2009
Leandro Lucarella
Nov 06, 2009
Walter Bright
Jan 15, 2010
Don
April 09, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1117

           Summary: ddoc generates corrupted docs if code examples contain
                    attributes with colons
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


Corrupted documentation is generated by ddoc for code examples having attributes with colons:

/**
Example:
---
private:
    int i = 0;
---
*/
void main()
{
}

Generated html:
<html><head>
        <META http-equiv="content-type" content="text/html; charset=utf-8">
        <title>hello</title>
        </head><body>
        <h1>hello</h1>
        <!-- Generated by Ddoc from hello.d -->
<br><br>
$(DDOC_MODULE_MEMBERS
<dt><big>void <u>main</u>();

</big></dt>
$(DDOC_DECL_DD <b>Example:</b><br>
<pre class="d_code"></pre>
<b>private:</b><br>
int i = 0;
<pre class="d_code"></pre>
<br><br>
<br><br>


        <hr><small>Page generated by <a
href="http://www.digitalmars.com/d/ddoc.html">Ddoc</a>. </small>

        </body></html>


-- 

September 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1117





------- Comment #1 from smjg@iname.com  2007-09-29 07:12 -------
Created an attachment (id=186)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=186&action=view)
Ddoc output

Attached for testing convenience.


-- 

October 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-10-28 00:57:35 PDT ---
CAUSE: when splitting into sections, identifiers inside code sections should be
ignored.
(In the code below, note that "--foo:" is not a section).
This patch also fixes bug 195.

PATCH:
doc.c, parseSections() line 965 (DMD2.035)

    /* Find end of section, which is ended by one of:
-     *    'identifier:'
+     *    'identifier:' (but not inside a code section)
     *    '\0'
     */
    idlen = 0;
+    bool inCode = false;
    while (1)
    {
+        if (*p=='-') { // check for start/end of a code section
+        int numdash=0;
+            while(*p=='-') {
+                ++numdash;
+                p++;
+            }
+        if (!*p || *p=='\r' || *p=='\n' && numdash>=3)
+            inCode = !inCode;
+        }
-        if (isalpha(*p) || *p == '_')
+        else if (!inCode && (isalpha(*p) || *p == '_'))
        {
        q = p + 1;
        while (isalnum(*q) || *q == '_')

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax@gmail.com


--- Comment #3 from Leandro Lucarella <llucax@gmail.com> 2009-10-29 14:37:02 PDT ---
Related SVN revision: http://www.dsource.org/projects/dmd/changeset/227

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-11-06 11:29:22 PST ---
Fixed dmd 1.051 and 2.036

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool@gmx.de


--- Comment #5 from Don <clugdbug@yahoo.com.au> 2010-01-15 07:23:24 PST ---
*** Issue 1652 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------