Bug 1117 – ddoc generates corrupted docs if code examples contain attributes with colons

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-09T13:30:21Z
Last change time
2020-05-19T05:43:06Z
Keywords
ddoc, patch
Assigned to
No Owner
Creator
Max Samukha

Attachments

IDFilenameSummaryContent-TypeSize
186bz1117.htmlDdoc outputtext/html576

Comments

Comment #0 by samukha — 2007-04-09T13:30:21Z
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>
Comment #1 by smjg — 2007-09-29T07:12:17Z
Created attachment 186 Ddoc output Attached for testing convenience.
Comment #2 by clugdbug — 2009-10-28T00:57:35Z
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 == '_')
Comment #3 by leandro.lucarella — 2009-10-29T14:37:02Z
Comment #4 by bugzilla — 2009-11-06T11:29:22Z
Fixed dmd 1.051 and 2.036
Comment #5 by clugdbug — 2010-01-15T07:23:24Z
*** Issue 1652 has been marked as a duplicate of this issue. ***
Comment #6 by dlang-bot — 2020-05-19T05:43:06Z
dlang/dub pull request #1946 "Make the testsuite re-runnable on OSX" was merged into master: - ad164ef26ce226e269352fe828727632c4f4b40e by Geod24: testsuite: Make issue1117 test re-runnable It's the little things in life, like being able to re-run your test-suite on your own machine, that makes the greatest joy. https://github.com/dlang/dub/pull/1946