Filters

The dialog is accessible through menu Preferences / Filters.

General

It creates, edits and deletes filters.

Creating a new filter is simple. Just press button "New", type a name for the filter, choose the type of the filter, and press OK.

Deleting an existing filter is simple too. Select the filter, then press "Delete".

Editing a filter is another simple matter. Select the filter, and type the rules in the Rules window. More about the rules later on.

A filter can be tried out. Press the "Try" button to do that. The text at the left of the button is passed through the filter, and then becomes visible at the right side. Any errors show up there too. The text at the left of the button can be changed to anything.

Rules

Depending on the type of the filter, there are various programs that run the rules.

Sed rules

The program "sed" is used for operating the filter. Sed is a Stream EDitor. It takes the input text, passes it through one or more rules, and then outputs it, modifying it on the fly. The modifications are done according to the rules that have been given.

More help about creating rules is in the sed rules reference, and in the regular expressions reference. A wealth of information about sed, and the rules to write, is available at sed.sourceforge.net.

TECkit mapping

The TECkit package is used for running the filter. TECkit is a toolkit for conversion of data to Unicode. Bibledit uses it only for converting Unicode to Unicode. The package takes the input text, passes it through a set of mapping rules, and then outputs it, modifying it on the fly.

More help about creating the mapping rules is in the TECkit mapping rules reference. More information is available from SIL through the computing index, or more specifically at the TECkit home page.

Free script

A free script is used for running the filter. A free script means any script that you can give and that will run in the shell. Here is an example of a very basic script, one that really doesn't filter at all, it only shows how to write a script:

cat inputfile > outputfile

Bibledit searches for a text "inputfile", and replaces that with the input data. It also searches for text "outputfile", and replaces that with the output data. The script then is passed to the shell, and runs there. The output data is then read again and used.

The above script just takes the input file and copies that to the output file.

Any custom script that you made will do here, in any language. The only thing that is important is that the texts "inputfile" and "outputfile" are there. And of course that the script does something sensible.

Notes

While the USFM text is ran through the filter, an attempt is made that the USFM codes themselves will not be changed. To protect these codes from being changed, the codes are temporally changed into numbers. The assumption here is that the user will not write filters that change numbers. After filtering the numbers are changed back to the original USFM codes again. This process is transparent to the user, that is, the user does not notice that it happens. This process will work well only if the filters don't change the numbers.