[Rt-commit] rt branch, 4.0/parse-format-original-string, created. rt-4.0.19-60-g3a323a7
? sunnavy
sunnavy at bestpractical.com
Tue Mar 18 11:18:04 EDT 2014
The branch, 4.0/parse-format-original-string has been created
at 3a323a7ba5e7f7242bd95b4bfe1a54f2e41757ec (commit)
- Log -----------------------------------------------------------------
commit 3a323a7ba5e7f7242bd95b4bfe1a54f2e41757ec
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..0eac75e 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -219,17 +219,22 @@ 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'};
+ if ( $field->{'output'} ) {
+ $row = join '', @{$field->{'output'}};
+ }
+ 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