X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2Ftable.cpp;h=3cce03df4308561040fb9a1b93018fa64fbfb2ff;hb=237193f8a888777192981136469a5d4febb8e9d8;hp=a0de11126366623f118b83193d653a76fee68d5e;hpb=c00fd8f8be2a8478f0ae6c8ed92a232dba269897;p=lyx.git diff --git a/src/tex2lyx/table.cpp b/src/tex2lyx/table.cpp index a0de111263..3cce03df43 100644 --- a/src/tex2lyx/table.cpp +++ b/src/tex2lyx/table.cpp @@ -22,6 +22,7 @@ #include "support/convert.h" #include "support/lstrings.h" +#include #include #include #include @@ -31,9 +32,6 @@ using namespace std; namespace lyx { -// filled in preamble.cpp -map special_columns; - namespace { @@ -147,7 +145,7 @@ public: class ltType { public: // constructor - ltType() : topDL(false), bottomDL(false), empty(false) {} + ltType() : set(false), topDL(false), bottomDL(false), empty(false) {} // we have this header type (is set in the getLT... functions) bool set; // double borders on top @@ -420,25 +418,22 @@ void handle_colalign(Parser & p, vector & colinfo, 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 @@ -734,13 +729,13 @@ void parse_table(Parser & p, ostream & os, bool is_long_tabular, } } - 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(); @@ -786,7 +781,7 @@ void parse_table(Parser & p, ostream & os, bool is_long_tabular, // 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(); } @@ -1164,7 +1159,7 @@ void handle_tabular(Parser & p, ostream & os, string const & name, cellinfo[row][col].content += os.str(); // add dummy cells for multicol - for (size_t i = 0; i + 1 < ncells; ++i) { + for (size_t i = 0; i < ncells - 1; ++i) { ++col; if (col >= colinfo.size()) { cerr << "The cell '" @@ -1227,7 +1222,7 @@ void handle_tabular(Parser & p, ostream & os, string const & name, 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))