bagder: curl-www/docs faqparse.pl,1.10,1.11

[email protected] Mon, 14 Mar 2011 12:30:55 +0000
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/docs
In directory giant.haxx.se:/var/tmp/cvs-serv18619

Modified Files:
	faqparse.pl 
Log Message:
trying a version of this script that concatenates longer lines to possibly
make nicer HTML...


Index: faqparse.pl
===================================================================
RCS file: /cvsroot/curl/curl-www/docs/faqparse.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- faqparse.pl	7 Sep 2010 19:46:08 -0000	1.10
+++ faqparse.pl	14 Mar 2011 12:30:53 -0000	1.11
@@ -92,7 +92,8 @@
             $s =~ s/\>/&gt;/g;
             $s =~ s/^ *(.*) */$1/;
             print "<a name=\"$link{$toc[$q]}\"></a>";
-            print "<h3>$s</h3><p>\n";
+            print "<h3>$s</h3>\n";
+            $line=0;
             $q++;
         }
         else {
@@ -117,13 +118,24 @@
                 
                 # prevent many blanks
                 my $show = $_;
+                my $pref=0;
                 if($show =~ /^ *$/) {
                     $blank++;
                 }
                 else {
                     $blank=0;
+                    if($show =~ /^([ |\t]+)/) {
+                        $pref=length($1);
+                    }
+                    $line++;
                 }
-                print "$show<br>" if($blank < 2);
+                if($oldpref == $pref) {
+                    print " $show " if($blank < 2);                    
+                }
+                else {
+                    printf("%s$show", ($line>1)?"<br>":"") if($blank < 2);
+                }
+                $oldpref = $pref;
             }
         }
     }