[Rt-commit] rt branch, 4.0/avoid-comment-chars-in-tsv, created. rt-4.0.1-298-g3ae2c68

Thomas Sibley trs at bestpractical.com
Tue Aug 16 13:56:16 EDT 2011


The branch, 4.0/avoid-comment-chars-in-tsv has been created
        at  3ae2c68055450961f68ab8b961101b1e1ba229ee (commit)

- Log -----------------------------------------------------------------
commit 3ae2c68055450961f68ab8b961101b1e1ba229ee
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Aug 16 13:17:30 2011 -0400

    Avoid outputting a common comment character in the TSV column titles
    
    If # is the first column (as usual), then the header will be output as a
    "comment" and the columns will be off by one.  Catch and fix the most
    common failure mode.

diff --git a/share/html/Search/Results.tsv b/share/html/Search/Results.tsv
index cf516d6..ccfa6a1 100644
--- a/share/html/Search/Results.tsv
+++ b/share/html/Search/Results.tsv
@@ -66,6 +66,9 @@ my $should_loc = { map { $_ => 1 } qw(Status) };
 
 my $col_entry = sub {
     my $col = shift;
+    # in tsv output, "#" is often a comment character but we use it for "id"
+    delete $col->{title}
+        if $col->{title} and $col->{title} =~ /^\s*#\s*$/;
     return {
         header => Encode::encode_utf8(loc($col->{title} || $col->{attribute})),
         map    => $m->comp(

-----------------------------------------------------------------------


More information about the Rt-commit mailing list