]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/table.cpp
Fix bug #7668 (cosmetic whitespace issues)
[lyx.git] / src / tex2lyx / table.cpp
index de4e7bd9ec5a91bdf8d7dc59d7673a52609a17cb..d23da08a73557e693648627615557da48350b2cb 100644 (file)
@@ -321,7 +321,7 @@ void handle_colalign(Parser & p, vector<ColInfo> & colinfo,
                                break;
                        case '>': {
                                // text before the next column
-                               string const s = trim(p.verbatim_item());
+                               string const s = trimSpaceAndEol(p.verbatim_item());
                                if (next.special.empty() &&
                                    next.align == 'n') {
                                        // Maybe this can be converted to a
@@ -341,7 +341,7 @@ void handle_colalign(Parser & p, vector<ColInfo> & colinfo,
                        }
                        case '<': {
                                // text after the last column
-                               string const s = trim(p.verbatim_item());
+                               string const s = trimSpaceAndEol(p.verbatim_item());
                                if (colinfo.empty())
                                        // This is not possible in LaTeX.
                                        cerr << "Ignoring separator '<{"
@@ -520,7 +520,7 @@ void parse_table(Parser & p, ostream & os, bool is_long_tabular,
                Token const & t = p.get_token();
 
 #ifdef FILEDEBUG
-               cerr << "t: " << t << " flags: " << flags << "\n";
+               debugToken(cerr, t, flags);
 #endif
 
                // comments and whitespace in hlines
@@ -770,17 +770,24 @@ void handle_hline_below(RowInfo & ri, vector<CellInfo> & ci)
 } // anonymous namespace
 
 
-void handle_tabular(Parser & p, ostream & os, bool is_long_tabular,
-                   Context & context)
+void handle_tabular(Parser & p, ostream & os, string const & name,
+                    string const & tabularwidth, Context & context)
 {
+       bool const is_long_tabular(name == "longtable");
+       string tabularvalignment("middle");
        string posopts = p.getOpt();
        if (!posopts.empty()) {
                // FIXME: Convert this to ERT
                if (is_long_tabular)
-                       cerr << "horizontal longtable";
+                       cerr << "horizontal longtable positioning '"
+                            << posopts << "' ignored\n";
+               else if (posopts == "[t]")
+                       tabularvalignment = "top";
+               else if (posopts == "[b]")
+                       tabularvalignment = "bottom";
                else
-                       cerr << "vertical tabular";
-               cerr << " positioning '" << posopts << "' ignored\n";
+                       cerr << "vertical tabular positioning '"
+                            << posopts << "' ignored\n";
        }
 
        vector<ColInfo> colinfo;
@@ -1106,8 +1113,11 @@ void handle_tabular(Parser & p, ostream & os, bool is_long_tabular,
           << "\" columns=\"" << colinfo.size() << "\">\n";
        os << "<features"
           << write_attribute("rotate", false)
-          << write_attribute("islongtable", is_long_tabular)
-          << ">\n";
+          << write_attribute("islongtable", is_long_tabular);
+       if (!is_long_tabular)
+               os << write_attribute("tabularvalignment", tabularvalignment)
+                  << write_attribute("tabularwidth", tabularwidth);
+       os << ">\n";
 
        //cerr << "// after header\n";
        for (size_t col = 0; col < colinfo.size(); ++col) {