Remove InsetArgument 999 workaround

Since we iterate through all arguments we can as well compute the correct id
directly.
This commit is contained in:
Georg Baum 2014-12-26 22:13:09 +01:00
parent cb7ace9143
commit f4417e8125
3 changed files with 8 additions and 16 deletions

View File

@ -188,7 +188,7 @@ A section
\begin_layout Section \begin_layout Section
\begin_inset Argument 999 \begin_inset Argument 1
status collapsed status collapsed

View File

@ -349,7 +349,7 @@ Final text
\end_deeper \end_deeper
\begin_layout Section \begin_layout Section
\begin_inset Argument 999 \begin_inset Argument 1
status collapsed status collapsed

View File

@ -637,21 +637,18 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
} }
context.check_deeper(os); context.check_deeper(os);
context.check_layout(os); context.check_layout(os);
int i = 0;
Layout::LaTeXArgMap::const_iterator lait = context.layout->latexargs().begin(); Layout::LaTeXArgMap::const_iterator lait = context.layout->latexargs().begin();
Layout::LaTeXArgMap::const_iterator const laend = context.layout->latexargs().end(); Layout::LaTeXArgMap::const_iterator const laend = context.layout->latexargs().end();
for (; lait != laend; ++lait) { for (; lait != laend; ++lait) {
++i;
eat_whitespace(p, os, context, false); eat_whitespace(p, os, context, false);
if (lait->second.mandatory) { if (lait->second.mandatory) {
if (p.next_token().cat() != catBegin) if (p.next_token().cat() != catBegin)
break; break;
p.get_token(); // eat '{' p.get_token(); // eat '{'
// FIXME: Just a workaround. InsetArgument::updateBuffer begin_inset(os, "Argument ");
// will compute a proper ID for all "999" Arguments os << i << "\nstatus collapsed\n\n";
// (which is also what lyx2lyx produces).
// However, tex2lyx should be able to output proper IDs
// itself.
begin_inset(os, "Argument 999\n");
os << "status collapsed\n\n";
parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context); parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
end_inset(os); end_inset(os);
} else { } else {
@ -659,13 +656,8 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
p.next_token().character() != '[') p.next_token().character() != '[')
break; break;
p.get_token(); // eat '[' p.get_token(); // eat '['
// FIXME: Just a workaround. InsetArgument::updateBuffer begin_inset(os, "Argument ");
// will compute a proper ID for all "999" Arguments os << i << "\nstatus collapsed\n\n";
// (which is also what lyx2lyx produces).
// However, tex2lyx should be able to output proper IDs
// itself.
begin_inset(os, "Argument 999\n");
os << "status collapsed\n\n";
parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context); parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
end_inset(os); end_inset(os);
} }