r30787 - in /branches/upstream/libtemplate-plugin-javascript-perl: ./ current/ current/lib/ current/lib/Template/ current/lib/Template/Plugin/ current/t/

mxey-guest at users.alioth.debian.org mxey-guest at users.alioth.debian.org
Tue Feb 17 12:41:20 UTC 2009


Author: mxey-guest
Date: Tue Feb 17 12:41:15 2009
New Revision: 30787

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=30787
Log:
[svn-inject] Installing original source of libtemplate-plugin-javascript-perl

Added:
    branches/upstream/libtemplate-plugin-javascript-perl/
    branches/upstream/libtemplate-plugin-javascript-perl/current/
    branches/upstream/libtemplate-plugin-javascript-perl/current/Changes
    branches/upstream/libtemplate-plugin-javascript-perl/current/MANIFEST
    branches/upstream/libtemplate-plugin-javascript-perl/current/META.yml
    branches/upstream/libtemplate-plugin-javascript-perl/current/Makefile.PL
    branches/upstream/libtemplate-plugin-javascript-perl/current/lib/
    branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/
    branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/
    branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/JavaScript.pm
    branches/upstream/libtemplate-plugin-javascript-perl/current/t/
    branches/upstream/libtemplate-plugin-javascript-perl/current/t/00_compile.t
    branches/upstream/libtemplate-plugin-javascript-perl/current/t/01_test.t

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/Changes?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/Changes (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/Changes Tue Feb 17 12:41:15 2009
@@ -1,0 +1,4 @@
+Revision history for Perl extension Template::Plugin::JavaScript
+
+0.01  Fri Aug 20 01:00:39 2004
+	- original version

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/MANIFEST?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/MANIFEST (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/MANIFEST Tue Feb 17 12:41:15 2009
@@ -1,0 +1,7 @@
+Changes
+lib/Template/Plugin/JavaScript.pm
+Makefile.PL
+MANIFEST			This list of files
+t/00_compile.t
+t/01_test.t
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/META.yml?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/META.yml (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/META.yml Tue Feb 17 12:41:15 2009
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Template-Plugin-JavaScript
+version:      0.01
+version_from: lib/Template/Plugin/JavaScript.pm
+installdirs:  site
+requires:
+    Template:                      0
+    Test::More:                    0.32
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/Makefile.PL?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/Makefile.PL (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/Makefile.PL Tue Feb 17 12:41:15 2009
@@ -1,0 +1,9 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+    'NAME'      => 'Template::Plugin::JavaScript',
+    'VERSION_FROM' => 'lib/Template/Plugin/JavaScript.pm', # finds $VERSION
+    'PREREQ_PM' => {
+	Test::More => 0.32,
+	Template => 0,
+    },
+);

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/JavaScript.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/JavaScript.pm?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/JavaScript.pm (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/lib/Template/Plugin/JavaScript.pm Tue Feb 17 12:41:15 2009
@@ -1,0 +1,73 @@
+package Template::Plugin::JavaScript;
+
+use strict;
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+require Template::Plugin;
+use base qw(Template::Plugin);
+
+use vars qw($FILTER_NAME);
+$FILTER_NAME = 'js';
+
+sub new {
+    my($self, $context, @args) = @_;
+    my $name = $args[0] || $FILTER_NAME;
+    $context->define_filter($name, \&encode_js, 0);
+    return $self;
+}
+
+sub encode_js {
+    local $_ = shift;
+    return '' unless defined $_;
+
+    s!(['"])!\\$1!g;
+    s!\n!\\n!g;
+    s!\f!\\f!g;
+    s!\r!\\r!g;
+    s!\t!\\t!g;
+    $_;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Template::Plugin::JavaScript - Encodes text to be safe in JavaScript
+
+=head1 SYNOPSIS
+
+  [% USE JavaScript %]
+  <script type="text/javascript">
+  document.write("[% sometext | js %]");
+  </script>
+
+=head1 DESCRIPTION
+
+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");
+
+=head1 AUTHOR
+
+The original idea comes from Movable Type's C<encode_js> global filter.
+
+Tatsuhiko Miyagawa E<lt>miyagawa at bulknews.netE<gt>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Apache::JavaScript::DocumentWrite>
+
+=cut

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/t/00_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/t/00_compile.t?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/t/00_compile.t (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/t/00_compile.t Tue Feb 17 12:41:15 2009
@@ -1,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Template::Plugin::JavaScript' }

Added: branches/upstream/libtemplate-plugin-javascript-perl/current/t/01_test.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtemplate-plugin-javascript-perl/current/t/01_test.t?rev=30787&op=file
==============================================================================
--- branches/upstream/libtemplate-plugin-javascript-perl/current/t/01_test.t (added)
+++ branches/upstream/libtemplate-plugin-javascript-perl/current/t/01_test.t Tue Feb 17 12:41:15 2009
@@ -1,0 +1,14 @@
+use strict;
+use Template::Test;
+
+test_expect(\*DATA);
+
+__END__
+--test--
+[% USE JavaScript -%]
+document.write("[% FILTER js %]
+Here's some text going on.
+[% END %]");
+--expect--
+document.write("\nHere\'s some text going on.\n");
+




More information about the Pkg-perl-cvs-commits mailing list