use strict;
use CGI ();
-$CGI::Pretty::VERSION = '1.04';
+$CGI::Pretty::VERSION = '1.05_00';
$CGI::DefaultClass = __PACKAGE__;
$CGI::Pretty::AutoloadClass = 'CGI';
@CGI::Pretty::ISA = qw( CGI );
return;
}
}
- $$input =~ s/$CGI::Pretty::LINEBREAK/$CGI::Pretty::LINEBREAK$CGI::Pretty::INDENT/g;
+ $$input =~ s/$CGI::Pretty::LINEBREAK/$CGI::Pretty::LINEBREAK$CGI::Pretty::INDENT/g if $CGI::Pretty::LINEBREAK;
}
sub comment {
my($self,@p) = CGI::self_or_CGI(@_);
my $s = "@p";
- $s =~ s/$CGI::Pretty::LINEBREAK/$CGI::Pretty::LINEBREAK$CGI::Pretty::INDENT/g;
+ $s =~ s/$CGI::Pretty::LINEBREAK/$CGI::Pretty::LINEBREAK$CGI::Pretty::INDENT/g if $CGI::Pretty::LINEBREAK;
return $self->SUPER::comment( "$CGI::Pretty::LINEBREAK$CGI::Pretty::INDENT$s$CGI::Pretty::LINEBREAK" ) . $CGI::Pretty::LINEBREAK;
}
(ref(\$_[0]) &&
(substr(ref(\$_[0]),0,3) eq 'CGI' ||
UNIVERSAL::isa(\$_[0],'CGI')));
+
my(\$attr) = '';
if (ref(\$_[0]) && ref(\$_[0]) eq 'HASH') {
my(\@attr) = make_attributes(shift);
\$attr = " \@attr" if \@attr;
}
- my(\$tag,\$untag) = ("\U<$tagname\E\$attr>","\U</$tagname>\E");
+ my(\$tag,\$untag) = ("\L<$tagname\E\$attr>","\L</$tagname>\E");
return \$tag unless \@_;
my \@result;
(ref(\$_[0]) eq 'ARRAY') ? \@{\$_[0]} : "\@_";
}
else {
+ my \@args;
+ if(ref(\$_[0]) eq 'ARRAY') {
+ \@args = \@{\$_[0]}
+ } else {
+ foreach (\@_) {
+ \$args[0] .= \$_;
+ \$args[0] .= " " unless \$args[0] =~ /\\s\$/;
+ }
+ chop \$args[0];
+ }
\@result = map {
chomp;
if ( \$_ !~ /<\\// ) {
- s/\$CGI::Pretty::LINEBREAK/\$CGI::Pretty::LINEBREAK\$CGI::Pretty::INDENT/g;
+ s/\$CGI::Pretty::LINEBREAK/\$CGI::Pretty::LINEBREAK\$CGI::Pretty::INDENT/g if \$CGI::Pretty::LINEBREAK;
}
else {
my \$tmp = \$_;
CGI::Pretty::_prettyPrint( \\\$tmp );
\$_ = \$tmp;
}
- "\$tag\$CGI::Pretty::LINEBREAK\$CGI::Pretty::INDENT\$_\$CGI::Pretty::LINEBREAK\$untag\$CGI::Pretty::LINEBREAK" }
- (ref(\$_[0]) eq 'ARRAY') ? \@{\$_[0]} : "\@_";
+ "\$tag\$CGI::Pretty::LINEBREAK\$CGI::Pretty::INDENT\$_\$CGI::Pretty::LINEBREAK\$untag\$CGI::Pretty::LINEBREAK"
+ } \@args;
}
local \$" = "";
return "\@result";
$CGI::Pretty::LINEBREAK = "\n";
# These tags are not prettify'd.
- @CGI::Pretty::AS_IS = qw( A PRE CODE SCRIPT TEXTAREA );
+ @CGI::Pretty::AS_IS = qw( a pre code script textarea );
1;
}