www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1117] New: ddoc generates corrupted docs if code examples contain attributes with colons

reply d-bugmail puremagic.com writes:
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>


-- 
Apr 09 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1117






Created an attachment (id=186)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=186&action=view)
Ddoc output

Attached for testing convenience.


-- 
Sep 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 28 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Leandro Lucarella <llucax gmail.com> changed:

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



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: -------
Oct 29 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 06 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1117


Don <clugdbug yahoo.com.au> changed:

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



*** 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: -------
Jan 15 2010