diff options
Diffstat (limited to '')
-rw-r--r-- | table.c | 116 |
1 files changed, 61 insertions, 55 deletions
@@ -1,4 +1,4 @@ -/* $Id: table.c,v 1.53 2006/04/08 11:52:02 inu Exp $ */ +/* $Id: table.c,v 1.55 2007/05/23 13:07:44 inu Exp $ */ /* * HTML table */ @@ -537,48 +537,18 @@ visible_length_plain(char *str) return len > max_len ? len : max_len; } -int -maximum_visible_length(char *str) +static int +maximum_visible_length(char *str, int offset) { - int maxlen, len; - - visible_length_offset = 0; - maxlen = visible_length(str); - - if (!strchr(str, '\t')) - return maxlen; - - for (visible_length_offset = 1; visible_length_offset < Tabstop; - visible_length_offset++) { - len = visible_length(str); - if (maxlen < len) { - maxlen = len; - break; - } - } - return maxlen; + visible_length_offset = offset; + return visible_length(str); } -int -maximum_visible_length_plain(char *str) +static int +maximum_visible_length_plain(char *str, int offset) { - int maxlen, len; - - visible_length_offset = 0; - maxlen = visible_length_plain(str); - - if (!strchr(str, '\t')) - return maxlen; - - for (visible_length_offset = 1; visible_length_offset < Tabstop; - visible_length_offset++) { - len = visible_length_plain(str); - if (maxlen < len) { - maxlen = len; - break; - } - } - return maxlen; + visible_length_offset = offset; + return visible_length_plain(str); } void @@ -2955,33 +2925,69 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, suspend_or_pushdata(tbl, line); break; case HTML_DEL: - if (displayInsDel) - feed_table_inline_tag(tbl, line, mode, 5); /* [DEL: */ - else + switch (displayInsDel) { + case DISPLAY_INS_DEL_SIMPLE: mode->pre_mode |= TBLM_DEL; + break; + case DISPLAY_INS_DEL_NORMAL: + feed_table_inline_tag(tbl, line, mode, 5); /* [DEL: */ + break; + case DISPLAY_INS_DEL_FONTIFY: + feed_table_inline_tag(tbl, line, mode, -1); + break; + } break; case HTML_N_DEL: - if (displayInsDel) - feed_table_inline_tag(tbl, line, mode, 5); /* :DEL] */ - else + switch (displayInsDel) { + case DISPLAY_INS_DEL_SIMPLE: mode->pre_mode &= ~TBLM_DEL; + break; + case DISPLAY_INS_DEL_NORMAL: + feed_table_inline_tag(tbl, line, mode, 5); /* :DEL] */ + break; + case DISPLAY_INS_DEL_FONTIFY: + feed_table_inline_tag(tbl, line, mode, -1); + break; + } break; case HTML_S: - if (displayInsDel) - feed_table_inline_tag(tbl, line, mode, 3); /* [S: */ - else + switch (displayInsDel) { + case DISPLAY_INS_DEL_SIMPLE: mode->pre_mode |= TBLM_S; + break; + case DISPLAY_INS_DEL_NORMAL: + feed_table_inline_tag(tbl, line, mode, 3); /* [S: */ + break; + case DISPLAY_INS_DEL_FONTIFY: + feed_table_inline_tag(tbl, line, mode, -1); + break; + } break; case HTML_N_S: - if (displayInsDel) - feed_table_inline_tag(tbl, line, mode, 3); /* :S] */ - else + switch (displayInsDel) { + case DISPLAY_INS_DEL_SIMPLE: mode->pre_mode &= ~TBLM_S; + break; + case DISPLAY_INS_DEL_NORMAL: + feed_table_inline_tag(tbl, line, mode, 3); /* :S] */ + break; + case DISPLAY_INS_DEL_FONTIFY: + feed_table_inline_tag(tbl, line, mode, -1); + break; + } break; case HTML_INS: case HTML_N_INS: - if (displayInsDel) + switch (displayInsDel) { + case DISPLAY_INS_DEL_SIMPLE: + break; + case DISPLAY_INS_DEL_NORMAL: feed_table_inline_tag(tbl, line, mode, 5); /* [INS:, :INS] */ + break; + case DISPLAY_INS_DEL_FONTIFY: + feed_table_inline_tag(tbl, line, mode, -1); + break; + } break; case HTML_SUP: case HTML_SUB: @@ -3205,7 +3211,7 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode, check_rowcol(tbl, mode); if (mode->nobr_offset < 0) mode->nobr_offset = tbl->tabcontentssize; - addcontentssize(tbl, maximum_visible_length(line)); + addcontentssize(tbl, maximum_visible_length(line, tbl->tabcontentssize)); setwidth(tbl, mode); pushdata(tbl, tbl->row, tbl->col, line); } @@ -3234,9 +3240,9 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode, line = ""; } if (mode->pre_mode & TBLM_PLAIN) - i = maximum_visible_length_plain(p); + i = maximum_visible_length_plain(p, tbl->tabcontentssize); else - i = maximum_visible_length(p); + i = maximum_visible_length(p, tbl->tabcontentssize); addcontentssize(tbl, i); setwidth(tbl, mode); if (nl) |