bagder: curl-www/docs faqparse.pl,1.2,1.3

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/docs
In directory labb.contactor.se:/tmp/cvs-serv23165

Modified Files:
	faqparse.pl 
Log Message:
somewhat better faq output


Index: faqparse.pl
===================================================================
RCS file: /cvsroot/curl/curl-www/docs/faqparse.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- faqparse.pl	12 Aug 2004 11:44:13 -0000	1.2
+++ faqparse.pl	25 Nov 2004 14:18:17 -0000	1.3
@@ -14,6 +14,7 @@
 
 my $q=0;
 my $sec = 0;
+my $blank=0;
 
 while(<STDIN>) {
     if($state == 1) {
@@ -61,7 +62,10 @@
 
         elsif($toc[$q] && ($_ =~ /^\s*$toc[$q]/i)) {
             # a question
-            print "<a name=\"$toc[$q]\"></a><b>$_</b><br>";
+            my $s=$_;
+            chomp $s;
+            $s =~ s/^ *(.*) */$1/;
+            print "<a name=\"$toc[$q]\"></a><h3>$s</h3><p>\n";
             $q++;
         }
         else {
@@ -81,7 +85,16 @@
                     undef @pre;
                 }
                 $l = s/((http|ftp):\/\/([a-z0-9.\/_%-?]*[a-z\/]))/<a href=\"$2:\/\/$3\">$1<\/a>/g;
-                print "$_<br>";
+                
+                # prevent many blanks
+                my $show = $_;
+                if($show =~ /^ *$/) {
+                    $blank++;
+                }
+                else {
+                    $blank=0;
+                }
+                print "$show<br>" if($blank < 2);
             }
         }
     }

_______________________________________________
http://cool.haxx.se/mailman/listinfo/curl-www-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.