summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-04-06 17:19:07 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-04-06 17:19:07 (GMT)
commit4bc2355373979726c7ed4e8351639123daf808cb (patch)
tree920279c4bfbff5531fd2e1b4eca1eb142a7b7fb6 /src/markdown.cpp
parentb4b47b3919650d7350acc9fe59becaee4a3d5ff5 (diff)
downloadDoxygen-4bc2355373979726c7ed4e8351639123daf808cb.zip
Doxygen-4bc2355373979726c7ed4e8351639123daf808cb.tar.gz
Doxygen-4bc2355373979726c7ed4e8351639123daf808cb.tar.bz2
Replaced FileNameDict/FileNameList by FileNameLinkedMap
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 2e67145..749bd9f 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -13,7 +13,7 @@
*
*/
-/* Note: part of the code below is inspired by libupskirt written by
+/* Note: part of the code below is inspired by libupskirt written by
* Natacha Porté. Original copyright message follows:
*
* Copyright (c) 2008, Natacha Porté
@@ -209,11 +209,11 @@ static QCString isBlockCommand(const char *data,int offset,int size)
{
return "}";
}
- else if (blockName=="dot" ||
- blockName=="code" ||
+ else if (blockName=="dot" ||
+ blockName=="code" ||
blockName=="msc" ||
- blockName=="verbatim" ||
- blockName=="latexonly" ||
+ blockName=="verbatim" ||
+ blockName=="latexonly" ||
blockName=="htmlonly" ||
blockName=="xmlonly" ||
blockName=="rtfonly" ||
@@ -254,12 +254,12 @@ static int findEmphasisChar(const char *data, int size, char c, int c_size)
while (i<size)
{
- while (i<size && data[i]!=c && data[i]!='`' &&
+ while (i<size && data[i]!=c && data[i]!='`' &&
data[i]!='\\' && data[i]!='@' &&
data[i]!='\n') i++;
//printf("findEmphasisChar: data=[%s] i=%d c=%c\n",data,i,data[i]);
- // not counting escaped chars or characters that are unlikely
+ // not counting escaped chars or characters that are unlikely
// to appear as the end of the emphasis char
if (i>0 && ignoreCloseEmphChar(i-1))
{
@@ -356,9 +356,9 @@ static int processEmphasis1(GrowBuf &out, const char *data, int size, char c)
while (i<size)
{
len = findEmphasisChar(data+i, size-i, c, 1);
- if (len==0) return 0;
+ if (len==0) return 0;
i+=len;
- if (i>=size) return 0;
+ if (i>=size) return 0;
if (i+1<size && data[i+1]==c)
{
@@ -389,7 +389,7 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c)
return 0;
}
i += len;
- if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' &&
+ if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' &&
data[i-1]!='\n'
)
{
@@ -406,7 +406,7 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c)
}
/** Parsing triple emphasis.
- * Finds the first closing tag, and delegates to the other emph
+ * Finds the first closing tag, and delegates to the other emph
*/
static int processEmphasis3(GrowBuf &out, const char *data, int size, char c)
{
@@ -503,7 +503,7 @@ static int processQuoted(GrowBuf &out,const char *data,int,int size)
{
int i=1;
int nl=0;
- while (i<size && data[i]!='"' && nl<2)
+ while (i<size && data[i]!='"' && nl<2)
{
if (data[i]=='\n') nl++;
i++;
@@ -622,7 +622,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
if (size>2 && c!='~' && data[1]!=c) // _bla or *bla
{
// whitespace cannot follow an opening emphasis
- if (data[1]==' ' || data[1]=='\n' ||
+ if (data[1]==' ' || data[1]=='\n' ||
(ret = processEmphasis1(out, data+1, size-1, c)) == 0)
{
return 0;
@@ -631,7 +631,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
}
if (size>3 && data[1]==c && data[2]!=c) // __bla or **bla
{
- if (data[2]==' ' || data[2]=='\n' ||
+ if (data[2]==' ' || data[2]=='\n' ||
(ret = processEmphasis2(out, data+2, size-2, c)) == 0)
{
return 0;
@@ -640,7 +640,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
}
if (size>4 && c!='~' && data[1]==c && data[2]==c && data[3]!=c) // ___bla or ***bla
{
- if (data[3]==' ' || data[3]=='\n' ||
+ if (data[3]==' ' || data[3]=='\n' ||
(ret = processEmphasis3(out, data+3, size-3, c)) == 0)
{
return 0;
@@ -833,7 +833,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
title = lr->title;
//printf("processLink: ref: link={%s} title={%s}\n",link.data(),title.data());
}
- else // reference not found!
+ else // reference not found!
{
//printf("processLink: ref {%s} do not exist\n",link.lower().data());
return 0;
@@ -876,12 +876,12 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
out.addStr("}");
}
}
- else if (isImageLink)
+ else if (isImageLink)
{
bool ambig;
FileDef *fd=0;
if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1 ||
- (fd=findFileDef(Doxygen::imageNameDict,link,ambig)))
+ (fd=findFileDef(Doxygen::imageNameLinkedMap,link,ambig)))
// assume doxygen symbol link or local image link
{
writeMarkdownImage(out, "html", explicitTitle, title, content, link, fd);
@@ -909,7 +909,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
{
SrcLangExt lang = getLanguageFromFileName(link);
int lp=-1;
- if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt_Markdown && !isURL(link)))
+ if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt_Markdown && !isURL(link)))
// assume doxygen symbol link
{
if (lp==-1) // link to markdown page
@@ -928,7 +928,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
}
out.addStr("\"");
}
- else if (link.find('/')!=-1 || link.find('.')!=-1 || link.find('#')!=-1)
+ else if (link.find('/')!=-1 || link.find('.')!=-1 || link.find('#')!=-1)
{ // file/url link
out.addStr("<a href=\"");
out.addStr(link);
@@ -969,9 +969,9 @@ static int processCodeSpan(GrowBuf &out, const char *data, int /*offset*/, int s
int nl=0;
for (end=nb; end<size && i<nb && nl<2; end++)
{
- if (data[end]=='`')
+ if (data[end]=='`')
{
- i++;
+ i++;
}
else if (data[end]=='\n')
{
@@ -989,7 +989,7 @@ static int processCodeSpan(GrowBuf &out, const char *data, int /*offset*/, int s
}
else
{
- i=0;
+ i=0;
}
}
if (i < nb && end >= size)
@@ -1122,9 +1122,9 @@ static int isHeaderline(const char *data, int size, bool allowAdjustLevel)
if (allowAdjustLevel && level==1 && g_indentLevel==-1)
{
// In case a page starts with a header line we use it as title, promoting it to @page.
- // We set g_indentLevel to -1 to promoting the other sections if they have a deeper
+ // We set g_indentLevel to -1 to promoting the other sections if they have a deeper
// nesting level than the page header, i.e. @section..@subsection becomes @page..@section.
- // In case a section at the same level is found (@section..@section) however we need
+ // In case a section at the same level is found (@section..@section) however we need
// to undo this (and the result will be @page..@section).
g_indentLevel=0;
}
@@ -1149,14 +1149,14 @@ static bool isBlockQuote(const char *data,int size,int indent)
{
// count >'s and skip spaces
int level=0;
- while (i<size && (data[i]=='>' || data[i]==' '))
+ while (i<size && (data[i]=='>' || data[i]==' '))
{
if (data[i]=='>') level++;
i++;
}
- // last characters should be a space or newline,
+ // last characters should be a space or newline,
// so a line starting with >= does not match
- return level>0 && i<size && ((data[i-1]==' ') || data[i]=='\n');
+ return level>0 && i<size && ((data[i-1]==' ') || data[i]=='\n');
}
else // too much indentation -> code block
{
@@ -1222,7 +1222,7 @@ static int isLinkRef(const char *data,int size,
i++;
while (i<size && data[i]==' ') i++;
}
- if (i>=size)
+ if (i>=size)
{
//printf("end of isLinkRef while looking for title! i=%d\n",i);
return i; // end of buffer while looking for the optional title
@@ -1263,7 +1263,7 @@ static int isHRuler(const char *data,int size)
while (i<size && data[i]==' ') i++;
if (i>=size) return 0; // empty line
char c=data[i];
- if (c!='*' && c!='-' && c!='_')
+ if (c!='*' && c!='-' && c!='_')
{
return 0; // not a hrule character
}
@@ -1317,13 +1317,13 @@ static int isAtxHeader(const char *data,int size,
// find start of header text and determine heading level
while (i<size && data[i]==' ') i++;
- if (i>=size || data[i]!='#')
+ if (i>=size || data[i]!='#')
{
return 0;
}
while (i<size && level<6 && data[i]=='#') i++,level++;
while (i<size && data[i]==' ') i++,blanks++;
- if (level==1 && blanks==0)
+ if (level==1 && blanks==0)
{
return 0; // special case to prevent #someid seen as a header (see bug 671395)
}
@@ -1395,7 +1395,7 @@ static int computeIndentExcludingListMarkers(const char *data,int size)
bool isDigit=FALSE;
bool isLi=FALSE;
bool listMarkerSkipped=FALSE;
- while (i<size &&
+ while (i<size &&
(data[i]==' ' || // space
(!listMarkerSkipped && // first list marker
(data[i]=='+' || data[i]=='-' || data[i]=='*' || // unordered list char
@@ -1405,7 +1405,7 @@ static int computeIndentExcludingListMarkers(const char *data,int size)
)
)
)
- )
+ )
{
if (isDigit) // skip over ordered list marker '10. '
{
@@ -1483,7 +1483,7 @@ static bool isFencedCodeBlock(const char *data,int size,int refIndent,
int endTildes=0;
while (i<size && data[i]==tildaChar) endTildes++,i++;
while (i<size && data[i]==' ') i++;
- if (i==size || data[i]=='\n')
+ if (i==size || data[i]=='\n')
{
offset=i;
return endTildes==startTildes;
@@ -1512,7 +1512,7 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent)
//printf("only spaces at the end of a comment block\n");
return FALSE;
}
-
+
i=offset;
int nl=0;
int nl_pos[3];
@@ -1542,7 +1542,7 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent)
// determine the indent of line -2
indent=computeIndentExcludingListMarkers(data+nl_pos[2],nl_pos[1]-nl_pos[2]);
-
+
//printf(">isCodeBlock local_indent %d>=%d+4=%d\n",
// indent0,indent2,indent0>=indent2+4);
// if the difference is >4 spaces -> code block
@@ -1615,7 +1615,7 @@ static bool isTableBlock(const char *data,int size)
// the first line should have at least two columns separated by '|'
int i = findTableColumns(data,size,start,end,cc0);
- if (i>=size || cc0<1)
+ if (i>=size || cc0<1)
{
//printf("isTableBlock: no |'s in the header\n");
return FALSE;
@@ -1663,7 +1663,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
// write table header, in range [start..end]
out.addStr("<tr>");
#endif
-
+
// read cell alignments
int ret = findTableColumns(data+i,size-i,start,end,cc);
k=0;
@@ -1677,12 +1677,12 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
if (!startFound)
{
if (data[j]==':') { leftMarker=TRUE; startFound=TRUE; }
- if (data[j]=='-') startFound=TRUE;
+ if (data[j]=='-') startFound=TRUE;
//printf(" data[%d]=%c startFound=%d\n",j,data[j],startFound);
}
if (data[j]=='-') rightMarker=FALSE;
else if (data[j]==':') rightMarker=TRUE;
- if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
+ if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
{
if (k<columns)
{
@@ -1751,7 +1751,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
}
out.addStr(">");
}
- if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
+ if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
{
columnStart=j+1;
k++;
@@ -1810,7 +1810,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
rowContents->insert(k, new TableCell);
while (j<=end+i)
{
- if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
+ if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
{
// do the column span test before stripping white space
// || is spanning columns, | | is not
@@ -1818,7 +1818,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
rowContents->at(k)->cellText = rowContents->at(k)->cellText.stripWhiteSpace();
k++;
rowContents->insert(k, new TableCell);
- } // if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
+ } // if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\')))
else
{
rowContents->at(k)->cellText += data[j];
@@ -1979,7 +1979,7 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size)
}
hTag.sprintf("h%d",level);
out.addStr("<"+hTag+">");
- out.addStr(header);
+ out.addStr(header);
out.addStr("</"+hTag+">\n");
}
}
@@ -2014,7 +2014,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size)
else if (j>0 && data[j-1]=='>') indent=j+1;
j++;
}
- if (j>0 && data[j-1]=='>' &&
+ if (j>0 && data[j-1]=='>' &&
!(j==size || data[j]=='\n')) // disqualify last > if not followed by space
{
indent--;
@@ -2065,7 +2065,7 @@ static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent)
while (j<end && data[j]==' ') j++,indent++;
//printf("j=%d end=%d indent=%d refIndent=%d tabSize=%d data={%s}\n",
// j,end,indent,refIndent,Config_getInt(TAB_SIZE),QCString(data+i).left(end-i-1).data());
- if (j==end-1) // empty line
+ if (j==end-1) // empty line
{
emptyLines++;
i=end;
@@ -2087,7 +2087,7 @@ static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent)
break;
}
}
- out.addStr("@endverbatim\n");
+ out.addStr("@endverbatim\n");
while (emptyLines>0) // write skipped empty lines
{
// add empty line
@@ -2152,7 +2152,7 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size,
end++;
}
}
- else if (nb==0 && data[end-1]=='`')
+ else if (nb==0 && data[end-1]=='`')
{
while (end<=size && data[end-1]=='`') end++,nb++;
}
@@ -2255,7 +2255,7 @@ static QCString processBlocks(const QCString &s,int indent)
// get indent for the first line
end = i+1;
int sp=0;
- while (end<=size && data[end-1]!='\n')
+ while (end<=size && data[end-1]!='\n')
{
if (data[end-1]==' ') sp++;
end++;
@@ -2414,7 +2414,7 @@ static QCString extractPageTitle(QCString &docs,QCString &id)
const char *data = docs.data();
int i=0;
int size=docs.size();
- while (i<size && (data[i]==' ' || data[i]=='\n'))
+ while (i<size && (data[i]==' ' || data[i]=='\n'))
{
if (data[i]=='\n') ln++;
i++;
@@ -2473,7 +2473,7 @@ static QCString detab(const QCString &s,int &refIndent)
int stop = tabSize - (col%tabSize);
//printf("expand at %d stop=%d\n",col,stop);
col+=stop;
- while (stop--) out.addChar(' ');
+ while (stop--) out.addChar(' ');
}
break;
case '\n': // reset column counter
@@ -2625,8 +2625,8 @@ MarkdownOutlineParser::~MarkdownOutlineParser()
{
}
-void MarkdownOutlineParser::parseInput(const char *fileName,
- const char *fileBuf,
+void MarkdownOutlineParser::parseInput(const char *fileName,
+ const char *fileBuf,
const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
@@ -2670,7 +2670,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
}
int lineNr=1;
- // even without markdown support enabled, we still
+ // even without markdown support enabled, we still
// parse markdown files as such
bool markdownEnabled = Doxygen::markdownSupport;
Doxygen::markdownSupport = TRUE;