namespace lyx {
-// filled in preamble.cpp
-map<char, int> special_columns;
-
namespace {
next.special += t.character();
next.special += '{' + p.verbatim_item() + '}';
break;
- default:
+ default: {
// try user defined column types
- if (special_columns.find(t.character()) !=
- special_columns.end()) {
- ci2special(next);
- next.special += t.character();
- int const nargs =
- special_columns[t.character()];
- for (int i = 0; i < nargs; ++i)
- next.special += '{' +
- p.verbatim_item() +
- '}';
- colinfo.push_back(next);
- next = ColInfo();
- } else
- cerr << "Ignoring column specification"
- " '" << t << "'." << endl;
+ // unknown column types (nargs == -1) are
+ // assumed to consume no arguments
+ ci2special(next);
+ next.special += t.character();
+ int const nargs =
+ preamble.getSpecialTableColumnArguments(t.character());
+ for (int i = 0; i < nargs; ++i)
+ next.special += '{' +
+ p.verbatim_item() + '}';
+ colinfo.push_back(next);
+ next = ColInfo();
break;
}
+ }
}
// Maybe we have some column separators that need to be added to the
}
}
- else if (t.cat() == catSpace
+ else if (t.cat() == catSpace
|| t.cat() == catNewline
- || t.cat() == catLetter
- || t.cat() == catSuper
- || t.cat() == catSub
- || t.cat() == catOther
- || t.cat() == catActive
+ || t.cat() == catLetter
+ || t.cat() == catSuper
+ || t.cat() == catSub
+ || t.cat() == catOther
+ || t.cat() == catActive
|| t.cat() == catParameter)
os << t.cs();
// treat the nested environment as a block, don't
// parse &, \\ etc, because they don't belong to our
// table if they appear.
- os << p.verbatimEnvironment(name);
+ os << p.ertEnvironment(name);
os << "\\end{" << name << '}';
active_environments.pop_back();
}
cellinfo[row][col].content += os.str();
// add dummy cells for multicol
- for (size_t i = 0; i < ncells - 1 && col < colinfo.size(); ++i) {
+ for (size_t i = 0; i < ncells - 1; ++i) {
++col;
+ if (col >= colinfo.size()) {
+ cerr << "The cell '"
+ << cells[cell]
+ << "' specifies "
+ << convert<string>(ncells)
+ << " columns while the table has only "
+ << convert<string>(colinfo.size())
+ << " columns!"
+ << " Therefore the surplus columns will be ignored."
+ << endl;
+ break;
+ }
cellinfo[row][col].multi = CELL_PART_OF_MULTICOLUMN;
cellinfo[row][col].align = 'c';
}
angle = p.getArg('{', '}');
}
active_environments.push_back(env);
- p.verbatimEnvironment(env);
+ p.ertEnvironment(env);
active_environments.pop_back();
p.skip_spaces();
if (!p.good() && support::isStrInt(angle))