-
Notifications
You must be signed in to change notification settings - Fork 27
/
README.rules
170 lines (130 loc) · 4.08 KB
/
README.rules
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
* Rules overview
libskk supports various typing rules such as AZIK, ACT, TUT-Code,
which define keyboard shortcuts and romaji-to-kana conversion table.
Rules are normally read from ~/.config/libskk/rules and
/usr/share/libskk/rules.
* Rule directory structure
A rule consists of the following directory structure:
<root>
metadata.json
keymap/
<map-file>
...
rom-kana/
<map-file>
...
* Rule metadata
Each rule must have metadata.json in the top level directory, with the
following content:
{
"name": <name of the rule>,
"description": <description of the rule>,
"filter": <name of the optional keyboard filter (mainly used by NICOLA)>
}
* Format of map files
Each file under keymaps/ and rom-kana/ directories is used to define
some key-value mappings. They are in the following format:
{
"include": [
<parent>,
...
],
"define": {
<map>: {
<key>: <value>,
...
},
...
}
}
The value associated with "include" is an array of parent map files,
which will be included before evaluating the map file itself. The
value associated with "define" is an object which binds some variables
to values.
** Path name resolution
Each element in "include" may be either a relative or absolute path.
A relative path does not include "/" while absolute one does.
If path is relative, the map file is located under the same directory
of the current map file. Otherwise, libskk looks for the map file
outside of the diretory where the current map file is located.
Example:
If the current map file is <root>/foo/rom-kana/foo.json and it contains:
"include": [ "default" ]
it looks for <root>/foo/rom-kana/default.json.
If the current map file is <root>/foo/rom-kana/bar.json and it contains:
"include": [ "default/default" ]
it looks for <root>/default/rom-kana/default.json.
** Format of keymap rule files
The map name "keymap" is used to associate a key event to a command name.
Example:
{
"include": [
"default"
],
"define": {
"keymap": {
"Q": null,
"C-@": "start-preedit"
}
}
}
This map file includes "default" map file first, replace mapping of
"start-preedit" from "Q" to "C-@" (control + "@").
The current available commands are:
abbrev
abort
abort-to-latin
abort-to-latin-unhandled
commit
commit-unhandled
complete
delete
insert-kana-<kana>
kuten
next-candidate
previous-candidate
set-input-mode-<mode>
special-midasi
start-preedit
start-preedit-kana
start-preedit-no-delete
upper-<lower>
** Format of rom-kana map files
The map name "rom-kana" is used to define romaji-to-kana conversion
tables. The value is an object which maps a string to either an array
or null.
If the value is an array, a new mapping is defined. In that case each
array can contain 2 to 4 elements. The first two elements are
<carryover> and <hiragana>. <carryover> is a string which will be
added to preedit after the transition (for example, when "bb" is
typed, "b" is <carryover> which will be added to the next preedit).
<hiragana> is an output in hiragana. The rest of those elements are
<katakana> and <hankaku-katakana>, which are optional output strings
in katakana and hankaku-katakana input mode (automatically derived
from <hiragana> if they are omitted).
If the value is null, existing mapping of the corresponding key is
removed from the parent map file.
Example:
{
"include": [
"default"
],
"define": {
"rom-kana": {
"xka": [ "", "か", "ヵ", "カ" ],
"b.": [ "", "ぶ" ],
"dha": null
}
}
}
This map file includes "default" map file first, defines new mappings
for "xka" and "b.", and removes a mapping "dha" from the current map
file.
Copyright (C) 2011-2018 Daiki Ueno <ueno@gnu.org>
Copyright (C) 2011-2018 Red Hat, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.