TemplateFilter - Generate text from CSV-style input using templates

It's a text filter that can parse CSV style input (multiple values per row separated with ";" semicolons) and generate text based on a template applied per input row

Download: TemplateFilter_20100930.zip

Instructions:

  1. Unpack .EXE, .BAT and .TXT from .ZIP file in a folder
  2. Double-click .BAT to execute demo that creates and displays a webpage with a files list (with links to respective files) for the current folder
  3. Right-click .BAT and select "Edit" to see how it works (dumping explorer.exe to the command-line and filtering out control chars)
  4. Right-click .TXT to see/edit the template format

Template format:

* The example batch file is the following:

dir /b | TemplateFilter TestTemplate.txt > TestOutput.html
start TestOutput.html
@pause

* The example template (to create an HTML link for each filename returned by "dir /b" [b=bare mode] command) is as follows:

<a href="%1">%1</a><br />

%1, %2, etc. in the template text are placeholders for column values of each input row - columns are separated by ";", however you could modify the code to change this or add a 2nd command-line parameter for the caller to define the separator character

Source code:

Source code in Object Pascal / Delphi (the .DPR file holds the Delphi command-line project code) included

(C)opyright 2010 - Zoomicon / George Birbilis
Free to use / give due credit