Explorar o código

examples: Handle newlines in README.txt better.

Ryan C. Gordon hai 8 meses
pai
achega
47429227ab
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      build-scripts/build-web-examples.pl

+ 8 - 2
build-scripts/build-web-examples.pl

@@ -167,18 +167,24 @@ sub handle_example_dir {
     my $onmouseoverdst = "$dst/$onmouseoverfname";
 
     my $description = '';
+    my $has_paragraph = 0;
     if (open(my $readmetxth, '<', "$examples_dir/$category/$example/README.txt")) {
         while (<$readmetxth>) {
             chomp;
             s/\A\s+//;
             s/\s+\Z//;
-            if ($_ eq '') {
-                $description .= "\n<br/>\n<br/>\n";
+            if (($_ eq '') && ($description ne '')) {
+                $has_paragraph = 1;
             } else {
+                if ($has_paragraph) {
+                    $description .= "\n<br/>\n<br/>\n";
+                    $has_paragraph = 0;
+                }
                 $description .= "$_ ";
             }
         }
         close($readmetxth);
+        $description =~ s/\s+\Z//;
     }
 
     do_mkdir($dst);