Template::Plugin::JavaScript(3pm)

Template::Plugin::JavaScript3pm

Encodes text to be safe in javascript

Usage

  [% USE JavaScript %]
  <script type="text/javascript">
  document.write("[% sometext | js %]");
  </script>

Overview

Template::Plugin::JavaScript is a TT filter that filters text so it can be safely used in JavaScript quotes.

  [% USE JavaScript %]
  document.write("[% FILTER js %]
  Here's some text going on.
  [% END %]");

will become:

  document.write("\nHere\'s some text going on.\n");

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 4 times.

  1. 6.0
  2. 7–9
  3. 10
  4. 11
  5. 12–13

Author

The original idea comes from Movable Type's "encode_js" global filter.

Tatsuhiko Miyagawa <[email protected]>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

From libtemplate-plugin-javascript-perl 0.02-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.