diff options
author | albert-github <albert.tests@gmail.com> | 2019-08-23 13:15:37 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2019-08-23 13:15:37 (GMT) |
commit | 4e2a1ac22f27046f16acc95ea7d763a67bb7f344 (patch) | |
tree | 20948557ba67272ad98b96eae81942899287cd29 /src | |
parent | 5213707f485360bd9145beebe2fab250ca133a02 (diff) | |
download | Doxygen-4e2a1ac22f27046f16acc95ea7d763a67bb7f344.zip Doxygen-4e2a1ac22f27046f16acc95ea7d763a67bb7f344.tar.gz Doxygen-4e2a1ac22f27046f16acc95ea7d763a67bb7f344.tar.bz2 |
Text ' ' appears in code segments
In case we have the UTF-8 code for nbsp in our source this is (see #6983) replaced with ` `, though in code fragments this is unwanted as here the text appears literally.
the UTF-8 nbsp is temporary replaced by a "doxygen" tag and for fenced code blocks, backtick blocks and special bloc commands (code, verbatim, htmlonly, formulas,...) replaced back with the UTF-8 version, the remaining "doxygen" tags are at the end replaced with ` `
Diffstat (limited to 'src')
-rw-r--r-- | src/markdown.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp index 2cbdcb5..a3455ab 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -108,7 +108,8 @@ static Entry *g_current; static QCString g_fileName; static int g_lineNr; static int g_indentLevel=0; // 0 is outside markdown, -1=page level - +static char g_doxynbsputf8[3] = {'\xc2', '\xa0', '\0'}; // UTF-8 nbsp +static char *g_doxynbsp = "&_doxy_nbsp;"; //---------- const int codeBlockIndent = 4; @@ -1044,7 +1045,7 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int if (qstrncmp(&data[i+1],endBlockName,l)==0) { //printf("found end at %d\n",i); - out.addStr(data,i+1+l); + out.addStr(substitute(QCString(data).left(i+1+l),g_doxynbsp,g_doxynbsputf8)); return i+1+l; } } @@ -2174,7 +2175,7 @@ static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, { out.addStr("{"+lang+"}"); } - out.addStr(data+blockStart,blockEnd-blockStart); + out.addStr(substitute(QCString(data+blockStart).left(blockEnd-blockStart),g_doxynbsp,g_doxynbsputf8)); out.addStr("\n"); out.addStr("@endcode"); } @@ -2484,7 +2485,7 @@ static QCString detab(const QCString &s,int &refIndent) // special handling of the UTF-8 nbsp character 0xc2 0xa0 if (c == '\xc2' && data[i] == '\xa0') { - out.addStr(" "); + out.addStr(g_doxynbsp); i++; } else @@ -2561,7 +2562,7 @@ QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,cons processInline(out,s,s.length()); out.addChar(0); Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(out.get())); - return out.get(); + return substitute(out.get(),g_doxynbsp," "); } //--------------------------------------------------------------------------- |