# main
my $output = shift @ARGV;
+# strip path parts
+$output =~ m/.*\/(.*)$/;
+my $outputname = $1;
+
$found = 0;
%blocks = ();
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;
}
if (!$found)
{
- print "Could not find $output example !\n";
+ print "Could not find $outputname example !\n";
exit(1);
}