[libhtml-scrubber-perl] 03/11: Stripped spare spaces on end-of-lines + tabs
Florian Schlichting
fsfs at moszumanska.debian.org
Sat Nov 11 13:46:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
fsfs pushed a commit to annotated tag release/0.09
in repository libhtml-scrubber-perl.
commit 3e003695aed885f559e8001df438b625e0c8a912
Author: Nigel Metheringham <nigelm at cpan.org>
Date: Sun Mar 27 21:34:38 2011 +0100
Stripped spare spaces on end-of-lines + tabs
---
README.pod | 10 +--
lib/HTML/Scrubber.pm | 28 ++++-----
t/02_basic.t | 167 +++++++++++++++++++++++++--------------------------
t/03_more.t | 2 +-
t/04_style_script.t | 2 +-
t/05_pi_comment.t | 2 +-
t/07_booleans.t | 2 +-
7 files changed, 105 insertions(+), 108 deletions(-)
diff --git a/README.pod b/README.pod
index bd2d59b..2956679 100644
--- a/README.pod
+++ b/README.pod
@@ -72,18 +72,18 @@ If you're new to perl, good luck to you.
if $p->script; # off by default
$p->script( 0 || 1 );
-B<**> Please note that this is implemented
+B<**> Please note that this is implemented
using HTML::Parser's ignore_elements function,
so if C<script> is set to true,
all script tags encountered will be validated like all other tags.
-=head2 style
+=head2 style
warn "style tags (and everything in between) are supressed"
if $p->style; # off by default
$p->style( 0 || 1 );
-B<**> Please note that this is implemented
+B<**> Please note that this is implemented
using HTML::Parser's ignore_elements function,
so if C<style> is set to true,
all style tags encountered will be validated like all other tags.
@@ -240,10 +240,10 @@ the default attribute rule is applied.
<A NAME="evil">
<A HREF="javascript:alert('die die die');">HREF=JAVA <!></A>
<br>
- <A HREF="image/bigone.jpg" ONMOUSEOVER="alert('die die die');">
+ <A HREF="image/bigone.jpg" ONMOUSEOVER="alert('die die die');">
<IMG SRC="image/smallone.jpg" ALT="ONMOUSEOVER JAVASCRIPT">
</A>
- </A> <br>
+ </A> <br>
];
#
print "#original text",$/, $it, $/;
diff --git a/lib/HTML/Scrubber.pm b/lib/HTML/Scrubber.pm
index 76efff6..e8c0051 100644
--- a/lib/HTML/Scrubber.pm
+++ b/lib/HTML/Scrubber.pm
@@ -63,7 +63,7 @@ use vars qw[ $VERSION @_scrub @_scrub_fh ];
$VERSION = '0.08';
-# my my my my, these here to prevent foolishness like
+# my my my my, these here to prevent foolishness like
# http://perlmonks.org/index.pl?node_id=251127#Stealing+Lexicals
(@_scrub )= ( \&_scrub, "self, event, tagname, attr, attrseq, text");
(@_scrub_fh )= ( \&_scrub_fh, "self, event, tagname, attr, attrseq, text");
@@ -149,7 +149,7 @@ sub process {
if $p->script; # off by default
$p->script( 0 || 1 );
-B<**> Please note that this is implemented
+B<**> Please note that this is implemented
using HTML::Parser's ignore_elements function,
so if C<script> is set to true,
all script tags encountered will be validated like all other tags.
@@ -164,13 +164,13 @@ sub script {
return;
}
-=head2 style
+=head2 style
warn "style tags (and everything in between) are supressed"
if $p->style; # off by default
$p->style( 0 || 1 );
-B<**> Please note that this is implemented
+B<**> Please note that this is implemented
using HTML::Parser's ignore_elements function,
so if C<style> is set to true,
all style tags encountered will be validated like all other tags.
@@ -320,7 +320,7 @@ sub scrub {
$_[0]->{_p}->parse($_[1]);
$_[0]->{_p}->eof();
-
+
return delete $_[0]->{_r} unless exists $_[0]->{_out};
delete $_[0]->{_out};
return 1;
@@ -406,7 +406,7 @@ sub _scrub_fh {
if( exists $s->{_rules}->{$t} ) # is there a specific rule
{
if( ref $s->{_rules}->{$t} ) # is it complicated?(not simple;)
- {
+ {
print
{$s->{_out}}
$s->_validate($t, $t, $a, $as);
@@ -426,18 +426,18 @@ sub _scrub_fh {
}
}
elsif ( $e eq 'end' )
- {
+ {
if( exists $s->{_rules}->{$t} )
{
print
{$s->{_out}}
"</$t>"
if $s->{_rules}->{$t};
-
+
}
elsif( $s->{_rules}->{'*'} )
{
-
+
print {$s->{_out}} "</$t>";
}
}
@@ -478,7 +478,7 @@ sub _scrub {
if ( $e eq 'start' )
{
if( exists $s->{_rules}->{$t} ) # is there a specific rule
- {
+ {
if( ref $s->{_rules}->{$t} ) # is it complicated?(not simple;)
{
$s->{_r} .= $s->_validate($t, $t, $a, $as);
@@ -489,7 +489,7 @@ sub _scrub {
}
}
elsif( $s->{_rules}->{'*'} ) # default allow tags
- {
+ {
$s->{_r} .= $s->_validate($t, '_', $a, $as);
}
}
@@ -553,7 +553,7 @@ sub _optimize {
# sub deny
# return unless $self->{_optimize}; # till I figure it out (huh)
- my(@ignores)=
+ my(@ignores)=
grep {
not $self->{_rules}{$_}
} grep {
@@ -671,10 +671,10 @@ the default attribute rule is applied.
<A NAME="evil">
<A HREF="javascript:alert('die die die');">HREF=JAVA <!></A>
<br>
- <A HREF="image/bigone.jpg" ONMOUSEOVER="alert('die die die');">
+ <A HREF="image/bigone.jpg" ONMOUSEOVER="alert('die die die');">
<IMG SRC="image/smallone.jpg" ALT="ONMOUSEOVER JAVASCRIPT">
</A>
- </A> <br>
+ </A> <br>
];
#
print "#original text",$/, $it, $/;
diff --git a/t/02_basic.t b/t/02_basic.t
index 1aead3d..437d419 100644
--- a/t/02_basic.t
+++ b/t/02_basic.t
@@ -6,16 +6,15 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test;
-BEGIN { plan tests => 77 };
+BEGIN { plan tests => 77 }
use HTML::Scrubber;
-ok(1); # If we made it this far, we're ok. # test 1
+ok(1); # If we made it this far, we're ok. # test 1
#########################
# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.
-
my $html = q[
<script>//blah</script>
<HR Align="left">
@@ -31,121 +30,119 @@ my $html = q[
my $scrubber = HTML::Scrubber->new();
-ok( $scrubber ); # test 2
-ok( ! $scrubber->default() ); # test 3
-ok( ! $scrubber->comment() ); # test 4
-ok( ! $scrubber->process() ); # test 5
-ok( ! $scrubber->allow( qw[ p b i u hr br ] ) ); # test 6
+ok($scrubber); # test 2
+ok( !$scrubber->default() ); # test 3
+ok( !$scrubber->comment() ); # test 4
+ok( !$scrubber->process() ); # test 5
+ok( !$scrubber->allow(qw[ p b i u hr br ]) ); # test 6
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 7
-ok( $scrubber !~ /href/i ); # test 8
-ok( $scrubber !~ /Align/i ); # test 9
-ok( $scrubber !~ /\Q<!--\E/ ); # test 10
-ok( $scrubber =~ /bold </ ); # test 11
+ok($scrubber); # test 7
+ok( $scrubber !~ /href/i ); # test 8
+ok( $scrubber !~ /Align/i ); # test 9
+ok( $scrubber !~ /\Q<!--\E/ ); # test 10
+ok( $scrubber =~ /bold </ ); # test 11
-$scrubber = HTML::Scrubber->new( deny => [ qw[ p b i u hr br ] ] );
+$scrubber = HTML::Scrubber->new( deny => [qw[ p b i u hr br ]] );
-ok( $scrubber ); # test 12
-ok( ! $scrubber->default() ); # test 13
-ok( ! $scrubber->comment() ); # test 14
-ok( ! $scrubber->process() ); # test 15
+ok($scrubber); # test 12
+ok( !$scrubber->default() ); # test 13
+ok( !$scrubber->comment() ); # test 14
+ok( !$scrubber->process() ); # test 15
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 16
-ok( $scrubber !~ /[><]/ ); # test 17
-ok( $scrubber !~ /href/i ); # test 18
-ok( $scrubber !~ /Align/i ); # test 19
-ok( $scrubber !~ /\Q<!--\E/ ); # test 20
-ok( $scrubber =~ /bold </ ); # test 21
+ok($scrubber); # test 16
+ok( $scrubber !~ /[><]/ ); # test 17
+ok( $scrubber !~ /href/i ); # test 18
+ok( $scrubber !~ /Align/i ); # test 19
+ok( $scrubber !~ /\Q<!--\E/ ); # test 20
+ok( $scrubber =~ /bold </ ); # test 21
-$scrubber = HTML::Scrubber->new( default => [ 0 ] );
+$scrubber = HTML::Scrubber->new( default => [0] );
-ok( $scrubber ); # test 22
-ok( ! $scrubber->default() ); # test 23
-ok( ! $scrubber->comment() ); # test 24
-ok( ! $scrubber->process() ); # test 25
+ok($scrubber); # test 22
+ok( !$scrubber->default() ); # test 23
+ok( !$scrubber->comment() ); # test 24
+ok( !$scrubber->process() ); # test 25
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 26
-ok( $scrubber !~ /[><]/ ); # test 27
-ok( $scrubber !~ /href/i ); # test 28
-ok( $scrubber !~ /Align/i ); # test 29
-ok( $scrubber !~ /\Q<!--\E/ ); # test 30
-ok( $scrubber =~ /bold </ ); # test 31
+ok($scrubber); # test 26
+ok( $scrubber !~ /[><]/ ); # test 27
+ok( $scrubber !~ /href/i ); # test 28
+ok( $scrubber !~ /Align/i ); # test 29
+ok( $scrubber !~ /\Q<!--\E/ ); # test 30
+ok( $scrubber =~ /bold </ ); # test 31
-$scrubber = HTML::Scrubber->new( default => [ 1 ] );
+$scrubber = HTML::Scrubber->new( default => [1] );
-ok( $scrubber ); # test 32
-ok( $scrubber->default() ); # test 33
-ok( ! $scrubber->comment() ); # test 34
-ok( ! $scrubber->process() ); # test 35
+ok($scrubber); # test 32
+ok( $scrubber->default() ); # test 33
+ok( !$scrubber->comment() ); # test 34
+ok( !$scrubber->process() ); # test 35
#use Data::Dumper;die Dumper( [ $scrubber, $scrubber->scrub($html) ]);
$scrubber = $scrubber->scrub($html);
+ok($scrubber); # test 36
+ok( $scrubber =~ /[><]/ ); # test 37
+ok( $scrubber !~ /href/i ); # test 38
+ok( $scrubber !~ /Align/i ); # test 39
+ok( $scrubber !~ /\Q<!--\E/ ); # test 40
+ok( $scrubber =~ /bold </ ); # test 41
-ok( $scrubber ); # test 36
-ok( $scrubber =~ /[><]/ ); # test 37
-ok( $scrubber !~ /href/i ); # test 38
-ok( $scrubber !~ /Align/i ); # test 39
-ok( $scrubber !~ /\Q<!--\E/ ); # test 40
-ok( $scrubber =~ /bold </ ); # test 41
-
-$scrubber = HTML::Scrubber->new( default => [ 1 ] );
+$scrubber = HTML::Scrubber->new( default => [1] );
-ok( $scrubber ); # test 42
-ok( $scrubber->default() ); # test 43
-ok( ! $scrubber->comment() ); # test 44
-ok( ! $scrubber->process() ); # test 45
-ok( ! $scrubber->comment(1) ); # test 46
+ok($scrubber); # test 42
+ok( $scrubber->default() ); # test 43
+ok( !$scrubber->comment() ); # test 44
+ok( !$scrubber->process() ); # test 45
+ok( !$scrubber->comment(1) ); # test 46
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 47
-ok( $scrubber =~ /[><]/ ); # test 48
-ok( $scrubber !~ /href/i ); # test 49
-ok( $scrubber !~ /Align/i ); # test 50
-ok( $scrubber =~ /\Q<!--\E/ ); # test 51
-ok( $scrubber =~ /bold </ ); # test 52
-
+ok($scrubber); # test 47
+ok( $scrubber =~ /[><]/ ); # test 48
+ok( $scrubber !~ /href/i ); # test 49
+ok( $scrubber !~ /Align/i ); # test 50
+ok( $scrubber =~ /\Q<!--\E/ ); # test 51
+ok( $scrubber =~ /bold </ ); # test 52
$scrubber = HTML::Scrubber->new( default => [ 1 => { align => 1, '*' => 0 } ] );
-ok( $scrubber ); # test 53
-ok( $scrubber->default() ); # test 54
-ok( ! $scrubber->comment() ); # test 55
-ok( ! $scrubber->process() ); # test 56
-ok( ! $scrubber->comment(1) ); # test 57
+ok($scrubber); # test 53
+ok( $scrubber->default() ); # test 54
+ok( !$scrubber->comment() ); # test 55
+ok( !$scrubber->process() ); # test 56
+ok( !$scrubber->comment(1) ); # test 57
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 58
-ok( $scrubber =~ /[><]/ ); # test 59
-ok( $scrubber !~ /href/i ); # test 60
-ok( $scrubber =~ /Align/i ); # test 61
-ok( $scrubber =~ /\Q<!--\E/ ); # test 62
-ok( $scrubber =~ /"left"/ ); # test 63
-ok( $scrubber =~ /bold </ ); # test 64
+ok($scrubber); # test 58
+ok( $scrubber =~ /[><]/ ); # test 59
+ok( $scrubber !~ /href/i ); # test 60
+ok( $scrubber =~ /Align/i ); # test 61
+ok( $scrubber =~ /\Q<!--\E/ ); # test 62
+ok( $scrubber =~ /"left"/ ); # test 63
+ok( $scrubber =~ /bold </ ); # test 64
$scrubber = HTML::Scrubber->new( default => [ 1 => { align => 0, '*' => 1 } ] );
-ok( $scrubber ); # test 65
-ok( $scrubber->default() ); # test 66
-ok( ! $scrubber->comment() ); # test 67
-ok( ! $scrubber->process() ); # test 68
-ok( ! $scrubber->comment(1) ); # test 69
+ok($scrubber); # test 65
+ok( $scrubber->default() ); # test 66
+ok( !$scrubber->comment() ); # test 67
+ok( !$scrubber->process() ); # test 68
+ok( !$scrubber->comment(1) ); # test 69
$scrubber = $scrubber->scrub($html);
-ok( $scrubber ); # test 70
-ok( $scrubber =~ /[><]/ ); # test 71
-ok( $scrubber =~ /href/i ); # test 72
-ok( $scrubber !~ /Align/i ); # test 73
-ok( $scrubber =~ /\Q<!--\E/ ); # test 74
-ok( $scrubber =~ /\Q"\E/ ); # test 75
-ok( $scrubber =~ /\#/ ); # test 76
-ok( $scrubber =~ /bold </ ); # test 77
+ok($scrubber); # test 70
+ok( $scrubber =~ /[><]/ ); # test 71
+ok( $scrubber =~ /href/i ); # test 72
+ok( $scrubber !~ /Align/i ); # test 73
+ok( $scrubber =~ /\Q<!--\E/ ); # test 74
+ok( $scrubber =~ /\Q"\E/ ); # test 75
+ok( $scrubber =~ /\#/ ); # test 76
+ok( $scrubber =~ /bold </ ); # test 77
diff --git a/t/03_more.t b/t/03_more.t
index 68c60cd..52554ae 100644
--- a/t/03_more.t
+++ b/t/03_more.t
@@ -3,7 +3,7 @@
use strict;
-use Test::More tests => 7;
+use Test::More tests => 7;
BEGIN { $^W = 1 }
use_ok( 'HTML::Scrubber' );
diff --git a/t/04_style_script.t b/t/04_style_script.t
index e9d6dd3..f1c5130 100644
--- a/t/04_style_script.t
+++ b/t/04_style_script.t
@@ -1,7 +1,7 @@
# perl Makefile.PL && nmake realclean && cls && perl Makefile.PL && nmake test
use strict;
-use Test::More tests => 9;
+use Test::More tests => 9;
BEGIN { $^W = 1 }
use_ok( 'HTML::Scrubber' );
diff --git a/t/05_pi_comment.t b/t/05_pi_comment.t
index f90d419..7514fe6 100644
--- a/t/05_pi_comment.t
+++ b/t/05_pi_comment.t
@@ -1,7 +1,7 @@
# perl Makefile.PL && nmake realclean && cls && perl Makefile.PL && nmake test
use strict;
-use Test::More tests => 9;
+use Test::More tests => 9;
BEGIN { $^W = 1 }
use_ok( 'HTML::Scrubber' );
diff --git a/t/07_booleans.t b/t/07_booleans.t
index 6a5a640..a36b65a 100644
--- a/t/07_booleans.t
+++ b/t/07_booleans.t
@@ -14,7 +14,7 @@ $scrubber->allow( @allow );
$scrubber->default(
undef, # don't change
{ # default attribute rules
- '/' => 1, # '/' ia boolean (stand-alone) attribute
+ '/' => 1, # '/' ia boolean (stand-alone) attribute
'pie' => 1,
'selected' => 1,
'disabled' => 1,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libhtml-scrubber-perl.git
More information about the Pkg-perl-cvs-commits
mailing list