File: detox.tbl.5

package info (click to toggle)
detox 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,500 kB
  • sloc: ansic: 2,496; sh: 1,468; yacc: 234; makefile: 189; lex: 68; php: 32
file content (127 lines) | stat: -rw-r--r-- 3,168 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
.\"
.\" This file is part of the Detox package.
.\"
.\" Copyright (c) Doug Harple <detox.dharple@gmail.com>
.\"
.\" For the full copyright and license information, please view the LICENSE
.\" file that was distributed with this source code.
.\"
.Dd February 24, 2021
.Dt DETOX.TBL 5
.Os
.Sh NAME
.Nm detox.tbl
.Nd translation table for
.Xr detox 1
.Sh OVERVIEW
.Cm detox
allows for configuration of how the safe, ISO-8859-1, and UTF-8 (Unicode)
filters operate.
Through text-based translation tables, it is possible to tune how these
character sets are interpreted.
.Sh SYNTAX
The format of the translation tables is simple.
There are two levels: one containing meta data and one containing the actual
translations.
.Bl -tag -width 0.25i
.It Cm default Ar _
Default specifies the default translation for a character.
An empty or non-existent default indicates that any unknown character should
fall through to the next filter.
In this manner, it is possible to chain together multiple translation tables in
a sequence.
.It Cm start
Indicates the start of a value list within the translation table.
.It Cm start Ar lang
Indicates the start of a language specific value list within the translation
table.
.It Cm end
Indicates the end of a value list within the translation table.
.It Ar value translation
Value can be specified in decimal (1), hex (0x01) or octal (01).
The same rules that apply to sscanf apply here.
.Pp
Translation can be a string or a quoted string, with either single or double
quotes.
.El
.Sh EXAMPLES
The following example shows a portion of a
.Ar safe
table, with only a few character replacements specified.
.Bd -literal
#
# This is a simple example of a "safe" table.  It only translates 4 characters.
#
# The default is commented out, so any character that is not in this table will
# be ignored.
#

# default   _

#
# This is the main replacement block.  Each line specifies a character and a
# string to replace it with.
#

start
0x09	_tab_		# comments work on lines, too
0x24	_dollar_	# $$$
0x26	_and_		# ampersand
end

#
# Starts an optional, language-specific translation block.  detox will read
# your locale and load the block if the word after start matches the language
# portion of your locale.
#
# In the example here, the character $ will be replaced with "_money_" if the
# user is working in English.  If the user is using a different language, $
# will be replaced with the value configured in the previous block, "_dollar_".
#

start en
0x24	_money_		# money money
end

# EOF
.Ed
.Pp
You could then enable this table in your
.Pa ~/.detoxrc ,
in conjunction with other filters.
.Bd -literal
.\" START SAMPLE
# Sample detoxrc

sequence default {
	safe {
		filename "/home/MYUSERNAME/.local/share/detox/safe.tbl";
	};
	safe;
	wipeup;
};

# EOF
.\" END SAMPLE
.Ed
.Pp
When
.Cm detox
is run, it will run the custom safe filter first, then run the default
.Ar safe
filter, and the finally the
.Ar wipeup
filter.
See
.Xr detoxrc 5
for more details on the various filter types.
.Sh SEE ALSO
.Xr detox 1 ,
.Xr detoxrc 5 ,
.Xr ascii 7 ,
.Xr iso_8859-1 7 ,
.Xr unicode 7 ,
.Xr utf-8 7
.Sh AUTHORS
detox was written by
.An "Doug Harple" .