Michael Schmitt wrote: > - The file format for tables is absolutely bloated. Can't we suppress tags that have > default values (e.g. endfoot="false" or width="0pt" )? Two tiny tables => >1500 >lines in LyX file!!!
please try the attached patch. It decreases the filesize of docs with a lot of tables! There should be no problem, because the readNew(), which is not changed, follows a logical structure: a not given option is set to it's default. Herbert -- http://www.lyx.org/help/
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.542 diff -u -r1.542 ChangeLog --- src/ChangeLog 2002/01/19 20:24:01 1.542 +++ src/ChangeLog 2002/01/19 23:01:23 @@ -1,3 +1,11 @@ +2002-01-20 Herbert Voss <[EMAIL PROTECTED]> + + * tabular.C (write): not a bug, but mentioned by Michael - + write only the non defaults in the lyx-file for + table - row - column. No compatibility problem, because + the reading of a table follows a logical structure; if + no option is given it is set to the default. + 2002-01-19 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * tabular.C (Validate): remove broken optimization (fixes bug #201) Index: src/tabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular.C,v retrieving revision 1.116 diff -u -r1.116 tabular.C --- src/tabular.C 2002/01/19 20:24:03 1.116 +++ src/tabular.C 2002/01/19 23:01:23 @@ -1011,54 +1011,90 @@ << write_attribute("columns", columns_) << ">\n"; // global longtable options - os << "<features" - << write_attribute("rotate", tostr(rotate)) - << write_attribute("islongtable", tostr(is_long_tabular)) - << write_attribute("firstHeadTopDL", tostr(endfirsthead.topDL)) - << write_attribute("firstHeadBottomDL", tostr(endfirsthead.bottomDL)) - << write_attribute("firstHeadEmpty", tostr(endfirsthead.empty)) - << write_attribute("headTopDL", tostr(endhead.topDL)) - << write_attribute("headBottomDL", tostr(endhead.bottomDL)) - << write_attribute("footTopDL", tostr(endfoot.topDL)) - << write_attribute("footBottomDL", tostr(endfoot.bottomDL)) - << write_attribute("lastFootTopDL", tostr(endlastfoot.topDL)) - << write_attribute("lastFootBottomDL", tostr(endlastfoot.bottomDL)) - << write_attribute("lastFootEmpty", tostr(endlastfoot.empty)) - << ">\n"; + os << "<features"; + if (rotate) + os << write_attribute("rotate", "true"); + if (is_long_tabular) + os << write_attribute("longtable", "true"); + if (endfirsthead.topDL) + os << write_attribute("firstHeadTopDL", "true"); + if (endfirsthead.bottomDL) + os << write_attribute("firstHeadBottomDL", "true"); + if (endfirsthead.empty) + os << write_attribute("firstHeadEmpty", "true"); + if (endhead.topDL) + os << write_attribute("headTopDL", "true"); + if (endhead.bottomDL) + os << write_attribute("headBottomDL", "true"); + if (endfoot.topDL) + os << write_attribute("footTopDL", "true"); + if (endfoot.bottomDL) + os << write_attribute("footBottomDL", "true"); + if (endlastfoot.topDL) + os << write_attribute("lastFootTopDL", "true"); + if (endlastfoot.bottomDL) + os << write_attribute("lastFootBottomDL", "true"); + if (endlastfoot.empty) + os << write_attribute("lastFootEmpty", "true"); + os << ">\n"; for (int j = 0; j < columns_; ++j) { - os << "<column" - << write_attribute("alignment", tostr(column_info[j].alignment)) - << write_attribute("valignment", tostr(column_info[j].valignment)) - << write_attribute("leftline", tostr(column_info[j].left_line)) - << write_attribute("rightline", tostr(column_info[j].right_line)) - << write_attribute("width", column_info[j].p_width.asString()) - << write_attribute("special", column_info[j].align_special) - << ">\n"; + os << "<column"; + if (column_info[j].alignment != LYX_ALIGN_CENTER) + os << write_attribute("alignment", +tostr(column_info[j].alignment)); + if ((column_info[j].valignment)!= LYX_VALIGN_TOP) + os << write_attribute("valignment", +tostr(column_info[j].valignment)); + if (column_info[j].left_line) + os << write_attribute("leftline", "true"); + if (column_info[j].right_line) + os << write_attribute("rightline", "true"); + if (!column_info[j].p_width.zero()) + os << write_attribute("width", column_info[j].p_width.asString()); + if (!column_info[j].align_special.empty()) + os << write_attribute("special", column_info[j].align_special); + os << ">\n"; } for (int i = 0; i < rows_; ++i) { - os << "<row" - << write_attribute("topline", tostr(row_info[i].top_line)) - << write_attribute("bottomline", tostr(row_info[i].bottom_line)) - << write_attribute("endhead", tostr(row_info[i].endhead)) - << write_attribute("endfirsthead", tostr(row_info[i].endfirsthead)) - << write_attribute("endfoot", tostr(row_info[i].endfoot)) - << write_attribute("endlastfoot", tostr(row_info[i].endlastfoot)) - << write_attribute("newpage", tostr(row_info[i].newpage)) - << ">\n"; + os << "<row"; + if (row_info[i].top_line) + os << write_attribute("topline", "true"); + if (row_info[i].bottom_line) + os << write_attribute("bottomline", "true"); + if (row_info[i].endhead) + os << write_attribute("endhead", "true"); + if (row_info[i].endfirsthead) + os << write_attribute("endfirsthead", "true"); + if (row_info[i].endfoot) + os << write_attribute("endfoot", "true"); + if (row_info[i].endlastfoot) + os << write_attribute("endlastfoot", "true"); + if (row_info[i].newpage) + os << write_attribute("newpage", "true"); + os << ">\n"; for (int j = 0; j < columns_; ++j) { - os << "<cell" - << write_attribute("multicolumn", cell_info[i][j].multicolumn) - << write_attribute("alignment", tostr(cell_info[i][j].alignment)) - << write_attribute("valignment", tostr(cell_info[i][j].valignment)) - << write_attribute("topline", tostr(cell_info[i][j].top_line)) - << write_attribute("bottomline", tostr(cell_info[i][j].bottom_line)) - << write_attribute("leftline", tostr(cell_info[i][j].left_line)) - << write_attribute("rightline", tostr(cell_info[i][j].right_line)) - << write_attribute("rotate", tostr(cell_info[i][j].rotate)) - << write_attribute("usebox", tostr(cell_info[i][j].usebox)) - << write_attribute("width", cell_info[i][j].p_width) - << write_attribute("special", cell_info[i][j].align_special) - << ">\n"; + os << "<cell"; + if (cell_info[i][j].multicolumn > 0) + os << write_attribute("multicolumn", +cell_info[i][j].multicolumn); + if (cell_info[i][j].alignment != LYX_ALIGN_CENTER) + os << write_attribute("alignment", +tostr(cell_info[i][j].alignment)); + if (cell_info[i][j].valignment != LYX_VALIGN_TOP) + os << write_attribute("valignment", +tostr(cell_info[i][j].valignment)); + if (cell_info[i][j].top_line) + os << write_attribute("topline", "true"); + if (cell_info[i][j].bottom_line) + os << write_attribute("bottomline", "true"); + if (cell_info[i][j].left_line) + os << write_attribute("leftline","true"); + if (cell_info[i][j].right_line) + os << write_attribute("rightline","true"); + if (cell_info[i][j].rotate) + os << write_attribute("rotate","true"); + if (cell_info[i][j].usebox != BOX_NONE) + os << write_attribute("usebox", +tostr(cell_info[i][j].usebox)); + if (!cell_info[i][j].p_width.zero()) + os << write_attribute("width", cell_info[i][j].p_width); + if (!cell_info[i][j].align_special.empty()) + os << write_attribute("special", +cell_info[i][j].align_special); + os << ">\n"; os << "\\begin_inset "; cell_info[i][j].inset.write(buf, os); os << "\n\\end_inset \n"