docs: fix example matching in extract.pl

When building with $srcdir != $builddir output would contain the builddir path.
Strip the path when scanning the xml for the example markers.
This commit is contained in:
Stefan Kost 2010-12-03 10:18:19 +02:00
parent 898583b2a0
commit caf006c03a

View file

@ -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);
}