What is FMPP?
-------------

FMPP is a general-purpose text file preprocessor tool that uses FreeMarker templates. It is particularly designed for HTML preprocessor, to generate complete (static) homepages: directory structure that contains HTML-s, image files, etc. But of course it can be used to generate source code or whatever text files. FMPP is extendable with Java classes to pull data from any data sources (database, etc.) and embed the data into the generated files.


Basic usage
-----------

FMPP can work in two ways: as bulk file processor (by design), and as single file processor (patch...).

When you use it as bulk file processor, it needs a source root directory and an output root directory. It processes all files inside the source root (including the files in its subdirectories), and writes the processed files into the output root directory with similar path as in the source root (i.e. the output of source-root/foo/bar.txt will be output-root/foo/bar.txt. If src is the source root, out is the output root, then you should issue this command: 

  fmpp -S src -O out 

It is possible to tell fmpp to process only certain files and/or directories of the source root. Say, process only index.html, foo, and somedir:

  fmpp -S src -O out index.html foo/bar.txt somedir 

It's important that the paths are interprted relatively to the source root directory, not to the current working directory.

When you use it as single file processor, you specify a single input file, and an output file with the -o option. The -o option is what triggers single file mode.

  fmpp filetoprocess.txt -o processed.txt 

In single file mode the source and output file paths are interpreted relatively to the current working directory, not to the source and output root directories. Furthermore, the source root and output root defaults to the directory of source and output files respectively (they has significance, say, if the source file wants to include another file), but you can override them with the -S and -O switches.


Quick tips
----------

Use log file to record more details about errors:

  fmpp -S src -O out -L log.fmpp

Use option -c to skip to the next file on failed file processing (and log the error)

  fmpp -S src -O out -L log.fmpp -c
  
Use option -M to set how to handle the files. Which files to exclude, which files to binary-copy, etc.:

  fmpp -S src -O out -M "ignore(tmp/), copy(**/*.dwg, bin/)"

Use configuration files instead of entering everything as command-line argument. For example create file config.fmpp with this content:

  sourceRoot: src
  outputRoot: out
  logFile: log.fmpp
  stopOnError: false
  modes: [ignore(tmp/), copy(**/*.dwg, bin/)]

then use it as:

  fmpp -C path/to/my/project/config.fmpp

or since config.fmpp is the default configuration file name, you can simply write:

  fmpp -C path/to/my/project
  
or if you are in the same directory as config.fmpp then just write:

  fmpp

Note that the paths in the configuration file are resolved relatively to the configuration file, so it does not mater where do you invoke it from. Also note that you can override the settings stored in the configuration file with the command line:

  fmpp -C path/to/my/project/config.fmpp -O other/destination
  

More help
---------

For detailed documentation please read the FMPP Manual that comes with the FMPP distribution.

For the latest version, to ask help, or to report bugs visit:
http://fmpp.sourceforge.net/

You can also report bugs in e-mail:
ddekanyREMOVETHIS@freemail.hu (delete the "REMOVETHIS"!)