diff options
author | bbaetz%student.usyd.edu.au <> | 2002-02-13 11:27:20 +0100 |
---|---|---|
committer | bbaetz%student.usyd.edu.au <> | 2002-02-13 11:27:20 +0100 |
commit | e1235d08fc52ff4cb914efecda9b15c2b7943f5a (patch) | |
tree | 2673752da715c22fabf9bacc440e48a943afeb82 /globals.pl | |
parent | 5938698d13c326114857aaebb34a0f7081e1d486 (diff) | |
download | bugzilla-e1235d08fc52ff4cb914efecda9b15c2b7943f5a.tar.gz bugzilla-e1235d08fc52ff4cb914efecda9b15c2b7943f5a.tar.xz |
Bug 100094 - use generic template handling code
r=mattyt, afranke
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/globals.pl b/globals.pl index f88347f13..e1f3302f3 100644 --- a/globals.pl +++ b/globals.pl @@ -1578,9 +1578,6 @@ $::template = Template->new( # Colon-separated list of directories containing templates. INCLUDE_PATH => "template/custom:template/default" , - # Allow templates to be specified with relative paths. - RELATIVE => 1 , - # Remove white-space before template directives (PRE_CHOMP) and at the # beginning and end of templates and template blocks (TRIM) for better # looking, more compact content. Use the plus sign at the beginning @@ -1593,6 +1590,17 @@ $::template = Template->new( { # Render text in strike-through style. strike => sub { return "<strike>" . $_[0] . "</strike>" } , + + # Returns the text with backslashes, single/double quotes, + # and newlines/carriage returns escaped for use in JS strings. + js => sub + { + my ($var) = @_; + $var =~ s/([\\\'\"])/\\$1/g; + $var =~ s/\n/\\n/g; + $var =~ s/\r/\\r/g; + return $var; + } } , } ); @@ -1652,6 +1660,9 @@ $::vars = # Function for processing global parameters that contain references # to other global parameters. 'PerformSubsts' => \&PerformSubsts , + + # Generic linear search function + 'lsearch' => \&lsearch , }; 1; |