[Rt-commit] rt branch, 4.0/parse-format-original-string, created. rt-4.0.19-60-gc58caef

? sunnavy sunnavy at bestpractical.com
Wed Mar 19 10:24:56 EDT 2014


The branch, 4.0/parse-format-original-string has been created
        at  c58caefba8e2d787c8682c4aa783f17f8e239b2f (commit)

- Log -----------------------------------------------------------------
commit c58caefba8e2d787c8682c4aa783f17f8e239b2f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 18 22:55:57 2014 +0800

    keep the original string in ParseFormat so we can reuse it in BuildFormatString
    
    before we re-build the format string from parsed segments, which basically
    works but attributes(like "/TITLE:Subject") are lost.  with this, we don't
    need to build it at all and all the bits will be kept.
    
    see also #29425

diff --git a/share/html/Elements/CollectionAsTable/ParseFormat b/share/html/Elements/CollectionAsTable/ParseFormat
index e56e9ce..5d55ffb 100644
--- a/share/html/Elements/CollectionAsTable/ParseFormat
+++ b/share/html/Elements/CollectionAsTable/ParseFormat
@@ -55,6 +55,7 @@ my @Columns;
 
 while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
     my $col = $1;
+    my $colref = { original_string => $col };
 
     if ($col =~ /^$RE{quoted}$/o) {
         substr($col,0,1) = "";
@@ -62,8 +63,6 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
         $col =~ s/\\(.)/$1/g;
     }
 
-    my $colref = { };
-
     $m->callback(CallbackName => 'PreColumn', Column => $colref, col => \$col);
 
     while ( $col =~ s{/(STYLE|CLASS|TITLE|ALIGN|SPAN|ATTRIBUTE):([^/]*)}{}i ) {
diff --git a/share/html/Search/Elements/BuildFormatString b/share/html/Search/Elements/BuildFormatString
index 4981889..e5b3745 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -219,17 +219,17 @@ my @format_string;
 foreach my $field (@seen) {
     next unless $field;
     my $row = "";
-    if ( $field->{'output'} ) {
-        $row = join '', @{$field->{'output'}};
+    if ( $field->{'original_string'} ) {
+        $row = $field->{'original_string'};
     }
     else {
         $row .= $field->{'Prefix'} if defined $field->{'Prefix'};
         $row .= "__$field->{'Column'}__"
           unless ( $field->{'Column'} eq "<blank>" );
         $row .= $field->{'Suffix'} if defined $field->{'Suffix'};
+        $row =~ s!([\\'])!\\$1!g;
+        $row = "'$row'";
     }
-    $row =~ s!([\\'])!\\$1!g;
-    $row = "'$row'";
     push( @format_string, $row );
 }
 

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


More information about the rt-commit mailing list