Skip to content

Commit 47addcc

Browse files
committed
issue #7787 Doxygen 1.8.18: Markdown tables not working in ALIASES anymore?
The artificial newline characters in ALIASES (`^^`) or better said its doxygen replacements (`\\_linebr`) were not seen by the markdown parser as line terminator and as a consequence there was no table seen (it was just 1 long line, without header / data lines)..
1 parent a2133a4 commit 47addcc

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/markdown.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@
8080
data[i]=='\\' || \
8181
data[i]=='@')
8282

83+
inline int isNewline(const char *data)
84+
{
85+
// plain return
86+
if (data[0] == '\n') return(1);
87+
// doxygen return from ^^ in ALIASES
88+
if (data[0] == '\\' && data[1] == '\\' && data[2] == '_' && data[3] == 'l' && data[4] == 'i' &&
89+
data[5] == 'n' && data[6] == 'e' && data[7] == 'b' && data[8] == 'r') return(9);
90+
return(0);
91+
}
8392
//----------
8493

8594
struct LinkRef
@@ -1594,8 +1603,10 @@ int findTableColumns(const char *data,int size,int &start,int &end,int &columns)
15941603
start = i;
15951604

15961605
// find end character of the table line
1597-
while (i<size && data[i]!='\n') i++;
1598-
eol=i+1;
1606+
int j = 0;
1607+
while (i<size && !(j = isNewline(data + i))) i++;
1608+
eol=i+j;
1609+
15991610
i--;
16001611
while (i>0 && data[i]==' ') i--;
16011612
if (i>0 && data[i-1]!='\\' && data[i]=='|') i--,n++; // trailing or escaped | does not count
@@ -2120,7 +2131,9 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size,
21202131
// find end of the line
21212132
int nb=0;
21222133
end=i+1;
2123-
while (end<=size && data[end-1]!='\n')
2134+
//while (end<=size && data[end-1]!='\n')
2135+
int j = 0;
2136+
while (end<=size && !(j = isNewline(data+end-1)))
21242137
{
21252138
// while looking for the end of the line we might encounter a block
21262139
// that needs to be passed unprocessed.
@@ -2181,6 +2194,7 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size,
21812194
end++;
21822195
}
21832196
}
2197+
if (j) end += j-1;
21842198
//printf("findEndOfLine pi=%d i=%d end=%d {%s}\n",pi,i,end,QCString(data+i).left(end-i).data());
21852199
}
21862200

0 commit comments

Comments
 (0)