File: README.rules

package info (click to toggle)
libkkc 0.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,928 kB
  • ctags: 15,126
  • sloc: ansic: 76,279; sh: 11,501; makefile: 918; cpp: 435; python: 233
file content (173 lines) | stat: -rw-r--r-- 4,292 bytes parent folder | download | duplicates (5)
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
171
172
173
* Rules overview

libkkc 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/libkkc/rules and
/usr/share/libkkc/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, libkkc 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:

abort
commit
complete
delete
quote
register
insert-kana-<kana>
next-candidate
previous-candidate
purge-candidate
next-segment
previous-segment
expand-segment
shrink-segment
set-input-mode-<mode>

** 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 5 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 optional 3rd element is
<katakana>, which will be an output when input mode is katakana.

The optional 4th element is <hiragana_partial>, which will be an
output when the input is incompletely finished (for example, when "nk"
is typed, "ん" will be output and the next preedit will be "k").

The optional 5th element is <katakana_partial>, katakana version of
<hiragana_partial>.

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-2014 Daiki Ueno <ueno@gnu.org>
Copyright (C) 2011-2014 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.