[Haskell-cafe] ANN: Newt - command-line template instantiation tool & library

Rogan Creswick creswick at gmail.com
Fri May 13 06:57:10 CEST 2011


On Mon, May 9, 2011 at 8:25 AM, Rogan Creswick <creswick at gmail.com> wrote:
> Indeed :)  The tag syntax is controlled by two command-line flags:
> --prefix=... and --suffix=...
>
> It can be difficult to get the desired strings past both the shell and
> the regular expression compiler (although that last bit is changing...
> Josh Hoyt sent a patch that switches to basic string inspection, which
> should make this much simpler to use.)

I've just released newt-0.0.3.0, which has the patch from Josh (It
also uses a much nicer command-line syntaxt - it's backwards
compatible, but you can leave off the --source / --dest specifiers
now.)

With Josh's patch, things like this "just work":

 $ newt  --prefix="***" --suffix="***"

You can also look at the configuration structure with --verbose to
help debug problems with these flags:
 $ newt --list <some input file> --prefix="***" --suffix="***" --verbose
Using configuration: Config {source = Just
"tests/testFiles/simpleTest/alternate1.txt", dest = Nothing, rawTable
= [], list = True, inplace = False, prefix = Just "***", suffix = Just
"***", verb = Loud}

This release also fixes a pretty important bug relating to binary
files... you couldn't have any binary content in your templates --
0.0.3.0 doesn't try to perform template replacements on binary files
now (which failed immediately in hGetContents in the previous
version).

Feedback / suggestions are always appreciated :)

Thanks!
--Rogan



More information about the Haskell-Cafe mailing list