(Video materials in preparation)
tdconnect : merges <td></td> blocks
Usage : tdconnect [-l<label>] num=<n> <html>
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 2
Horizontally merges <td> elements within a <tr> block surrounded by
a <label>. The number of <td></td> elements merged is <n>. The
values within the <td></td> blocks are checked from left to right in
order, and if consecutive values are the same then the blocks are
merged. The attribute colspan="<number merged>" is added to the
<td> element and the <td> blocks that were removed are commented out.
<th> elements are also merged in this way.
1. The <tr> and </tr> elements must be by themselves on different
lines.
2. The <td>..</td> or <th>..</th> must be independent blocks (can
span multiple lines).
3. The area enclosed by <label> cannot contain elements other than
<tr> or <td>.
4. If there are merged cells in the input html file, <td> elements
that are not to be displayed must be exist as comment like
follows:
<!-- <td>....</td> --> or <!-- <th>....</th> -->
If the data is not in HTML format as expected by tdconnect, then the
output of tdconnect is undefined.
$ cat html
<html>
<body>
<table>
<!-- TR -->
<tr>
<td>a</td>
<td>a</td>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
<!-- TR -->
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
</body>
</html>
$ tdconnect -lTR num=3 html
<html>
<body>
<table>
<tr>
<td colspan="3">a</td>
<!-- <td>a</td> -->
<!-- <td>a</td> -->
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<tr>
</table>
</body>
</html>