docs: fix example matching in extract.pl
authorStefan Kost <ensonic@users.sf.net>
Fri, 3 Dec 2010 08:18:19 +0000 (10:18 +0200)
committerStefan Kost <ensonic@users.sf.net>
Fri, 3 Dec 2010 08:18:19 +0000 (10:18 +0200)
When building with $srcdir != $builddir output would contain the builddir path.
Strip the path when scanning the xml for the example markers.

tests/examples/manual/extract.pl

index 5c257c7..9726c94 100755 (executable)
@@ -30,6 +30,10 @@ xml_decode ($)
 # main
 my $output = shift @ARGV;
 
+# strip path parts
+$output =~ m/.*\/(.*)$/;
+my $outputname = $1;
+
 $found = 0;
 %blocks = ();
 
@@ -39,17 +43,17 @@ foreach $file (@ARGV)
 
   while ($line = <FILE>)
   {
-    if ($line =~ /<!-- example-begin $output (.*?)-->/)
+    if ($line =~ /<!-- example-begin $outputname (.*?)-->/)
     {
       $found = 1;
       $block_id = $1;
       $block = "\n/*** block $block_id from $file ***/\n";
 
-      print "Extracting $output block $block_id from $file\n";
+      print "Extracting $outputname block $block_id from $file\n";
 
       while ($line = <FILE>)
       {
-        if ($line =~ /<!-- example-end $output (.*?)-->/)
+        if ($line =~ /<!-- example-end $outputname (.*?)-->/)
         {
           last;
         }
@@ -63,7 +67,7 @@ foreach $file (@ARGV)
 
 if (!$found)
 {
-  print "Could not find $output example !\n";
+  print "Could not find $outputname example !\n";
   exit(1);
 }