From: Akihiro MOTOKI Date: Wed, 19 Oct 2011 17:43:51 +0000 (+0900) Subject: man2html: Handle table format spec which consists of only '_'. X-Git-Tag: util-linux-2.12r~691 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ebd68a308dc8c37ae5cf;p=linuxjm%2Fjm.git man2html: Handle table format spec which consists of only '_'. Before this commit, a data line corresponding to the table format specification which consists of only '_' is disappeared during conversion by man2html. For example, in signal(7) a first row next to the title disappears after HTML conversion. This commit adds a function to check if a table format spec for a current row has one or more data item and during scanning data items scan_table() skips such a table format spec without data items. --- diff --git a/admin/man-1.6g/man2html/man2html.c b/admin/man-1.6g/man2html/man2html.c index 86d50402..c44a69b0 100644 --- a/admin/man-1.6g/man2html/man2html.c +++ b/admin/man-1.6g/man2html/man2html.c @@ -848,6 +848,21 @@ next_row(TABLEROW *tr) } } +/* Check if the specified row contain at least one data item. + 1: has data item + 0: no data item + */ +static int +row_has_data(TABLEROW *currow) { + TABLEITEM *curfield; + curfield = currow->first; + while (curfield) { + if (curfield->align != '_') return 1; + curfield = curfield->next; + } + return 0; +} + char itemreset[20]="\\fR\\s0"; static char * @@ -932,7 +947,9 @@ scan_table(char *c) { } while (curfield && curfield->align=='S'); } if (c[1]=='\n') { - currow=next_row(currow); + do { + currow=next_row(currow); + } while (!row_has_data(currow)); curfield=currow->first; } c=c+2; @@ -955,7 +972,9 @@ scan_table(char *c) { } else if (g) free(g); if (c[-1]=='\n') { - currow=next_row(currow); + do { + currow=next_row(currow); + } while (!row_has_data(currow)); curfield=currow->first; } } else if (*c=='.' && c[1]=='T' && c[2]=='&' && c[-1]=='\n') { @@ -968,7 +987,9 @@ scan_table(char *c) { hr->prev=currow; currow->next=hr; currow=hr; - next_row(currow); + do { + currow=next_row(currow); + } while (!row_has_data(currow)); curfield=currow->first; } else if (*c=='.' && c[1]=='T' && c[2]=='E' && c[-1]=='\n') { finished=1; @@ -1009,7 +1030,9 @@ scan_table(char *c) { if (i) *c=itemsep; c=h; if (c[-1]=='\n') { - currow=next_row(currow); + do { + currow=next_row(currow); + } while (!row_has_data(currow)); curfield=currow->first; } }