class RowInfo {
public:
RowInfo() : topline(false), bottomline(false), type(LT_NORMAL),
- newpage(false) {}
+ caption(false), newpage(false) {}
/// horizontal line above
bool topline;
/// horizontal line below
/// These are for longtabulars only
/// row type (head, foot, firsthead etc.)
LTRowType type;
+ /// row for a caption
+ bool caption;
/// row for a newpage
bool newpage;
};
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
}
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 '<{"
Token const & t = p.get_token();
#ifdef FILEDEBUG
- cerr << "t: " << t << " flags: " << flags << "\n";
+ debugToken(cerr, t, flags);
#endif
// comments and whitespace in hlines
// special cell properties alignment
vector<ColInfo> t;
handle_colalign(p, t, ColInfo());
+ p.skip_spaces(true);
ColInfo & ci = t.front();
// The logic of LyX for multicolumn vertical
cellinfo[row][col].align = 'c';
}
+ } else if (col == 0 && is_long_tabular &&
+ p.next_token().cs() == "caption") {
+ // longtable caption support in LyX is a hack:
+ // Captions require a row of their own with
+ // the caption flag set to true, having only
+ // one multicolumn cell. The contents of that
+ // cell must contain exactly one caption inset
+ // and nothing else.
+ rowinfo[row].caption = true;
+ for (size_t c = 1; c < cells.size(); ++c) {
+ if (!cells[c].empty()) {
+ cerr << "Moving cell content '"
+ << cells[c]
+ << "' into the caption cell. "
+ "This will probably not work."
+ << endl;
+ cells[0] += cells[c];
+ }
+ }
+ cells.resize(1);
+ cellinfo[row][col].align = colinfo[col].align;
+ cellinfo[row][col].multi = CELL_BEGIN_OF_MULTICOLUMN;
+ ostringstream os;
+ parse_text_in_inset(p, os, FLAG_CELL, false, context);
+ cellinfo[row][col].content += os.str();
+ // add dummy multicolumn cells
+ for (size_t c = 1; c < colinfo.size(); ++c)
+ cellinfo[row][c].multi = CELL_PART_OF_MULTICOLUMN;
+
} else {
cellinfo[row][col].leftlines = colinfo[col].leftlines;
cellinfo[row][col].rightlines = colinfo[col].rightlines;
<< write_attribute("endlastfoot",
rowinfo[row].type == LT_LASTFOOT)
<< write_attribute("newpage", rowinfo[row].newpage)
+ << write_attribute("caption", rowinfo[row].caption)
<< ">\n";
for (size_t col = 0; col < colinfo.size(); ++col) {
CellInfo const & cell = cellinfo[row][col];