Revision 8817f25b
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Presenter.pm | ||
---|---|---|
124 | 124 |
return SL::Presenter::EscapedText->new(text => $text, is_escaped => 1); |
125 | 125 |
} |
126 | 126 |
|
127 |
sub escape_js { |
|
128 |
my ($self, $text) = @_; |
|
129 |
|
|
130 |
$text =~ s|\\|\\\\|g; |
|
131 |
$text =~ s|\"|\\\"|g; |
|
132 |
$text =~ s|\n|\\n|g; |
|
133 |
|
|
134 |
return SL::Presenter::EscapedText->new(text => $text, is_escaped => 1); |
|
135 |
} |
|
136 |
|
|
127 | 137 |
1; |
128 | 138 |
|
129 | 139 |
__END__ |
... | ... | |
290 | 300 |
L<SL::Presenter::EscapedText>. This is a no-op (the same instance will |
291 | 301 |
be returned). |
292 | 302 |
|
303 |
=item C<escape_js $text> |
|
304 |
|
|
305 |
Returns a JavaScript-escaped version of C<$text>. Instead of a string |
|
306 |
an instance of the thin proxy-object L<SL::Presenter::EscapedText> is |
|
307 |
returned. |
|
308 |
|
|
309 |
It is safe to call C<escape> on an instance of |
|
310 |
L<SL::Presenter::EscapedText>. This is a no-op (the same instance will |
|
311 |
be returned). |
|
312 |
|
|
293 | 313 |
=item C<get_template> |
294 | 314 |
|
295 | 315 |
Returns the global instance of L<Template> and creates it if it |
Auch abrufbar als: Unified diff
Presenter: escape_js() zum Escapen von JavaScript