Shlomi Fish avatar Shlomi Fish committed 561e90f

Remove trailing space

Comments (0)

Files changed (2)

   Module::Build: 0.40
 dynamic_config: 1
 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921'
+keywords:
+  - bandwidth
+  - compression
+  - html
+  - reduce
+  - remove
+  - size
+  - space
+  - strip
+  - tags
+  - whitespace
 license: mit
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   vars: 0
   warnings: 0
 resources:
+  homepage: http://web-cpan.shlomifish.org/modules/HTML-Strip-Whitespace/
   license: http://opensource.org/licenses/mit-license.php
+  repository: http://bitbucket.org/shlomif/perl-html-strip-whitespace
 version: v0.1.6

lib/HTML/Strip/Whitespace.pm

 package HTML::Strip::Whitespace;
 
-package HTML::Strip::Whitespace::State;
-
 use strict;
 use warnings;
 
+package HTML::Strip::Whitespace::State;
+
 sub new
 {
     my $class = shift;
     $self->{'prev'} = undef;
     $self->{'next'} = undef;
     $self->{'this'} = undef;
-    $self->{'parser'} = 
+    $self->{'parser'} =
         HTML::TokeParser::Simple->new(
             to_array($args{'parser_args'})
         );
 sub next_state
 {
     my $self = shift;
-    ($self->{'prev'}, $self->{'this'}, $self->{'next'}) = 
+    ($self->{'prev'}, $self->{'this'}, $self->{'next'}) =
         ($self->{'this'}, $self->{'next'}, $self->{'parser'}->get_token());
     if (!defined($self->{'this'}))
     {
 {
     my $self = shift;
     my $t = $self->this();
-    if ($t->is_start_tag() && 
+    if ($t->is_start_tag() &&
         exists($preserving_start_tags{$t->get_tag()})
        )
     {
 sub handle_text
 {
     my $state = shift;
-    
+
     if ($state->this->is_text())
     {
         $state->out($state->text_strip());
     my $self = shift;
     my $what = shift;
     my $out_fh = $self->{'out_fh'};
-    
+
     if (ref($out_fh) eq "CODE")
     {
         &{$out_fh}($what);
 sub process
 {
     my $state = shift;
-    
+
     my $tag_type;
 
     while ($state->next_state())
 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} });
 
 @EXPORT = qw(
-	
+
 );
 
 $VERSION = '0.1.6';
 sub html_strip_whitespace
 {
     my %args = (@_);
-    my $source = $args{'source'} or 
+    my $source = $args{'source'} or
         die "source argument not specified.";
     my $strip_newlines = $args{'strip_newlines'} || 0;
     my $out_fh = $args{'out'} or
         die "out argument not specified.";
-    my $state = 
+    my $state =
         HTML::Strip::Whitespace::State->new(
             'parser_args' => $source,
             'strip_newlines' => $strip_newlines,
 =head1 SYNOPSIS
 
     use HTML::Strip::Whitespace qw(html_strip_whitespace);
-    
+
     my $html = <<"EOF";
     <html>
     <body>
-    
+
     <p>
         Hello there!
     </p>
-    
+
     </body>
     </html>
     EOF
     my $buffer = "";
-    
+
     html_strip_whitespace(
         'source' => \$html,
         'out' => \$buffer
 without eliminating valid whitespace (like the one inside <pre>).
 
 To use it call the function C<HTML::Strip::Whitespace::html_strip_whitespace>,
-with named parameters. C<source> is the HTML::TokeParser source for the 
-HTML. C<out> can be a reference to a buffer which will be filled with the 
+with named parameters. C<source> is the HTML::TokeParser source for the
+HTML. C<out> can be a reference to a buffer which will be filled with the
 stripped HTML, or alternatively a reference to a sub-routine or a file handle
 that will output it.
 
 
 =head2 html_strip_whitespace(source => $src, out => $out, strip_newlinews => $strip)
 
-C<source> is the HTML::TokeParser source for the 
-HTML. C<out> can be a reference to a buffer which will be filled with the 
+C<source> is the HTML::TokeParser source for the
+HTML. C<out> can be a reference to a buffer which will be filled with the
 stripped HTML, or alternatively a reference to a sub-routine or a file handle
 that will output it.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.