Module ime
Google Pinyin-like api module.
Functions
register_command (command_name, lua_function_name, description, leading, help) | Register a two character command to be used with fcitx Quickphrase. |
register_trigger (lua_function_name, description, input_trigger_strings, candidate_trigger_strings) | Register a trigger function, to be triggered by input or candidate. |
register_converter (lua_function_name, description) | Register a converter |
get_version () | Return version of fcitx. |
get_last_commit () | Return the string last being committed. |
int_to_hex_string (value[, width=0]) | Convert an integer to hex string. |
join_string (str_list, sep) | Join a string list with separtor. |
parse_mapping (src_string, line_sep, key_value_sep, values_sep) | Parse a string that represents a key-to-multiple-value table. |
split_string (str, sep) | Split the string, empty string will be ignored. |
trim_string (s) | Trim the white space. |
trim_string_left (s) | Trim the white space on the left. |
trim_string_right (s) | Trim the white space on the right. |
utf8_to_utf16 (str) | Helper function to convert UTF16 string to UTF8. |
utf16_to_utf8 (str) | Helper function to convert UTF8 string to UTF16. |
Functions
- register_command (command_name, lua_function_name, description, leading, help)
-
Register a two character command to be used with fcitx Quickphrase.
Parameters:
- command_name Command string, can be only exactly two characters.
- lua_function_name global function name.
- description Description, not used in the implementation.
- leading The candidate selection key, can be either, 'none', 'alpha', 'digit', or omit for digit.
- help Long help information, not used by the implementation.
- register_trigger (lua_function_name, description, input_trigger_strings, candidate_trigger_strings)
-
Register a trigger function, to be triggered by input or candidate.
Parameters:
- lua_function_name global function name.
- description description, not used by the implementation.
- input_trigger_strings A table of string to match input trigger.
- candidate_trigger_strings A table of string ot match candidate.
- register_converter (lua_function_name, description)
-
Register a converter
Parameters:
- lua_function_name global function name.
- description description string, not used by the implementation.
- get_version ()
- Return version of fcitx.
- get_last_commit ()
-
Return the string last being committed.
Returns:
- int_to_hex_string (value[, width=0])
-
Convert an integer to hex string.
Parameters:
- value int
- width int (default 0)
Returns:
-
string
Hex string.
- join_string (str_list, sep)
-
Join a string list with separtor.
Parameters:
- str_list tab A list of string
- sep string A string separtor.
Returns:
-
string
Joined string.
- parse_mapping (src_string, line_sep, key_value_sep, values_sep)
-
Parse a string that represents a key-to-multiple-value table.
Parameters:
- src_string string input string.
- line_sep string Line separator.
- key_value_sep string Separator between key and values.
- values_sep string Separator between different values.
Returns:
- split_string (str, sep)
-
Split the string, empty string will be ignored.
ime.split_string('a,b,c', ',') == {'a', 'b', 'c'}
ime.split_string('a,b,,c', ',') == {'a', 'b', 'c'}
ime.split_string('', ',') == {} ]]
Parameters:
Returns:
-
table
A list of split string.
- trim_string (s)
-
Trim the white space.
Parameters:
- s string
Returns:
- trim_string_left (s)
-
Trim the white space on the left.
Parameters:
- s string
Returns:
- trim_string_right (s)
-
Trim the white space on the right.
Parameters:
- s string
Returns:
- utf8_to_utf16 (str)
-
Helper function to convert UTF16 string to UTF8.
Parameters:
- str string UTF16 string.
Returns:
-
string
UTF8 string or empty string if it fails.
- utf16_to_utf8 (str)
-
Helper function to convert UTF8 string to UTF16.
Parameters:
- str string UTF8 string.
Returns:
-
string
UTF16 string or empty string if it fails.