[WM] Recursive reading of content files

Justin Mason jm.jmason.org
Fri Jan 3 12:17:03 GMT 2003


Warren Post said:

> Thank you, Duncan. With this code I can now recursively read the source 
> files and recursively create output files:

> <contents src="../src" name=".../*.txt" listname="srcfiles" />

Warren,

try

  <contents src="../src" name=".../*.txt" listname="srcfiles"
	namesubst="s/.txt//" />

the "namesubst" will remove the ".txt" suffix when creating the list.

I think that'll do it.

BTW you can now get rid of this block:

> <content name=all_files>
> <{perl
>    # borrowed from webmake.taint.org
>    # create a ${all_files} variable containing the list
>    # of all the text files we just loaded.
>    $_ = "";
>    foreach my $pg (content_matching ("*.txt")) {
>      $pg =~ s/.txt//; $_ .= "$pg ";
>    }
>    $_;
> }>
> </content>

Hope that helps!

--j.




More information about the Webmake-talk mailing list