validator/httpd/cgi-bin check,1.671,1.672

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv28893/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Improve outline layout, simplify creation.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.671
retrieving revision 1.672
diff -u -d -r1.671 -r1.672
--- check	30 Jun 2009 15:20:52 -0000	1.671
+++ check	30 Jun 2009 17:26:45 -0000	1.672
@@ -3301,19 +3301,15 @@
   my $File = shift;
   my $CFG = shift;
   my $self = $class->SUPER::new($parser, $File, $CFG);
-  $self->{current_heading_level}= 0;
   $self->{am_in_heading} = 0;
+  $self->{heading_text} = [];
   bless $self, $class;
 }
 
 sub data
 {
   my ($self, $chars) = @_;
-  if ($self->{am_in_heading} == 1) {
-    my $data = $chars->{Data};
-    $data =~  s/[\r|\n]/ /g;
-    $self->{_file}->{heading_outline} .= $data;
-  }
+  push(@{$self->{heading_text}}, $chars->{Data}) if $self->{am_in_heading};
 }
 
 sub start_element
@@ -3333,8 +3329,13 @@
 {
   my ($self, $element) = @_;
   if ($element->{Name} =~ /^h[1-6]$/i) {
-    $self->{_file}->{heading_outline} .= "\n";
+    my $text = join("", @{$self->{heading_text}});
+    $text =~ s/^\s+//g;
+    $text =~ s/\s+/ /g;
+    $text =~ s/\s+$//g;
+    $self->{_file}->{heading_outline} .= "$text\n";
     $self->{am_in_heading} = 0;
+    $self->{heading_text} = [];
   }
 }
 

Received on Tuesday, 30 June 2009 17:26:56 UTC