Contents Previous Next

## Creating "Target-Specific" Contents with %!preproc

Sometimes you need to insert some text on a specific target, but not on the others. This kind of strange behavior can be done using some PreProc tricks.

The idea is to insert this extra text on the document source as comments, but mark it in a way that a target-specific filter will "uncomment" those lines.

For example, if an extra paragraph must be added only in HTML target. Place the text as special comments, like this:

    %html% This HTML page is Powered by [txt2tags http://txt2tags.org].
    %html% See the source TXT file [here source.t2t].

As those lines start with `%`, they are plain comments lines and will be ignored. But when adding this special filter:

    %preproc(html): '^%html% ' ''

The leading string is removed and those lines will be "activated", not being comments anymore. As a explicit target config, this filter will be processed for HTML targets only.

Contents Previous Next