Skip to content

Commit 3c5255e

Browse files
committed
issue doxygen#6998 Markdown: Links in ATX headings processed incorrectly?
1 parent ebab8a2 commit 3c5255e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+249
-201
lines changed

src/classdef.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) const
15671567
ol.popGeneratorState();
15681568
ol.generateDoc(briefFile(),briefLine(),this,nullptr,
15691569
briefDescription(),TRUE,FALSE,QCString(),
1570-
TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
1570+
TRUE,FALSE);
15711571
ol.pushGeneratorState();
15721572
ol.disable(OutputType::RTF);
15731573
ol.writeString(" \n");
@@ -1599,7 +1599,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const
15991599
if (!briefDescription().isEmpty() && repeatBrief)
16001600
{
16011601
ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE,
1602-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
1602+
QCString(),FALSE,FALSE);
16031603
}
16041604
if (!briefDescription().isEmpty() && repeatBrief &&
16051605
!documentation().isEmpty())
@@ -1613,7 +1613,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const
16131613
if (!documentation().isEmpty())
16141614
{
16151615
ol.generateDoc(docFile(),docLine(),this,nullptr,documentation(),TRUE,FALSE,
1616-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
1616+
QCString(),FALSE,FALSE);
16171617
}
16181618
// write type constraints
16191619
writeTypeConstraints(ol,this,m_typeConstraints);
@@ -1625,7 +1625,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const
16251625
inlineTemplateArgListToDoc(m_tempArgs), // docStr
16261626
TRUE, // indexWords
16271627
FALSE, // isExample
1628-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)
1628+
QCString(),FALSE,FALSE
16291629
);
16301630

16311631
// write examples
@@ -2694,7 +2694,7 @@ void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const QCStrin
26942694
auto ast { validatingParseDoc(*parser.get(),
26952695
briefFile(),briefLine(),this,nullptr,
26962696
briefDescription(),FALSE,FALSE,
2697-
QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) };
2697+
QCString(),TRUE,FALSE) };
26982698
if (!ast->isEmpty())
26992699
{
27002700
ol.startMemberDescription(anchor());

src/commentscan.l

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,9 +1537,9 @@ STopt [^\n@\\]*
15371537
}
15381538
<GroupDocArg2>[^\n\\]+ { // title (stored in type)
15391539
yyextra->current->type += yytext;
1540-
yyextra->current->type = yyextra->current->type.stripWhiteSpace();
15411540
}
15421541
<GroupDocArg2>{DOCNL}+ {
1542+
yyextra->current->type = yyextra->current->type.stripWhiteSpace();
15431543
if ( yyextra->current->groupDocType==Entry::GROUPDOC_NORMAL &&
15441544
yyextra->current->type.isEmpty()
15451545
) // defgroup requires second argument
@@ -1569,7 +1569,6 @@ STopt [^\n@\\]*
15691569
}
15701570
<GroupDocArg2>. { // title (stored in type)
15711571
yyextra->current->type += yytext;
1572-
yyextra->current->type = yyextra->current->type.stripWhiteSpace();
15731572
}
15741573
15751574
/* --------- handle arguments of page/mainpage command ------------------- */

src/conceptdef.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void ConceptDefImpl::writeBriefDescription(OutputList &ol) const
329329
auto ast { validatingParseDoc(
330330
*parser.get(),briefFile(),briefLine(),this,nullptr,
331331
briefDescription(),TRUE,FALSE,
332-
QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) };
332+
QCString(),TRUE,FALSE) };
333333
if (!ast->isEmpty())
334334
{
335335
ol.startParagraph();
@@ -469,7 +469,7 @@ void ConceptDefImpl::writeDetailedDescription(OutputList &ol,const QCString &tit
469469
if (!briefDescription().isEmpty() && repeatBrief)
470470
{
471471
ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE,
472-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
472+
QCString(),FALSE,FALSE);
473473
}
474474
if (!briefDescription().isEmpty() && repeatBrief &&
475475
!documentation().isEmpty())
@@ -484,7 +484,7 @@ void ConceptDefImpl::writeDetailedDescription(OutputList &ol,const QCString &tit
484484
if (!documentation().isEmpty())
485485
{
486486
ol.generateDoc(docFile(),docLine(),this,nullptr,documentation(),TRUE,FALSE,
487-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
487+
QCString(),FALSE,FALSE);
488488
}
489489

490490
writeSourceDef(ol);
@@ -685,7 +685,7 @@ void ConceptDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const QCStr
685685
auto ast { validatingParseDoc(
686686
*parser.get(),briefFile(),briefLine(),this,nullptr,
687687
briefDescription(),FALSE,FALSE,
688-
QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) };
688+
QCString(),TRUE,FALSE) };
689689
if (!ast->isEmpty())
690690
{
691691
ol.startMemberDescription(anchor());

src/definition.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,14 +1391,16 @@ QCString DefinitionImpl::navigationPathAsString() const
13911391
if (p->def->definitionType()==Definition::TypeGroup &&
13921392
!toGroupDef(p->def)->groupTitle().isEmpty())
13931393
{
1394-
result+="<a href=\"$relpath^"+fn+"\">"+
1395-
convertToHtml(toGroupDef(p->def)->groupTitle())+"</a>";
1394+
QCString title = parseCommentAsHtml(p->def,nullptr,toGroupDef(p->def)->groupTitle(),
1395+
p->def->getDefFileName(),p->def->getDefLine());
1396+
result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
13961397
}
13971398
else if (p->def->definitionType()==Definition::TypePage &&
13981399
toPageDef(p->def)->hasTitle())
13991400
{
1400-
result+="<a href=\"$relpath^"+fn+"\">"+
1401-
convertToHtml((toPageDef(p->def))->title())+"</a>";
1401+
QCString title = parseCommentAsHtml(p->def,nullptr,toPageDef(p->def)->title(),
1402+
p->def->getDefFileName(),p->def->getDefLine());
1403+
result+="<a href=\"$relpath^"+fn+"\">"+title+"</a>";
14021404
}
14031405
else if (p->def->definitionType()==Definition::TypeClass)
14041406
{
@@ -1461,7 +1463,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const
14611463
QCString docTitle = si->title();
14621464
if (docTitle.isEmpty()) docTitle = si->label();
14631465
ol.generateDoc(docFile(),getStartBodyLine(),scope,md,docTitle,TRUE,FALSE,
1464-
QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
1466+
QCString(),TRUE,FALSE);
14651467
ol.endTocEntry(si);
14661468
}
14671469
}

src/dirdef.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title)
249249
if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF))
250250
{
251251
ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE,
252-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
252+
QCString(),FALSE,FALSE);
253253
}
254254
// separator between brief and details
255255
if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) &&
@@ -269,7 +269,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title)
269269
if (!documentation().isEmpty())
270270
{
271271
ol.generateDoc(docFile(),docLine(),this,nullptr,documentation()+"\n",TRUE,FALSE,
272-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
272+
QCString(),FALSE,FALSE);
273273
}
274274
}
275275
}
@@ -282,7 +282,7 @@ void DirDefImpl::writeBriefDescription(OutputList &ol)
282282
auto parser { createDocParser() };
283283
auto ast { validatingParseDoc(
284284
*parser.get(), briefFile(),briefLine(),this,nullptr,briefDescription(),TRUE,FALSE,
285-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) };
285+
QCString(),FALSE,FALSE) };
286286
if (!ast->isEmpty())
287287
{
288288
ol.startParagraph();
@@ -386,8 +386,7 @@ void DirDefImpl::writeSubDirList(OutputList &ol)
386386
FALSE, // isExample
387387
QCString(), // exampleName
388388
TRUE, // single line
389-
TRUE, // link from index
390-
Config_getBool(MARKDOWN_SUPPORT)
389+
TRUE // link from index
391390
);
392391
ol.endMemberDescription();
393392
}
@@ -472,8 +471,7 @@ void DirDefImpl::writeFileList(OutputList &ol)
472471
FALSE, // isExample
473472
QCString(), // exampleName
474473
TRUE, // single line
475-
TRUE, // link from index
476-
Config_getBool(MARKDOWN_SUPPORT)
474+
TRUE // link from index
477475
);
478476
ol.endMemberDescription();
479477
}

src/docparser.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,7 @@ void DocParser::handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bo
785785
};
786786
QCString name = linkToText(context.lang,context.token->name,TRUE);
787787
AUTO_TRACE("word={}",name);
788-
bool autolinkSupport = Config_getBool(AUTOLINK_SUPPORT);
789-
if ((!autolinkSupport && !ignoreAutoLinkFlag) || ignoreWord(context.token->name)) // no autolinking -> add as normal word
788+
if ((!context.autolinkSupport && !ignoreAutoLinkFlag) || ignoreWord(context.token->name)) // no autolinking -> add as normal word
790789
{
791790
children.append<DocWord>(this,parent,name);
792791
return;
@@ -1926,7 +1925,8 @@ IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf,
19261925
const QCString &input,bool indexWords,
19271926
bool isExample, const QCString &exampleName,
19281927
bool singleLine, bool linkFromIndex,
1929-
bool markdownSupport)
1928+
bool markdownSupport,
1929+
bool autolinkSupport)
19301930
{
19311931
DocParser *parser = dynamic_cast<DocParser*>(&parserIntf);
19321932
assert(parser!=nullptr);
@@ -2011,6 +2011,7 @@ IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf,
20112011
parser->context.retvalsFound.clear();
20122012
parser->context.paramsFound.clear();
20132013
parser->context.markdownSupport = markdownSupport;
2014+
parser->context.autolinkSupport = autolinkSupport;
20142015

20152016
//printf("Starting comment block at %s:%d\n",qPrint(parser->context.fileName),startLine);
20162017
parser->tokenizer.setLineNr(startLine);
@@ -2083,6 +2084,7 @@ IDocNodeASTPtr validatingParseText(IDocParser &parserIntf,const QCString &input)
20832084
parser->context.searchUrl="";
20842085
parser->context.lang = SrcLangExt::Unknown;
20852086
parser->context.markdownSupport = Config_getBool(MARKDOWN_SUPPORT);
2087+
parser->context.autolinkSupport = FALSE;
20862088

20872089

20882090
auto ast = std::make_unique<DocNodeAST>(DocText(parser));

src/docparser.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "growvector.h"
2424
#include "construct.h"
2525
#include "types.h"
26+
#include "config.h"
2627

2728
class MemberDef;
2829
class Definition;
@@ -83,7 +84,8 @@ IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf,const QCString &fileNam
8384
const QCString &input,bool indexWords,
8485
bool isExample,const QCString &exampleName,
8586
bool singleLine,bool linkFromIndex,
86-
bool markdownSupport);
87+
bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT),
88+
bool autolinkSupport = Config_getBool(AUTOLINK_SUPPORT));
8789

8890
/*! Main entry point for parsing simple text fragments. These
8991
* fragments are limited to words, whitespace and symbols.

src/docparser_p.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct DocParserContext
9292
TokenInfo *token = nullptr;
9393
int lineNo = 0;
9494
bool markdownSupport = false;
95+
bool autolinkSupport = false;
9596
};
9697

9798
class DocParser : public IDocParser

src/docsets.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ void DocSets::addContentsItem(bool isDir,
229229
const QCString &anchor,
230230
bool /* separateIndex */,
231231
bool /* addToNavIndex */,
232-
const Definition * /*def*/)
232+
const Definition * /*def*/,
233+
const QCString & /* nameAsHtml */)
233234
{
234235
(void)isDir;
235236
//printf("DocSets::addContentsItem(%s) depth=%zu\n",name,p->indentStack.size());

src/docsets.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class DocSets : public IndexIntf
5050
const QCString &anchor,
5151
bool separateIndex,
5252
bool addToNavIndex,
53-
const Definition *def
53+
const Definition *def,
54+
const QCString &nameAsHtml
5455
);
5556
void addIndexItem(const Definition *context,const MemberDef *md,
5657
const QCString &sectionAnchor,const QCString &title);

0 commit comments

Comments
 (0)