aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2013-04-16 07:25:05 +0000
committerJean Delvare <jdelvare@suse.de>2013-04-16 07:25:05 +0000
commit1109541b69c5f9e00748852917bae816cf6e086a (patch)
tree4c8a6e9e9dcd791a4e72f0b7d696416b5e1327c1
parent02cb1fe0b9d834e6b09ef8e8f5366cf1ece24d6e (diff)
downloadi2c-tools-1109541b69c5f9e00748852917bae816cf6e086a.tar.gz
decode-dimms: For HTML output, merge adjacent cells even if the whole line cannot be merged
Original patch from Paul Goyette. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6159 7894878c-1315-0410-8ee3-d5d059ff63e0
-rwxr-xr-xeeprom/decode-dimms15
1 files changed, 13 insertions, 2 deletions
diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms
index 4dab039..252f010 100755
--- a/eeprom/decode-dimms
+++ b/eeprom/decode-dimms
@@ -438,10 +438,21 @@ sub real_printl($$) # print a line w/ label and values
$label = html_encode($label);
@values = map { html_encode($_) } @values;
print "<tr><td valign=top>$label</td>";
- if ($opt_merge && $same_values) {
+ if (!$opt_merge) {
+ print "<td>$_</td>" foreach @values;
+ } elsif ($same_values) {
print "<td colspan=".(scalar @values).">$values[0]</td>";
} else {
- print "<td>$_</td>" foreach @values;
+ # For HTML output, merge adjacent cells even if
+ # the whole line cannot be merged.
+ my $colcnt = 0;
+ while (@values) {
+ $colcnt++;
+ my $value = shift @values;
+ next if (@values && $value eq $values[0]);
+ print "<td" . ($colcnt > 1 ? " colspan=$colcnt" : "") .">$value</td>";
+ $colcnt = 0;
+ }
}
print "</tr>\n";
} else {