[Issue 1117] ddoc generates corrupted docs if code examples contain attributes with colons

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 28 00:57:36 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=1117


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

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


--- Comment #2 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list