]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-flight: Word-wrapping improvements to job and step names
authorIan Jackson <iwj@xenproject.org>
Mon, 5 Oct 2020 16:23:54 +0000 (17:23 +0100)
committerIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 17:39:48 +0000 (18:39 +0100)
Use <wbr>.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
sg-report-flight

index 33f953ca699677cf6533fa19411a7c63b90d4ced..a07e03cb093cfa58977539dece94c16a2d08651f 100755 (executable)
@@ -1185,6 +1185,15 @@ sub nullcols {
     join ", ", map { m/::/ ? "NULL::$' as $`" : "NULL as $_" } @_;
 }
 
+sub encode_with_wbrs ($) {
+    my ($s) = @_;
+    my $re = qr{[-/]};
+    join '', map {
+       my $b = s{^$re}{} ? ('<wbr>'. $& . '&#8288;') : '';
+       $b.encode_entities($_);
+    } split m{(?=$re)}, $s;
+}
+
 sub htmloutjob ($$) {
     my ($fi,$job) = @_;
     return unless defined $htmldir;
@@ -1666,11 +1675,9 @@ END
     print H "</th>\n";
 
     foreach my $col (@cols) {
-        my $th= $col;
-        $th =~ s/\-/ $&/g;
         print H "<th>";
         print H "<a href=\"".encode_entities($col)."/$htmlleaf\">";
-        print H encode_entities($th);
+        print H encode_with_wbrs($col);
         print H "</a>";
         print H "</th>";
     }
@@ -1726,7 +1733,8 @@ END
            next if $this[1] == $worst[1] && $ei->{Step}{status} ne 'pass';
            @worst=@this;
            push @worst,
-               encode_entities("$ei->{Step}{stepno}. $ei->{Step}{testid}");
+             encode_entities("$ei->{Step}{stepno}. ").
+             encode_with_wbrs($ei->{Step}{testid});
        }
        push @worstrow1, "<td ",$worst[2],">",$worst[3],"</td>";
        push @worstrow2, "<td ",$worst[2],">",$worst[0],"</td>";