122 – DDoc newline behaviour produces suboptimal results

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 122 - DDoc newline behaviour produces suboptimal results
Summary: DDoc newline behaviour produces suboptimal results
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: ddoc, patch
Depends on:
Blocks:
Reported: 2006年04月30日 22:41 UTC by Kris
Modified: 2014年02月15日 13:13 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Kris 2006年04月30日 22:41:13 UTC
Methods with a single 'summary' comment are nicely spaced apart, within an documented aggregate. Methods with both a 'summary' and a 'synopsys' end up with 2 or 3 extra (or additional) <br> instances after the method documentation ends. 
The result is documentation that looks "higglety pigglety" ~ or non uniform
Comment 1 Walter Bright 2006年06月14日 23:03:52 UTC
Can you please provide a small example?
Comment 2 Don 2010年03月13日 13:05:06 UTC
I've worked out what this is. Trailing newlines don't get stripped from the Description section. Yes, action on an ancient bug!
Here's a test case:
/**
foo1
this has one BR*/
void foo1();
/**
foo2
this also has one BR
*/
void foo2();
/**
foo3
this still just has one BR
*/
void foo3();
/**
foo4
but this has two BRs!!
*/
void foo4();
Comment 3 Don 2010年03月15日 00:57:17 UTC
PATCH: Don't include trailing newlines.
doc.c line 1007.
Value of 'pend' shouldn't increase unless there's a non-\n
character.
+	 pend = p;
	 while (1)
	 {
		if (!*p)
-		{ pend = p;
		 goto L1;
-		}
		if (*p == '\n')
		{ p++;
		 if (*p == '\n' && !summary && !namelen)
		 {
			pend = p;
			p++;
			goto L1;
		 }
		 break;
		}
		p++;
+		pend = p;
	 }
	 p = skipwhitespace(p);
Comment 4 Don 2010年03月15日 02:08:52 UTC
Sorry, that patch came out wrong. The first line belongs further up in the function.
Around line 965:
 {
 	p = skipwhitespace(p);
 	pstart = p;
+	pend = p;
 
 	/* Find end of section, which is ended by one of:
 	 *	'identifier:' (but not inside a code section)
And around line 1007:
 while (1)
 {
 if (!*p)
- { pend = p;
 goto L1;
- }
 if (*p == '\n')
 { p++;
 if (*p == '\n' && !summary && !namelen)
 {
 pend = p;
 p++;
 goto L1;
 }
 break;
 }
 p++;
+ pend = p;
 }
 p = skipwhitespace(p);
Comment 5 Don 2010年03月15日 12:58:16 UTC
See bug 1628 for a better patch.
Comment 6 Don 2010年04月09日 19:07:34 UTC
Fixed DMD1.058 and DMD2.043.


AltStyle によって変換されたページ (->オリジナル) /