37 #include <qfileinfo.h>
57 ((data[i]>='a' && data[i]<='z') || \
58 (data[i]>='A' && data[i]<='Z') || \
59 (data[i]>='0' && data[i]<='9') || \
60 (((unsigned char)data[i])>=0x80)) // unicode characters
63 #define isOpenEmphChar(i) \
64 (data[i]=='\n' || data[i]==' ' || data[i]=='\'' || data[i]=='<' || \
65 data[i]=='{' || data[i]=='(' || data[i]=='[' || data[i]==',' || \
66 data[i]==':' || data[i]==';')
70 #define ignoreCloseEmphChar(i) \
71 (data[i]=='(' || data[i]=='{' || data[i]=='[' || data[i]=='<' || \
72 data[i]=='=' || data[i]=='+' || data[i]=='-' || data[i]=='\\' || \
113 if (s.isEmpty())
return "";
114 bool insideQuote=FALSE;
122 case '"':
if (pc!=
'\\') { insideQuote=!insideQuote; } growBuf.
addChar(c);
break;
123 case '<':
if (!insideQuote) { growBuf.
addChar(
'\\'); } growBuf.
addChar(
'<');
break;
124 case '>':
if (!insideQuote) { growBuf.
addChar(
'\\'); } growBuf.
addChar(
'>');
break;
125 case '\\':
if (!insideQuote) { growBuf.
addChar(
'\\'); } growBuf.
addChar(
'\\');
break;
126 case '@':
if (!insideQuote) { growBuf.
addChar(
'\\'); } growBuf.
addChar(
'@');
break;
127 default: growBuf.
addChar(c);
break;
132 return growBuf.
get();
138 result.resize(size+1);
139 memcpy(result.rawData(),data,size);
140 result.at(size)=
'\0';
149 if (leftMarker && rightMarker)
157 else if (rightMarker)
188 bool openBracket = offset>0 && data[-1]==
'{';
189 bool isEscaped = offset>0 && (data[-1]==
'\\' || data[-1]==
'@');
190 if (isEscaped)
return QCString();
193 while (end<size && (data[end]>=
'a' && data[end]<=
'z')) end++;
194 if (end==1)
return QCString();
197 if (blockName==
"code" && openBracket)
201 else if (blockName==
"dot" ||
204 blockName==
"verbatim" ||
205 blockName==
"latexonly" ||
206 blockName==
"htmlonly" ||
207 blockName==
"xmlonly" ||
208 blockName==
"rtfonly" ||
209 blockName==
"manonly" ||
210 blockName==
"docbookonly"
213 return "end"+blockName;
215 else if (blockName==
"startuml")
219 else if (blockName==
"f" && end<size)
225 else if (data[end]==
'[')
229 else if (data[end]==
'}')
246 while (i<size && data[i]!=c && data[i]!=
'`' &&
247 data[i]!=
'\\' && data[i]!=
'@' &&
262 while (i+len<size && data[i+len]==c)
269 if (len!=c_size || (i<size-len &&
isIdChar(i+len)))
282 while (i<size && data[i]==
'`') snb++,i++;
286 while (i<size && enb<snb)
288 if (data[i]==
'`') enb++;
289 if (snb==1 && data[i]==
'\'')
break;
293 else if (data[i]==
'@' || data[i]==
'\\')
296 if (!endBlockName.isEmpty())
299 int l = endBlockName.length();
302 if ((data[i]==
'\\' || data[i]==
'@') &&
303 data[i-1]!=
'\\' && data[i-1]!=
'@')
305 if (qstrncmp(&data[i+1],endBlockName,l)==0)
322 else if (data[i]==
'\n')
325 while (i<size && data[i]==
' ') i++;
326 if (i>=size || data[i]==
'\n')
return 0;
343 if (size>1 && data[0]==c && data[1]==c) { i=1; }
348 if (len==0)
return 0;
350 if (i>=size)
return 0;
352 if (i+1<size && data[i+1]==c)
357 if (data[i]==c && data[i-1]!=
' ' && data[i-1]!=
'\n')
381 if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=
' ' &&
412 if (data[i]!=c || data[i-1]==
' ' || data[i-1]==
'\n')
417 if (i+2<size && data[i+1]==c && data[i+2]==c)
419 out.
addStr(
"<em><strong>");
421 out.
addStr(
"</strong></em>");
424 else if (i+1<size && data[i+1]==c)
460 if (i<size && data[i]==
'-')
464 if (i<size && data[i]==
'-')
468 if (i<size && data[i]==
'-')
472 if (count==2 && (off<8 || qstrncmp(data-8,
"operator",8)!=0))
491 while (i<size && data[i]!=
'"' && nl<2)
493 if (data[i]==
'\n') nl++;
496 if (i<size && data[i]==
'"' && nl<2)
510 if (offset>0 && data[-1]==
'\\')
return 0;
516 while (i<size &&
isIdChar(i)) i++,l++;
519 if (tagName.lower()==
"pre")
521 bool insideStr=FALSE;
525 if (!insideStr && c==
'<')
527 if (data[i+1]==
'/' &&
528 tolower(data[i+2])==
'p' && tolower(data[i+3])==
'r' &&
529 tolower(data[i+4])==
'e' && tolower(data[i+5])==
'>')
536 else if (insideStr && c==
'"')
538 if (data[i-1]!=
'\\') insideStr=FALSE;
551 if (data[i]==
'/' && i<size-1 && data[i+1]==
'>')
557 else if (data[i]==
'>')
563 else if (data[i]==
' ')
566 bool insideAttr=FALSE;
569 if (!insideAttr && data[i]==
'"')
573 else if (data[i]==
'"' && data[i-1]!=
'\\')
577 else if (!insideAttr && data[i]==
'>')
595 (size>1 && data[0]!=data[1] && !(
isIdChar(1) || data[1]==
'[')) ||
596 (size>2 && data[0]==data[1] && !(
isIdChar(2) || data[2]==
'[')))
603 if (size>2 && data[1]!=c)
606 if (data[1]==
' ' || data[1]==
'\n' ||
613 if (size>3 && data[1]==c && data[2]!=c)
615 if (data[2]==
' ' || data[2]==
'\n' ||
622 if (size>4 && data[1]==c && data[2]==c && data[3]!=c)
624 if (data[3]==
' ' || data[3]==
'\n' ||
639 int contentStart,contentEnd,linkStart,titleStart,titleEnd;
640 bool isImageLink = FALSE;
646 if (size<2 || data[1]!=
'[')
661 else if (data[i]==
'[')
665 else if (data[i]==
']')
670 else if (data[i]==
'\n')
677 if (i>=size)
return 0;
681 if (!isImageLink && content.isEmpty())
return 0;
685 while (i<size && data[i]==
' ') i++;
686 if (i<size && data[i]==
'\n')
690 while (i<size && data[i]==
' ') i++;
693 bool explicitTitle=FALSE;
694 if (i<size && data[i]==
'(')
697 while (i<size && data[i]==
' ') i++;
698 if (i<size && data[i]==
'<') i++;
702 while (i<size && data[i]!=
'\'' && data[i]!=
'"' && braceCount>0)
709 else if (data[i]==
'(')
713 else if (data[i]==
')')
722 if (i>=size || data[i]==
'\n')
return 0;
724 link = link.stripWhiteSpace();
726 if (link.isEmpty())
return 0;
727 if (link.at(link.length()-1)==
'>') link=link.left(link.length()-1);
730 if (data[i]==
'\'' || data[i]==
'"')
736 while (i<size && data[i]!=
')')
751 while (titleEnd>titleStart && data[titleEnd]==
' ') titleEnd--;
752 if (data[titleEnd]==c)
764 else if (i<size && data[i]==
'[')
770 while (i<size && data[i]!=
']')
779 if (i>=size)
return 0;
783 link = link.stripWhiteSpace();
803 else if (i<size && data[i]!=
':' && !content.isEmpty())
814 else if (content==
"TOC")
831 if (g_current) g_current->
stat=TRUE;
833 else if (isImageLink)
837 if (link.find(
"@ref ")!=-1 || link.find(
"\\ref ")!=-1 ||
841 out.
addStr(
"@image html ");
842 out.
addStr(link.mid(fd ? 0 : 5));
843 if (!explicitTitle && !content.isEmpty())
849 else if ((content.isEmpty() || explicitTitle) && !title.isEmpty())
858 out.
addStr(
"<img src=\"");
863 if (!title.isEmpty())
876 if ((lp=link.find(
"@ref "))!=-1 || (lp=link.find(
"\\ref "))!=-1 || lang==
SrcLangExt_Markdown)
885 if (explicitTitle && !title.isEmpty())
895 else if (link.find(
'/')!=-1 || link.find(
'.')!=-1 || link.find(
'#')!=-1)
900 if (!title.isEmpty())
907 content = content.simplifyWhiteSpace();
923 int end, nb = 0, i, f_begin, f_end;
926 while (nb<size && data[nb]==
'`')
934 for (end=nb; end<size && i<nb && nl<2; end++)
940 else if (data[end]==
'\n')
950 if (i < nb && end >= size)
961 while (f_begin < end && data[f_begin]==
' ')
966 while (f_end > nb && data[f_end-1]==
' ')
976 if (data[i]==
'\'' && !
isIdChar(i+1))
988 QCString codeFragment;
1003 if (!endBlockName.isEmpty())
1005 int l = endBlockName.length();
1008 if ((data[i]==
'\\' || data[i]==
'@') &&
1009 data[i-1]!=
'\\' && data[i-1]!=
'@')
1011 if (qstrncmp(&data[i+1],endBlockName,l)==0)
1021 if (size>1 && data[0]==
'\\')
1024 if (c==
'[' || c==
']' || c==
'*' || c==
'!' || c==
'(' || c==
')' || c==
'`' || c==
'_')
1029 else if (c==
'-' && size>3 && data[2]==
'-' && data[3]==
'-')
1034 else if (c==
'-' && size>2 && data[2]==
'-')
1049 while (end<size && ((action=
g_actions[(uchar)data[end]])==0)) end++;
1050 out.
addStr(data+i,end-i);
1051 if (end>=size)
break;
1053 end = action(out,data+i,i,size-i);
1070 while (i<size && data[i]==
' ') i++;
1075 while (i<size && data[i]==
'=') i++,c++;
1076 while (i<size && data[i]==
' ') i++;
1077 return (c>1 && (i>=size || data[i]==
'\n')) ? 1 : 0;
1082 while (i<size && data[i]==
'-') i++,c++;
1083 while (i<size && data[i]==
' ') i++;
1084 return (c>1 && (i>=size || data[i]==
'\n')) ? 2 : 0;
1093 while (i<size && data[i]==
' ') i++;
1098 while (i<size && (data[i]==
'>' || data[i]==
' '))
1100 if (data[i]==
'>') level++;
1105 return level>0 && i<size && ((data[i-1]==
' ') || data[i]==
'\n');
1116 QCString &refid,QCString &link,QCString &title)
1121 while (i<size && data[i]==
' ') i++;
1122 if (i>=size || data[i]!=
'[')
return 0;
1125 while (i<size && data[i]!=
'\n' && data[i]!=
']') i++;
1126 if (i>=size || data[i]!=
']')
return 0;
1128 if (refid.isEmpty())
return 0;
1131 if (i>=size || data[i]!=
':')
return 0;
1135 while (i<size && data[i]==
' ') i++;
1136 if (i<size && data[i]==
'\n')
1139 while (i<size && data[i]==
' ') i++;
1141 if (i>=size)
return 0;
1143 if (i<size && data[i]==
'<') i++;
1145 while (i<size && data[i]!=
' ' && data[i]!=
'\n') i++;
1147 if (i<size && data[i]==
'>') i++;
1148 if (linkStart==linkEnd)
return 0;
1151 if (link==
"@ref" || link==
"\\ref")
1154 while (i<size && data[i]!=
'\n' && data[i]!=
'"') i++;
1164 while (i<size && data[i]==
' ') i++;
1165 if (i<size && data[i]==
'\n')
1169 while (i<size && data[i]==
' ') i++;
1178 if (c==
'\'' || c==
'"' || c==
'(')
1185 while (i<size && data[i]!=
'\n') i++;
1190 while (end>titleStart && data[end]!=c) end--;
1197 while (i<size && data[i]==
' ') i++;
1200 if (i>=size)
return i;
1201 else if (eol)
return eol;
1208 if (size>0 && data[size-1]==
'\n') size--;
1209 while (i<size && data[i]==
' ') i++;
1210 if (i>=size)
return 0;
1212 if (c!=
'*' && c!=
'-' && c!=
'_')
1223 else if (data[i]!=
' ')
1235 static QRegExp r2(
"\\{#[a-z_A-Z][a-z_A-Z0-9\\-]*\\}");
1237 int i = r2.match(title,0,&l);
1238 if (i!=-1 && title.mid(i+l).stripWhiteSpace().isEmpty())
1240 QCString
id = title.mid(i+2,l-3);
1241 title = title.left(i);
1245 if ((level > 0) && (level <=
Config_getInt(TOC_INCLUDE_HEADINGS)))
1247 static int autoId = 0;
1249 id.sprintf(
"autotoc_md%d",autoId++);
1259 QCString &header,QCString &
id)
1262 int level = 0, blanks=0;
1265 while (i<size && data[i]==
' ') i++;
1266 if (i>=size || data[i]!=
'#')
1270 while (i<size && level<6 && data[i]==
'#') i++,level++;
1271 while (i<size && data[i]==
' ') i++,blanks++;
1272 if (level==1 && blanks==0)
1279 while (end<size && data[end]!=
'\n') end++;
1280 while (end>i && (data[end-1]==
'#' || data[end-1]==
' ')) end--;
1287 i=header.length()-1;
1288 while (i>=0 && (header.at(i)==
'#' || header.at(i)==
' ')) i--;
1289 header=header.left(i+1);
1300 if (data[i]==
'\n')
return TRUE;
1301 if (data[i]!=
' ')
return FALSE;
1307 #define isLiTag(i) \
1308 (data[(i)]=='<' && \
1309 (data[(i)+1]=='l' || data[(i)+1]=='L') && \
1310 (data[(i)+2]=='i' || data[(i)+2]=='I') && \
1321 bool listMarkerSkipped=FALSE;
1324 (!listMarkerSkipped &&
1325 (data[i]==
'+' || data[i]==
'-' || data[i]==
'*' ||
1326 (data[i]==
'#' && i>0 && data[i-1]==
'-') ||
1327 (isDigit=(data[i]>=
'1' && data[i]<=
'9')) ||
1328 (isLi=(i<size-3 &&
isLiTag(i)))
1337 while (j<size && ((data[j]>=
'0' && data[j]<=
'9') || data[j]==
'.'))
1341 if (j<size-1 && data[j+1]==
' ')
1343 listMarkerSkipped=TRUE;
1360 listMarkerSkipped=TRUE;
1362 else if (data[i]==
'-' && i<size-2 && data[i+1]==
'#' && data[i+2]==
' ')
1364 listMarkerSkipped=TRUE;
1368 else if (data[i]!=
' ' && i<size-1 && data[i+1]==
' ')
1370 listMarkerSkipped=TRUE;
1372 if (data[i]!=
' ' && !listMarkerSkipped)
1383 QCString &lang,
int &start,
int &end,
int &offset)
1390 while (i<size && data[i]==
' ') indent++,i++;
1391 if (indent>=refIndent+4)
return FALSE;
1393 if (i<size && data[i]==
'`') tildaChar=
'`';
1394 while (i<size && data[i]==tildaChar) startTildes++,i++;
1395 if (startTildes<3)
return FALSE;
1396 if (i<size && data[i]==
'{') i++;
1398 while (i<size && (data[i]!=
'\n' && data[i]!=
'}' && data[i]!=
' ')) i++;
1400 while (i<size && data[i]!=
'\n') i++;
1404 if (data[i]==tildaChar)
1408 while (i<size && data[i]==tildaChar) endTildes++,i++;
1409 while (i<size && data[i]==
' ') i++;
1410 if (i==size || data[i]==
'\n')
1413 return endTildes==startTildes;
1421 static bool isCodeBlock(
const char *data,
int offset,
int size,
int &indent)
1427 while (i<size && data[i]==
' ') indent0++,i++;
1434 if (indent0>=size || data[indent0]==
'\n')
1446 if (data[i-offset-1]==
'\n') nl_pos[nl++]=i-offset;
1451 if (i==0 && nl==2) nl_pos[nl++]=-offset;
1462 if (!
isEmptyLine(data+nl_pos[1],nl_pos[0]-nl_pos[1]-1))
1502 while (i<size && data[i]==
' ') i++;
1503 if (i<size && data[i]==
'|' && data[i]!=
'\n') i++,n++;
1507 while (i<size && data[i]!=
'\n') i++;
1510 while (i>0 && data[i]==
' ') i--;
1511 if (i>0 && data[i-1]!=
'\\' && data[i]==
'|') i--,n++;
1521 if (data[i]==
'|' && (i==0 || data[i-1]!=
'\\')) columns++;
1522 if (columns==1) columns++;
1526 if (n==2 && columns==0)
1542 if (i>=size || cc0<1)
1554 if (data[j]!=
':' && data[j]!=
'-' && data[j]!=
'|' && data[j]!=
' ')
1577 int columns,start,end,cc;
1586 int headerStart = start;
1587 int headerEnd = end;
1594 bool leftMarker=FALSE,rightMarker=FALSE;
1595 bool startFound=FALSE;
1601 if (data[j]==
':') { leftMarker=TRUE; startFound=TRUE; }
1602 if (data[j]==
'-') startFound=TRUE;
1605 if (data[j]==
'-') rightMarker=FALSE;
1606 else if (data[j]==
':') rightMarker=TRUE;
1607 if (j<=end+i && (data[j]==
'|' && (j==0 || data[j-1]!=
'\\')))
1630 for (k=0;k<columns;k++)
1633 switch (columnAlignment[k])
1641 while (m<=headerEnd && (data[m]!=
'|' || (m>0 && data[m-1]==
'\\')))
1654 if (cc!=columns)
break;
1665 switch (columnAlignment[k])
1674 if (j<=end+i && (data[j]==
'|' && (j==0 || data[j-1]!=
'\\')))
1693 delete[] columnAlignment;
1707 else if ((level=
isAtxHeader(data,size,header,
id)))
1712 if (level<5 && !
id.isEmpty())
1717 case 1: out.
addStr(
"@section ");
1720 case 2: out.
addStr(
"@subsection ");
1723 case 3: out.
addStr(
"@subsubsection ");
1726 default: out.
addStr(
"@paragraph ");
1751 g_current->
anchors->append(si);
1760 out.
addStr(
"\\anchor "+
id+
"\n");
1762 hTag.sprintf(
"h%d",level);
1763 out.
addStr(
"<"+hTag+
">");
1765 out.
addStr(
"</"+hTag+
">\n");
1784 while (end<=size && data[end-1]!=
'\n') end++;
1789 while (j<end && (data[j]==
' ' || data[j]==
'>'))
1791 if (data[j]==
'>') { level++; indent=j+1; }
1792 else if (j>0 && data[j-1]==
'>') indent=j+1;
1795 if (j>0 && data[j-1]==
'>' &&
1796 !(j==size || data[j]==
'\n'))
1803 for (l=curLevel;l<level;l++)
1805 out.
addStr(
"<blockquote>\n");
1808 else if (level<curLevel)
1810 for (l=level;l<curLevel;l++)
1812 out.
addStr(
"</blockquote>\n");
1816 if (level==0)
break;
1818 out.
addStr(data+indent,end-indent);
1823 for (l=0;l<curLevel;l++)
1825 out.
addStr(
"</blockquote>\n");
1834 out.
addStr(
"@verbatim\n");
1840 while (end<=size && data[end-1]!=
'\n') end++;
1843 while (j<end && data[j]==
' ') j++,indent++;
1853 while (emptyLines>0)
1868 out.
addStr(
"@endverbatim\n");
1869 while (emptyLines>0)
1882 int &pi,
int&i,
int &end)
1887 while (end<=size && data[end-1]!=
'\n')
1891 if ((data[end-1]==
'\\' || data[end-1]==
'@') &&
1892 (end<=1 || (data[end-2]!=
'\\' && data[end-2]!=
'@'))
1895 QCString endBlockName =
isBlockCommand(data+end-1,end-1,size-(end-1));
1897 if (!endBlockName.isEmpty())
1899 int l = endBlockName.length();
1900 for (;end<size-l-1;end++)
1902 if ((data[end]==
'\\' || data[end]==
'@') &&
1903 data[end-1]!=
'\\' && data[end-1]!=
'@'
1906 if (qstrncmp(&data[end+1],endBlockName,l)==0)
1911 out.
addStr(data+pi,i-pi);
1915 out.
addStr(data+i,end+l+1-i);
1925 else if (nb==0 && data[end-1]==
'<' && end<size-6 &&
1926 (end<=1 || (data[end-2]!=
'\\' && data[end-2]!=
'@'))
1929 if (tolower(data[end])==
'p' && tolower(data[end+1])==
'r' &&
1930 tolower(data[end+2])==
'e' && data[end+3]==
'>')
1934 out.
addStr(data+pi,i-pi);
1937 out.
addStr(data+i,end-1-i);
1949 else if (nb==0 && data[end-1]==
'`')
1951 while (end<=size && data[end-1]==
'`') end++,nb++;
1953 else if (nb>0 && data[end-1]==
'`')
1956 while (end<=size && data[end-1]==
'`') end++,enb++;
1968 int blockStart,
int blockEnd)
1970 QCString lang = lng;
1971 if (!lang.isEmpty() && lang.at(0)==
'.') lang=lang.mid(1);
1973 if (!lang.isEmpty())
1975 out.
addStr(
"{"+lang+
"}");
1977 out.
addStr(data+blockStart,blockEnd-blockStart);
1985 const char *data = s.data();
1986 int size = s.length();
1987 int i=0,end=0,pi=-1;
1988 int blockStart,blockEnd,blockOffset;
1997 if (
isFencedCodeBlock(data+pi,size-pi,refIndent,lang,blockStart,blockEnd,blockOffset))
2015 out.
addStr(data+pi,i-pi);
2021 if (pi!=-1 && pi<size)
2029 out.
addStr(data+pi,size-pi);
2043 const char *data = s.data();
2044 int size = s.length();
2045 int i=0,end=0,pi=-1,ref,level;
2046 QCString id,link,title;
2047 int blockIndent = indent;
2052 while (end<=size && data[end-1]!=
'\n')
2054 if (data[end-1]==
' ') sp++;
2058 #if 0 // commented out, since starting with a comment block is probably a usage error
2081 int blockStart,blockEnd,blockOffset;
2083 blockIndent = indent;
2090 while (pi<size && data[pi]==
' ') pi++;
2095 if (!header.isEmpty())
2099 out.
addStr(level==1?
"@section ":
"@subsection ");
2122 g_current->
anchors->append(si);
2129 out.
addStr(level==1?
"<h1>":
"<h2>");
2131 out.
addStr(level==1?
"\n</h1>\n":
"\n</h2>\n");
2143 else if ((ref=
isLinkRef(data+pi,size-pi,
id,link,title)))
2152 else if (
isFencedCodeBlock(data+pi,size-pi,indent,lang,blockStart,blockEnd,blockOffset))
2186 if (pi!=-1 && pi<size)
2188 if (
isLinkRef(data+pi,size-pi,
id,link,title))
2208 const char *data = docs.data();
2211 int size=docs.size();
2212 while (i<size && (data[i]==
' ' || data[i]==
'\n'))
2217 (data[i]==
'\\' || data[i]==
'@') &&
2218 (qstrncmp(&data[i+1],
"page ",5)==0 || qstrncmp(&data[i+1],
"mainpage",8)==0)
2232 const char *data = docs.data();
2234 int size=docs.size();
2235 while (i<size && (data[i]==
' ' || data[i]==
'\n'))
2237 if (data[i]==
'\n') ln++;
2240 if (i>=size)
return "";
2242 while (end1<size && data[end1-1]!=
'\n') end1++;
2250 while (end2<size && data[end2-1]!=
'\n') end2++;
2256 docs=lns+docs.mid(end2);
2262 if (i<end1 &&
isAtxHeader(data+i,end1-i,title,
id)>0)
2264 docs=docs.mid(end1);
2270 static QCString
detab(
const QCString &s,
int &refIndent)
2274 int size = s.length();
2275 const char *data = s.data();
2278 const int maxIndent=1000000;
2279 int minIndent=maxIndent;
2287 int stop = tabSize - (col%tabSize);
2290 while (stop--) out.
addChar(
' ');
2306 if (((uchar)c&0xE0)==0xE0 && i<size)
2310 if (((uchar)c&0xF0)==0xF0 && i<size)
2315 if (col<minIndent) minIndent=col;
2319 if (minIndent!=maxIndent) refIndent=minIndent;
else refIndent=0;
2329 static bool init=FALSE;
2352 if (input.isEmpty())
return input;
2356 QCString s =
detab(input,refIndent);
2367 Debug::print(
Debug::Markdown,0,
"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",qPrint(input),qPrint(out.
get()));
2375 QCString baseFn =
stripFromPath(QFileInfo(fileName).absFilePath().utf8());
2376 int i = baseFn.findRev(
'.');
2377 if (i!=-1) baseFn = baseFn.left(i);
2379 return "md_"+baseName;
2383 const char *fileBuf,
2393 QCString docs = fileBuf;
2396 QCString titleFn = QFileInfo(fileName).baseName().utf8();
2397 QCString fn = QFileInfo(fileName).fileName().utf8();
2398 static QCString mdfileAsMainPage =
Config_getString(USE_MDFILE_AS_MAINPAGE);
2402 if (!mdfileAsMainPage.isEmpty() &&
2403 (fn==mdfileAsMainPage ||
2404 QFileInfo(fileName).absFilePath()==
2405 QFileInfo(mdfileAsMainPage).absFilePath())
2408 docs.prepend(
"@mainpage "+title+
"\n");
2410 else if (
id==
"mainpage" ||
id==
"index")
2412 if (title.isEmpty()) title = titleFn;
2413 docs.prepend(
"@mainpage "+title+
"\n");
2417 if (title.isEmpty()) title = titleFn;
2418 docs.prepend(
"@page "+
id+
" "+title+
"\n");
2429 bool needsEntry = FALSE;
2446 QCString docFile = current->
docFile;
2448 current =
new Entry;
2465 const char *scopeName,
2466 const QCString &input,
2468 bool isExampleBlock,
2469 const char *exampleName,
2473 bool inlineFragment,
2475 bool showLineNumbers,
2484 codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName,
2485 fileDef,startLine,endLine,inlineFragment,memberDef,showLineNumbers,
2486 searchCtx,collectXRefs);