[Rt-commit] r12156 - in rtfm/branches/2.3-EXPERIMENTAL: html/RTFM/Article/Elements lib/RT/FM

falcone at bestpractical.com falcone at bestpractical.com
Thu May 8 16:51:12 EDT 2008


Author: falcone
Date: Thu May  8 16:51:11 2008
New Revision: 12156

Modified:
   rtfm/branches/2.3-EXPERIMENTAL/   (props changed)
   rtfm/branches/2.3-EXPERIMENTAL/html/RTFM/Article/Elements/Preformatted
   rtfm/branches/2.3-EXPERIMENTAL/lib/RT/FM/Article_Overlay.pm

Log:
 r32252 at ketch:  falcone | 2008-05-07 17:08:28 -0400
 * remove Template Parsing code (maintain code cleanup we merged from 2.2)


Modified: rtfm/branches/2.3-EXPERIMENTAL/html/RTFM/Article/Elements/Preformatted
==============================================================================
--- rtfm/branches/2.3-EXPERIMENTAL/html/RTFM/Article/Elements/Preformatted	(original)
+++ rtfm/branches/2.3-EXPERIMENTAL/html/RTFM/Article/Elements/Preformatted	Thu May  8 16:51:11 2008
@@ -109,15 +109,6 @@
     my $content = $value->Content;
     return '' unless defined $content && length $content;
 
-    if ( $RT::RTFM_ParseContentAsTemplate ) {
-        my ($new, $msg) = $Article->ParseTemplate( $content, Ticket => $Ticket );
-        unless ( defined $new && length $new ) {
-            $RT::Logger->error("Couldn't parse article's content: $msg");
-        } else {
-            $content = $new;
-        }
-    }
-
     if ( $content =~ /<.{1,5}>/ ) {
         $content = $de_htmlify->( $content );
     }
@@ -127,5 +118,4 @@
 </%init>
 <%args>
 $Article
-$Ticket => undef
 </%args>

Modified: rtfm/branches/2.3-EXPERIMENTAL/lib/RT/FM/Article_Overlay.pm
==============================================================================
--- rtfm/branches/2.3-EXPERIMENTAL/lib/RT/FM/Article_Overlay.pm	(original)
+++ rtfm/branches/2.3-EXPERIMENTAL/lib/RT/FM/Article_Overlay.pm	Thu May  8 16:51:11 2008
@@ -506,64 +506,6 @@
     }
 }
 
-=head2 ParseTemplate $CONTENT, %TEMPLATE_ARGS
-
-Parses $CONTENT string as a template (L<Text::Template>).
-$Article and other arguments from %TEMPLATE_ARGS are
-available in code of the template as perl variables.
-
-=cut
-
-sub ParseTemplate {
-    my $self = shift;
-    my $content = shift;
-    my %args = (
-        Ticket => undef,
-        @_
-    );
-
-    return ($content) unless defined $content && length $content;
-
-    $args{'Article'} = $self;
-    $args{'rtname'}  = $RT::rtname;
-    if ( $args{'Ticket'} ) {
-        my $t = $args{'Ticket'}; # avoid memory leak
-        $args{'loc'} = sub { $t->loc(@_) };
-    } else {
-        $args{'loc'} = sub { $self->loc(@_) };
-    }
-
-    foreach my $key ( keys %args ) {
-        next unless ref $args{ $key };
-        next if ref $args{ $key } =~ /^(ARRAY|HASH|SCALAR|CODE)$/;
-        my $val = $args{ $key };
-        $args{ $key } = \$val;
-    }
-
-    # We need to untaint the content of the template, since we'll be working
-    # with it
-    $content =~ s/^(.*)$/$1/;
-    my $template = Text::Template->new(
-        TYPE   => 'STRING',
-        SOURCE => $content
-    );
-
-    my $is_broken = 0;
-    my $retval = $template->fill_in(
-        HASH => \%args,
-        BROKEN => sub {
-            my (%args) = @_;
-            $RT::Logger->error("Article parsing error: $args{error}")
-                unless $args{error} =~ /^Died at /; # ignore intentional die()
-            $is_broken++;
-            return undef;
-        },
-    );
-    return ( undef, $self->loc('Article parsing error') ) if $is_broken;
-
-    return ($retval);
-}
-
 =head2 CurrentUserHasRight
 
 Returns true if the current user has the right for this article, for the whole system or for this article's class


More information about the Rt-commit mailing list