International Input - Config File Format

© 2003 by Dominique Unruh. GPL

Overview
Command reference
Command =AUTOLOAD
Command =DESCRIPTION
Command =GROUP
Command =JAVAREPLACE
Command =NAME
Command =REPLACE
Command =REPLACE-NL
Command =SWITCH
Command =WEBPAGE
Example file

Overview

In the International Input applet/application, each input method is internally represented as a group of replacements, together with some group properties, like a name. Any number of these groups can be activated, the first replacement found in any active group is used to replace the temporary input (longer replacements take precedence, but if two replacements are of the same length, it is unspecified, which one will be used).

There is a global config file config.inp, which is loaded at start and which can be used to add declare groups and the locations for autoloading them, and to declare keyboard sequences (replacements) for activating/deactivating those groups.

There is one group of special meaning, default. It should never be deactivated, and contains the global key sequences (for activating/deactivating the other groups).

A config file must be UTF-8 encoded. The first line of a config file must begin with #!/bin/sh international-input-config, otherwise the config file is not recognised as a valid config file.

Afterward a series of commands, comments or empty lines may follow. A comment is a line beginning with # (no whitespaces may precede), an empty line is really empty, not even whitespace is allowed.

Commands begin with a line containing the command name (something like =REPLACE), and a number of command specific lines, the arguments.

Config files to be included in the distribution should follow the following conventions:

Config files to be uploaded by the user are freed of these conventions (the activation/deactivation sequence should however also be of the form @XXX+ resp. @XXX-).

Command reference

Command =AUTOLOAD

This command declares a location where to load a given group. It takes to arguments: Then, if the group is activated for the first time, or its
description is accessed, the config file at the given location is loaded (unless this has already been done.)

This command does not make sense when supplying autoload for a group information inside its own config file, the results of such a behaviour are unspecified.

The current group is ignored by this command.

Example:

=AUTOLOAD
abbrev
example.inp
To be placed in some other config file (e.g. the global one, config.inp).

Command =DESCRIPTION

This command adds a description to the
current group. This should be a fragment of valid HTML code (without the surrounding <HTML>, <HEAD> and <BODY> tags).

The fragment may be several line long, it starts after the line containing =DESCRIPTION and is ended by a line containing only ### (which is not part of the description).

When displaying the description, a title, a link to the config file, and an autogenerated table with all replacements is appended.

Example:

=DESCRIPTION
An example input method. Look at the source and be wiser.<p>&copy;
Dominique Unruh, 2003, <a href=http://www.fsf.org/licenses/gpl.html
target=copy>GPL</a>
###

Command =GROUP

This command is followed by two lines, the name of the group and the initial state. This group is then newly created if it was never references before, and it is set to be the current group for the following config commands (i.e. some commands apply to some implicitly given group, that's this one).

The second argument may be on, off, or hidden. This sets whether the group is set to be active or inactive. In almost all cases it should be on.

If the second argument is hidden, the group is activated but hidden from the user. It will e.g. not appear in menus, not affect the “Document current” button etc.

Using this command with an argument other than hidden will also create an F-key button for that encoding.

Example:

=GROUP
abbrev
on

Command =JAVAREPLACE

This command allows to use plug-ins written in Java for input replacements.

It is followed by at least two lines:

After that, more data may follow, format and amount depending on the plug-in. Plug-ins contributed with this applet are:

Example:

=JAVAREPLACE
configs/
ExampleReplacement
a
This loads the ExampleReplacement plug-in from configs/ExampleReplacement.class, and creates an instance with parameter a.

Command =NAME

This command provides a group with some visual name. This name is e.g. used in menus etc. It does not affect the internally used group name.

It is followed by two line, first the group's internal name, then the visual name.

The visual name may contain any Unicode characters you trust Java/Swing to display inside a menu using the default font.

The current group is ignored by this command.

If we include this file in the distribution, the name should be set inside the global config file config.inp.

The visual name should be set before the first activation or deactivation of the group, otherwise the F-key buttons will not use that name.

Example:

=NAME
abbrev
Abbreviations (Сокращения)

Command =REPLACE

The command =REPLACE is followed by two lines, the first containing a string to be matched and the second a replacement string. The replacement is added to the
current group.

Example:

=REPLACE
TANSTAAFL
There ain't no such thing as a free lunch
will allow to type There ain't no such thing as a free lunch by entering TANSTAAFL.

Command =REPLACE-NL

The command
=REPLACE does not allow to have a newline inside matching string or replacement string. Therefore the command =REPLACE-NL has been added to support this. It takes three lines as arguments:

=REPLACE-NL then behaves as =REPLACE would have done, with the exception, that every occurrence of the newline char in the two strings is replaced by a newline

Example:

=REPLACE-NL
!!
!:)!
!
will replace <ENTER><ENTER> by <ENTER>:)<ENTER>.

Command =SWITCH

=SWITCH takes three lines as arguments Then a replacement is added to the
current group, which upon matching the string STR, will replace it by an empty string, and activate/deactivate the target group TG. Whether TG is activated or deactivated, depends on ST, which may be on or off. Example:
=SWITCH
@abr+
abbrev
on
=SWITCH
@abr-
abbrev
off
This allows to activate/deactivate the group abbrev using @abr+ and @abr-. When executing this code fragment, the current group should be default, either by switching temporarily to it (using =GROUP), or, better, by placing the code into the global config file.

Command =WEBPAGE

The =WEBPAGE command is followed by the following data: Possible options are: Example:
=WEBPAGE
Acronym Finder
http://www.acronymfinder.com/af-query.asp?String=TYPE&Acronym=@@@
:SHORTNAME
Acronyms
:TOPFRAME
:TOKEN
@@@
:CHARSET
iso-8859-1
:TOKEN
TYPE
:CONST
exact
###
This creates an item in the “Web page” menu named “Acronym Finder”, which looks the current selection up in the Acronym Finder database. The use of the TYPE token is unnecessary and done only for illustration.