DETOXRC(5) | File Formats Manual | DETOXRC(5) |
detoxrc
—
configuration file for
detox(1)
detox allows for configuration of its sequences through config files. This document describes how these files work.
When setting up a new set of rules, the
safe
and wipeup
filters must
always be run after a translating filter (or series thereof), such as the
utf_8
or the uncgi
filters.
Otherwise, the risk of introducing illegal characters into the filename is
introduced.
The format of this configuration file is C-like. It is based loosely off named's configuration files. Each statement is semicolon terminated, and modifiers on a particular statement are generally contained within braces.
sequence
"name" {...};There is a special sequence, named "default", which
is the default sequence used by detox. This can be overridden through
the command line option -s
or the environmental
variable DETOX_SEQUENCE
.
Sequence names are case sensitive and unique throughout all sequences; that is, if a system wide file defines normal_seq and a user has a sequence with the same name in their .detoxrc, the users' normal_seq will take precedence.
iso8859_1
{filename
"/path/to/filename";};safe
filter.
Under normal circumstances, the filename syntax is not needed. Detox looks in several locations for a file called iso8859_1.tbl, which is a set of rules defining how an ISO 8859-1 character should be translated.
In the event this table doesn't exist, you have two options. You can download or create your own, and tell detox the location of it using the filename syntax shown above, or you can let detox fall back on its internal tables. The internal tables translate the same as the stock translation tables.
You can chain together multiple iso8859_1 translations, as long as the default value of all but the last one is set to nothing. This is explained in detox.tbl(5).
This filter is mutually exclusive with the
utf_8
filter.
utf_8
{filename
"/path/to/filename";};This operates in a manner similar to
iso8859_1
, except it looks for a translation
table called unicode.tbl.
The default internal translation for Unicode characters only contains the lower 256 characters of Unicode, which is equivalent to the set of Basic Latin and Latin-1 characters.
uncgi
;safe
{filename
"/path/to/filename";};In earlier versions this filter was entirely internal.
Starting with 1.2.0, this filter is controlled by a translation table.
In the absence of the translation table, the previous code will be
employed for the translation. Also, prior to 1.2.0, the safe filter
removed leading dashes to prevent the hassle of dealing with a filename
in the format -filename. This functionality is
exclusively handled by the wipeup
filter
now.
See the SAFE section for more details on what this filter translates by default.
wipeup
{remove_trailing
;};The remove trailing option removes a dash or underscore followed immediately by a period.
See the WIPEUP section for more details on what this filter translates.
max_length
{length
value;};For instance, given a max length of 12, and a filename of "this_is_my_file.txt", the filter would output "this_is_.txt".
lower
;#
Comments
sequence default { uncgi; iso8859_1 { filename "iso8859_1.tbl"; }; # utf_8 { # filename "unicode.tbl"; # }; safe { filename "safe.tbl"; }; wipeup { remove_trailing; }; # max_length { # length 128; # }; };
The following characters are translated by the stock
safe
filter. They can be tuned by updating safe.tbl
or creating a copy of safe.tbl and updating your rc file.
Safe | Original |
_and_ | & |
_ | space ` ! @ $ * \ | : ; " ' < > ? / |
- | ( ) [ ] { } |
The following characters are translated by the
wipeup
filter.
Wipeup | Original |
- | -_ |
- | _- |
- | -- |
_ | __ |
Any leading dashes are stripped to prevent programs from interpreting these files as command line options.
Wipeup | Original |
removed | - _ # |
Wipeup | Original |
. | .- |
. | -. |
. | ._ |
. | _. |
detox was written by Doug Harple.
August 3, 2004 | Debian |