LyX file-format changes
-----------------------
+
+2007-04-26 Uwe Stöhr <uwestoehr@web.de>
+
+ * format incremented to 265: fix LyX's table border line handling
+ With the fix (see bug 1746) LyX now takes care if the user has entered
+ a "|" character in the argument field of tables. Therefore the "|"
+ character has to be removed when also a table border is set.
+
2007-04-24 José Matos <jamatos@lyx.org>
* format incremented to 264:
'xx \textbf{yy} zz'.
New: Spaces are always output with the font set by the user.
-2007-01-31 Uwe Stöhr
+2007-01-31 Uwe Stöhr <uwestoehr@web.de>
* format incremented to 258: new \lyxline definition
Old:
("1_2", [220], generate_minor_versions("1.2" , 4)),
("1_3", [221], generate_minor_versions("1.3" , 7)),
("1_4", range(222,246), generate_minor_versions("1.4" , 4)),
- ("1_5", range(246,265), generate_minor_versions("1.5" , 0))]
+ ("1_5", range(246,266), generate_minor_versions("1.5" , 0))]
def formats_list():
k = 0
while i < len(document.body):
i = find_token(document.body, "\\size " + fontsizes[n], i)
- k = find_token(document.body, "\\lyxline",i)
+ k = find_token(document.body, "\\lyxline", i)
# the corresponding fontsize command is always 2 lines before the \lyxline
if (i != -1 and k == i+2):
document.body[i:i+1] = []
document.textclass = "cv"
+def convert_tableborder(document):
+ # The problematic is: LyX double the table cell border as it ignores the "|" character in
+ # the cell arguments. A fix takes care of this and therefore the "|" has to be removed
+ i = 0
+ while i < len(document.body):
+ h = document.body[i].find("leftline=\"true\"", 0, len(document.body[i]))
+ k = document.body[i].find("|>{", 0, len(document.body[i]))
+ # the two tokens have to be in one line
+ if (h != -1 and k != -1):
+ # delete the "|"
+ document.body[i] = document.body[i][:k] + document.body[i][k+1:len(document.body[i])-1]
+ i = i + 1
+
+
+def revert_tableborder(document):
+ i = 0
+ while i < len(document.body):
+ h = document.body[i].find("leftline=\"true\"", 0, len(document.body[i]))
+ k = document.body[i].find(">{", 0, len(document.body[i]))
+ # the two tokens have to be in one line
+ if (h != -1 and k != -1):
+ # add the "|"
+ document.body[i] = document.body[i][:k] + '|' + document.body[i][k:]
+ i = i + 1
+
+
##
# Conversion hub
#
[261, [convert_changes]],
[262, []],
[263, [normalize_language_name]],
- [264, [convert_cv_textclass]]]
+ [264, [convert_cv_textclass]],
+ [265, [convert_tableborder]]]
-revert = [[263, [revert_cv_textclass]],
+revert = [[264, [revert_tableborder]],
+ [263, [revert_cv_textclass]],
[262, [revert_language_name]],
[261, [revert_ascii]],
[260, []],
if __name__ == "__main__":
pass
-
namespace {
-int const LYX_FORMAT = 264;
+int const LYX_FORMAT = 265;
} // namespace anon
return false;
if (!wholecolumn && isMultiColumn(cell) &&
(isFirstCellInRow(cell) || isMultiColumn(cell-1)))
- {
- if (cellinfo_of_cell(cell).align_special.empty())
- return cellinfo_of_cell(cell).left_line;
- return prefixIs(ltrim(cellinfo_of_cell(cell).align_special), '|');
- }
- if (column_info[column_of_cell(cell)].align_special.empty())
- return column_info[column_of_cell(cell)].left_line;
- return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), '|');
+ return cellinfo_of_cell(cell).left_line;
+ return column_info[column_of_cell(cell)].left_line;
}
return false;
if (!wholecolumn && isMultiColumn(cell) &&
(isLastCellInRow(cell) || isMultiColumn(cell + 1)))
- {
- if (cellinfo_of_cell(cell).align_special.empty())
- return cellinfo_of_cell(cell).right_line;
- return suffixIs(rtrim(cellinfo_of_cell(cell).align_special), '|');
- }
- if (column_info[column_of_cell(cell)].align_special.empty())
- return column_info[right_column_of_cell(cell)].right_line;
- return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), '|');
+ return cellinfo_of_cell(cell).right_line;
+ return column_info[right_column_of_cell(cell)].right_line;
}
}
if (isMultiColumn(cell)) {
os << "\\multicolumn{" << cells_in_multicolumn(cell) << "}{";
+ if (leftLine(cell) &&
+ (isFirstCellInRow(cell) ||
+ (!isMultiColumn(cell - 1) && !leftLine(cell, true) &&
+ !rightLine(cell - 1, true))))
+ os << '|';
if (!cellinfo_of_cell(cell).align_special.empty()) {
- os << cellinfo_of_cell(cell).align_special << "}{";
+ os << cellinfo_of_cell(cell).align_special;
} else {
- if (leftLine(cell) &&
- (isFirstCellInRow(cell) ||
- (!isMultiColumn(cell - 1) && !leftLine(cell, true) &&
- !rightLine(cell - 1, true))))
- {
- os << '|';
- }
if (!getPWidth(cell).zero()) {
switch (getVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << 'c';
break;
}
- }
- if (rightLine(cell))
- os << '|';
- if (((cell + 1) < numberofcells) && !isFirstCellInRow(cell+1) &&
- leftLine(cell+1))
- os << '|';
- os << "}{";
+ } // end if else !getPWidth
+ } // end if else !cellinfo_of_cell
+ if (rightLine(cell))
+ os << '|';
+ if (((cell + 1) < numberofcells) && !isFirstCellInRow(cell+1) &&
+ leftLine(cell+1))
+ os << '|';
+ os << "}{";
}
- }
if (getUsebox(cell) == BOX_PARBOX) {
os << "\\parbox[";
switch (getVAlignment(cell)) {
else
os << "\\begin{tabular}{";
for (col_type i = 0; i < columns_; ++i) {
+ if (!use_booktabs && column_info[i].left_line)
+ os << '|';
if (!column_info[i].align_special.empty()) {
os << column_info[i].align_special;
} else {
- if (!use_booktabs && column_info[i].left_line)
- os << '|';
if (!column_info[i].p_width.zero()) {
switch (column_info[i].alignment) {
case LYX_ALIGN_LEFT:
os << 'c';
break;
}
- }
- if (!use_booktabs && column_info[i].right_line)
- os << '|';
- }
+ } // end if else !column_info[i].p_width
+ } // end if else !column_info[i].align_special
+ if (!use_booktabs && column_info[i].right_line)
+ os << '|';
}
os << "}\n";
++ret;