Skip to content

Commit d090e7f

Browse files
committed
Discussion @11822 How to document a long URI/URL link
- allow multiple, no consecutive newlines in markdown types of url. - correcting small, subsequent, problems in latex and docbook output.
1 parent 532f998 commit d090e7f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/docbookgen.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,12 @@ QCString convertToDocBook(const QCString &s, const bool retainNewline)
14941494
{
14951495
switch (c)
14961496
{
1497-
case '\n': if (retainNewline) growBuf.addStr("<literallayout>&#160;&#xa;</literallayout>"); growBuf.addChar(c); break;
1497+
case '\n': if (retainNewline)
1498+
{
1499+
growBuf.addStr("<literallayout>&#160;&#xa;</literallayout>");
1500+
growBuf.addChar(c);
1501+
}
1502+
break;
14981503
case '<': growBuf.addStr("&lt;"); break;
14991504
case '>': growBuf.addStr("&gt;"); break;
15001505
case '&': // possibility to have a special symbol

src/latexgen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,6 +2679,7 @@ QCString latexFilterURL(const QCString &s)
26792679
case '#': t << "\\#"; break;
26802680
case '%': t << "\\%"; break;
26812681
case '\\': t << "\\\\"; break;
2682+
case '\n': break; // ignore
26822683
default:
26832684
if (c<0)
26842685
{

src/markdown.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,20 +1324,28 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
13241324
if (i<size && data[i]=='<') { i++; uriFormat=true; }
13251325
size_t linkStart=i;
13261326
int braceCount=1;
1327+
int nlConsec = 0;
13271328
while (i<size && data[i]!='\'' && data[i]!='"' && braceCount>0)
13281329
{
13291330
if (data[i]=='\n') // unexpected EOL
13301331
{
13311332
nl++;
1332-
if (nl>1) { return 0; }
1333+
nlConsec++;
1334+
if (nlConsec>1) { return 0; }
13331335
}
13341336
else if (data[i]=='(')
13351337
{
13361338
braceCount++;
1339+
nlConsec = 0;
13371340
}
13381341
else if (data[i]==')')
13391342
{
13401343
braceCount--;
1344+
nlConsec = 0;
1345+
}
1346+
else if (data[i]!=' ')
1347+
{
1348+
nlConsec = 0;
13411349
}
13421350
if (braceCount>0)
13431351
{

0 commit comments

Comments
 (0)