Commit 4959a6a0 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 702189 - Markdown and @image

parent e590d56b
...@@ -414,8 +414,8 @@ static bool parseMore; ...@@ -414,8 +414,8 @@ static bool parseMore;
static int g_condCount; static int g_condCount;
static int g_commentCount; static int g_commentCount;
static bool g_spaceBeforeCmd; static QCString g_spaceBeforeCmd;
static bool g_spaceBeforeIf; static QCString g_spaceBeforeIf;
static QCString g_copyDocArg; static QCString g_copyDocArg;
static QCString g_guardExpr; static QCString g_guardExpr;
...@@ -1033,17 +1033,17 @@ RCSTAG "$"{ID}":"[^\n$]+"$" ...@@ -1033,17 +1033,17 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
// the {B}* in the front was added for bug620924 // the {B}* in the front was added for bug620924
QCString cmdName = QCString(yytext).stripWhiteSpace().data()+1; QCString cmdName = QCString(yytext).stripWhiteSpace().data()+1;
DocCmdMapper::Cmd *cmdPtr = DocCmdMapper::map(cmdName); DocCmdMapper::Cmd *cmdPtr = DocCmdMapper::map(cmdName);
g_spaceBeforeCmd = yytext[0]==' ' || yytext[0]=='\t';
if (cmdPtr) // special action is required if (cmdPtr) // special action is required
{ {
int i=0;
while (yytext[i]==' ' || yytext[i]=='\t') i++;
g_spaceBeforeCmd = QCString(yytext).left(i);
if (cmdPtr->endsBrief) if (cmdPtr->endsBrief)
{ {
briefEndsAtDot=FALSE; briefEndsAtDot=FALSE;
// this command forces the end of brief description // this command forces the end of brief description
setOutput(OutputDoc); setOutput(OutputDoc);
} }
int i=0;
while (yytext[i]==' ' || yytext[i]=='\t') i++;
//if (i>0) addOutput(QCString(yytext).left(i)); // removed for bug 689341 //if (i>0) addOutput(QCString(yytext).left(i)); // removed for bug 689341
if (cmdPtr->func && cmdPtr->func(cmdName)) if (cmdPtr->func && cmdPtr->func(cmdName))
{ {
...@@ -1067,7 +1067,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" ...@@ -1067,7 +1067,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
{ {
// command without handler, to be processed // command without handler, to be processed
// later by parsedoc.cpp // later by parsedoc.cpp
addOutput(yytext+i); addOutput(yytext);
} }
} }
else // command not relevant else // command not relevant
...@@ -1795,15 +1795,15 @@ RCSTAG "$"{ID}":"[^\n$]+"$" ...@@ -1795,15 +1795,15 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
addOutput(*yytext); addOutput(*yytext);
} }
<GuardParamEnd>{B}*{DOCNL} { <GuardParamEnd>{B}*{DOCNL} {
g_spaceBeforeIf=FALSE; g_spaceBeforeIf.resize(0);
BEGIN(Comment); BEGIN(Comment);
} }
<GuardParamEnd>{B}* { <GuardParamEnd>{B}* {
if (g_spaceBeforeIf) // needed for 665313 in combation with bug620924 if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combation with bug620924
{ {
addOutput(" "); addOutput(g_spaceBeforeIf);
} }
g_spaceBeforeIf=FALSE; g_spaceBeforeIf.resize(0);
BEGIN(Comment); BEGIN(Comment);
} }
<GuardParamEnd>. { <GuardParamEnd>. {
...@@ -2430,10 +2430,10 @@ static bool handleSubpage(const QCString &s) ...@@ -2430,10 +2430,10 @@ static bool handleSubpage(const QCString &s)
warn(yyFileName,yyLineNr, warn(yyFileName,yyLineNr,
"found \\subpage command in a comment block that is not marked as a page!"); "found \\subpage command in a comment block that is not marked as a page!");
} }
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
addOutput("@"+s+" "); addOutput("@"+s+" ");
BEGIN(SubpageLabel); BEGIN(SubpageLabel);
...@@ -2449,10 +2449,10 @@ static bool handleAnchor(const QCString &s) ...@@ -2449,10 +2449,10 @@ static bool handleAnchor(const QCString &s)
static bool handleCite(const QCString &s) static bool handleCite(const QCString &s)
{ {
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
addOutput("@"+s+" "); addOutput("@"+s+" ");
BEGIN(CiteLabel); BEGIN(CiteLabel);
...@@ -2535,10 +2535,10 @@ static bool handleEndIf(const QCString &) ...@@ -2535,10 +2535,10 @@ static bool handleEndIf(const QCString &)
delete guards.pop(); delete guards.pop();
} }
enabledSectionFound=FALSE; enabledSectionFound=FALSE;
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
BEGIN( GuardParamEnd ); BEGIN( GuardParamEnd );
return FALSE; return FALSE;
...@@ -2689,10 +2689,10 @@ static bool handleCopyBrief(const QCString &) ...@@ -2689,10 +2689,10 @@ static bool handleCopyBrief(const QCString &)
// otherwise it will be copied inline (see bug691315 & bug700788) // otherwise it will be copied inline (see bug691315 & bug700788)
setOutput(OutputBrief); setOutput(OutputBrief);
} }
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
addOutput("\\copybrief "); addOutput("\\copybrief ");
return FALSE; return FALSE;
...@@ -2701,10 +2701,10 @@ static bool handleCopyBrief(const QCString &) ...@@ -2701,10 +2701,10 @@ static bool handleCopyBrief(const QCString &)
static bool handleCopyDetails(const QCString &) static bool handleCopyDetails(const QCString &)
{ {
setOutput(OutputDoc); setOutput(OutputDoc);
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
addOutput("\\copydetails "); addOutput("\\copydetails ");
return FALSE; return FALSE;
...@@ -2713,10 +2713,10 @@ static bool handleCopyDetails(const QCString &) ...@@ -2713,10 +2713,10 @@ static bool handleCopyDetails(const QCString &)
static bool handleCopyDoc(const QCString &) static bool handleCopyDoc(const QCString &)
{ {
setOutput(OutputBrief); setOutput(OutputBrief);
if (g_spaceBeforeCmd) if (!g_spaceBeforeCmd.isEmpty())
{ {
addOutput(' '); addOutput(g_spaceBeforeCmd);
g_spaceBeforeCmd=FALSE; g_spaceBeforeCmd.resize(0);
} }
addOutput("\\copybrief "); addOutput("\\copybrief ");
g_copyDocArg.resize(0); g_copyDocArg.resize(0);
...@@ -2775,8 +2775,8 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, ...@@ -2775,8 +2775,8 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
briefEndsAtDot = isAutoBriefOn; briefEndsAtDot = isAutoBriefOn;
g_condCount = 0; g_condCount = 0;
g_sectionLevel = 0; g_sectionLevel = 0;
g_spaceBeforeCmd = FALSE; g_spaceBeforeCmd.resize(0);
g_spaceBeforeIf = FALSE; g_spaceBeforeIf.resize(0);
if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment