Contents Previous Next


The PostProc is an output filter that changes the converted document. It is a "find and replace" feature, applied after all txt2tags parsing and processing is done.

It is useful to do some refinements on the generated document, change tags and add extra text or tags. Quick samples:

%!postproc(html): '<BODY.*?>' '<BODY BGCOLOR="green">'
%!postproc(tex) : "\\newpage" ""

These filters change the background color of the HTML page and remove the page breaks on the LaTeX target.

The PostProc rules are just like an external Sed/Perl filter, called this way:

$ txt2tags -t html -o- file.t2t | > file.html

Before this feature was introduced, it was very common to have little scripts to "adjust" the txt2tags results. These scripts were in fact just lots of sed (or alike) commands, to do "substitute this for that" actions. Now this replacement strings can be saved together with the document text, and the plus is to use the Python powerful Regular Expression machine to find patterns.

Contents Previous Next