Revision 518ed6b5
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/Template/Plugin/JavaScript.pm | ||
---|---|---|
1 |
package SL::Template::Plugin::JavaScript; |
|
2 |
|
|
3 |
use base qw( Template::Plugin ); |
|
4 |
use Template::Plugin; |
|
5 |
|
|
6 |
sub new { |
|
7 |
my $class = shift; |
|
8 |
my $context = shift; |
|
9 |
|
|
10 |
bless { }, $class; |
|
11 |
} |
|
12 |
|
|
13 |
sub escape { |
|
14 |
my $self = shift; |
|
15 |
my $text = shift; |
|
16 |
|
|
17 |
$text =~ s|\"|\\\"|g; |
|
18 |
|
|
19 |
return $text; |
|
20 |
} |
|
21 |
|
|
22 |
1; |
|
23 |
|
|
24 |
|
Auch abrufbar als: Unified diff
Ein Template-Plugin zum Escape von Angaben für JavaScript-Strings.