From 04ef1e97f47b40ae2782d20a5c30b0adeb321d59 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 20 Dec 2006 02:49:13 +0100 Subject: [PATCH] shorten strings in table header too. --- buildscripts/output-distance.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/buildscripts/output-distance.py b/buildscripts/output-distance.py index d3ef36b3c6..a04df6b540 100644 --- a/buildscripts/output-distance.py +++ b/buildscripts/output-distance.py @@ -19,6 +19,12 @@ OUTPUT_EXPRESSION_PENALTY = 1 ORPHAN_GROB_PENALTY = 1 inspect_max_count = 0 +def shorten_string (s): + threshold = 15 + if len (s) > 2*threshold: + s = s[:threshold] + '..' + s[-threshold:] + return s + def max_distance (x1, x2): dist = 0.0 @@ -648,12 +654,14 @@ class ComparisonData: html += link.html_record_string (dir1, dir2) + short_dir1 = shorten_string (dir1) + short_dir2 = shorten_string (dir2) html = ''' - - + + %(html)s
distance%(dir1)s%(dir2)s%(short_dir1)s%(short_dir2)s
@@ -917,8 +925,7 @@ def main (): inspect_max_count = o.max_count name = a[0].replace ('/', '') - if len (name) > 20: - name = name[:10] + '..' + name[-10:] + name = shorten_string (name) compare_trees (a[0], a[1], os.path.join (a[1], 'compare-' + name), o.threshold) -- 2.39.5