tex2lyx: text.cpp, Parser.h, Parser.cpp:

fix the import of \makebox, fixes http://bugzilla.lyx.org/show_bug.cgi?id=2504

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24244 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2008-04-12 12:50:04 +00:00
parent 0aac671e83
commit d3b2f94388
3 changed files with 22 additions and 0 deletions

View File

@ -317,6 +317,13 @@ string Parser::getOpt()
return res.empty() ? string() : '[' + res + ']';
}
string Parser::getFullParentheseOpt()
{
Arg arg = getFullArg('(', ')');
if (arg.first)
return '(' + arg.second + ')';
return arg.second;
}
string const Parser::verbatimEnvironment(string const & name)
{

View File

@ -158,6 +158,8 @@ public:
* <tt>\begin{name}</tt> must be parsed already, <tt>\end{name}</tt>
* is parsed but not returned.
*/
std::string getFullParentheseOpt();
/// \returns getArg('(', ')') including the parentheses
std::string const verbatimEnvironment(std::string const & name);
/// Returns the character of the current token and increments the token position.
char getChar();

View File

@ -2345,6 +2345,19 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
else if (t.cs() == "parbox")
parse_box(p, os, FLAG_ITEM, outer, context, true);
//\makebox() is part of the picture environment and different from \makebox{}
//\makebox{} will be parsed by parse_box when bug 2956 is fixed
else if (t.cs() == "makebox") {
string arg = "\\makebox";
if (p.next_token().character() == '(')
//the syntax is: \makebox(x,y)[position]{content}
arg += p.getFullParentheseOpt();
else
//the syntax is: \makebox[width][position]{content}
arg += p.getFullOpt();
handle_ert(os, arg + p.getFullOpt(), context);
}
else if (t.cs() == "smallskip" ||
t.cs() == "medskip" ||