From 841d62b5cfdc1b6bb826ccb464a72a5058d117f7 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 30 Jul 2014 16:19:38 +0100 Subject: [PATCH] Fix Issue 12745 - [Ddoc] Underscore is removed from numbers --- src/doc.c | 2 +- test/compilable/ddoc12745.d | 20 +++++++++++++++++ test/compilable/extra-files/ddoc12745.html | 26 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/compilable/ddoc12745.d create mode 100644 test/compilable/extra-files/ddoc12745.html diff --git a/src/doc.c b/src/doc.c index acdd8a245f7e..be9bb12a6f63 100644 --- a/src/doc.c +++ b/src/doc.c @@ -2440,7 +2440,7 @@ void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset) } // leading '_' means no highlight unless it's a reserved symbol name - if (buf->data[i] == '_' && + if (buf->data[i] == '_' && (i == 0 || !isdigit(buf->data[i-1])) && (i == buf->size-1 || !isReservedName((utf8_t *)(buf->data + i), j - i))) { buf->remove(i, 1); diff --git a/test/compilable/ddoc12745.d b/test/compilable/ddoc12745.d new file mode 100644 index 000000000000..32ab6eb3c50b --- /dev/null +++ b/test/compilable/ddoc12745.d @@ -0,0 +1,20 @@ +// EXTRA_SOURCES: +// PERMUTE_ARGS: +// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- +// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 12745 + +/** +i underlined $(BR) +_i not underlined $(BR) +__i force underscore $(BR) +$(BR) +_0 not underscored $(BR) +__0 force underscored + +Underscores: +1_1 $(BR) +1_a $(BR) +a_1 $(BR) +a_a $(BR) +*/ +int i; \ No newline at end of file diff --git a/test/compilable/extra-files/ddoc12745.html b/test/compilable/extra-files/ddoc12745.html new file mode 100644 index 000000000000..d6bfc472b96a --- /dev/null +++ b/test/compilable/extra-files/ddoc12745.html @@ -0,0 +1,26 @@ + + + ddoc12745 + +

ddoc12745

+

+
int i; +
+
i underlined
+i not underlined
+_i force underscore
+
+0 not underscored
+_0 force underscored +

+Underscores:
+1_1
+1_a
+a_1
+a_a


+ +
+
+ +
Page generated by Ddoc. +