Skip to content

Commit b3bd30f

Browse files
committed
bug 786576 regression with ALIASES or image latex interpretation
The problem is not the ALIAS but just the way the `\image` command handles its (complex) set of arguments. For this reason it is also advised to use `^^` i.e. an artificial line break in the `ALIASES` after a `\image` command. The problem is that at with the image command and argument was "read" and checked, but when it didn't fulfill the requirements it was discarded (and thus lost). The arguments of the `\image` command are well defined and we can see that there won't be commands (i.e. starting with `\` or `@` like `\htmlonly`) , symbols (starting with `&` like `&nbsp`) or html tags (starting with `<`). These constructions are, when found, terminating the `\image` command and pushed back into the "read stream".
1 parent d7eb8d2 commit b3bd30f

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/docparser.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,13 +993,26 @@ void DocParser::defaultHandleTitleAndSize(const int cmd, DocNodeVariant *parent,
993993
}
994994
else
995995
{
996+
tokenizer.unputString(context.token->name);
996997
warn_doc_error(context.fileName,tokenizer.getLineNr(),"Unknown option '%s' after \\%s command, expected 'width' or 'height'",
997998
qPrint(context.token->name), qPrint(Mappers::cmdMapper->find(cmd)));
998999
break;
9991000
}
10001001
}
10011002

10021003
tok=tokenizer.lex();
1004+
if (!(tok==TK_WHITESPACE || tok==TK_WORD))
1005+
{
1006+
if (tok==TK_COMMAND_AT || tok ==TK_COMMAND_BS)
1007+
{
1008+
tokenizer.unputString(context.token->name);
1009+
tokenizer.unputString(tok==TK_COMMAND_AT ? "@" : "\\");
1010+
}
1011+
else if (tok==TK_SYMBOL || tok==TK_HTMLTAG)
1012+
{
1013+
tokenizer.unputString(context.token->name);
1014+
}
1015+
}
10031016
}
10041017
tokenizer.setStatePara();
10051018

src/doctokenizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class DocTokenizer
142142
void pushContext();
143143
bool popContext();
144144
int lex();
145+
void unputString(const QCString &tag);
145146
void setStatePara();
146147
void setStateTitle();
147148
void setStateTitleAttrValue();

src/doctokenizer.l

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ LINENR {BLANK}*[1-9][0-9]*
955955
return TK_SYMBOL;
956956
}
957957
<St_TitleN>{HTMLTAG} {
958-
lineCount(yytext,yyleng);
958+
yyextra->token->name = yytext;
959+
return TK_HTMLTAG;
959960
}
960961
<St_TitleN>\n { /* new line => end of title */
961962
unput(*yytext);
@@ -1662,6 +1663,18 @@ int DocTokenizer::lex()
16621663
return doctokenizerYYlex(p->yyscanner);
16631664
}
16641665

1666+
void DocTokenizer::unputString(const QCString &tag)
1667+
{
1668+
yyscan_t yyscanner = p->yyscanner;
1669+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1670+
QCString tagName = tag;
1671+
int i,l = tagName.length();
1672+
for (i=l-1;i>=0;i--)
1673+
{
1674+
unput(tag[i]);
1675+
}
1676+
}
1677+
16651678
void DocTokenizer::findSections(const QCString &input,const Definition *d,
16661679
const QCString &fileName)
16671680
{

0 commit comments

Comments
 (0)