trigger: allow creation of temporary variables with the regex

v2.8-utf8proc
Sébastien Helleu 2018-08-16 22:47:47 +02:00
parent 1a0087a7d7
commit 9105c3ba1f
8 changed files with 38 additions and 8 deletions

View File

@ -22,6 +22,7 @@ New features::
* core: allow partial buffer name in command /buffer close (issue #1226)
* api: add function hook_line
* trigger: allow creation of temporary variables with the regex
Bug fixes::

View File

@ -3797,7 +3797,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
Reguläre Ausdrücke werden verwendet um Variablen in einem Callback Hashtable zu ändern.
Das Format ist: "/regex/replace" oder "/regex/replace/var" (wobei _var_ eine
Variable eines Hashtable darstellt). +
Variable eines Hashtable darstellt).
// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.
Sollte _var_ nicht näher spezifiziert sein, wird die Standard-Variable genutzt,
welche abhängig von dem genutzten Hook ist:

View File

@ -3711,7 +3711,11 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
The regular expression is used to change variables in callback hashtable.
The format is: "/regex/replace" or "/regex/replace/var" (where _var_ is a
variable of the hashtable). +
variable of the hashtable).
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.
If _var_ is not specified, the default variable is used, it depends on hook
type:

View File

@ -3830,7 +3830,11 @@ L'expression régulière est utilisée pour modifier des variables dans la table
de hachage de la fonction de rappel.
Le format est : "/regex/remplacement" ou "/regex/remplacement/var" (où _var_ est
une variable de la table de hachage). +
une variable de la table de hachage).
Si _var_ n'existe pas dans la table de hachage, elle est automatiquement créée
avec une valeur vide. Cela permet de créer des variables temporaires.
Si _var_ n'est pas spécifiée, la variable par défaut est utilisée, elle dépend
du type de hook :

View File

@ -3971,7 +3971,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
The regular expression is used to change variables in callback hashtable.
The format is: "/regex/replace" or "/regex/replace/var" (where _var_ is a
variable of the hashtable). +
variable of the hashtable).
// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.
If _var_ is not specified, the default variable is used, it depends on hook
type:

View File

@ -3707,7 +3707,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
正規表現はコールバックハッシュテーブル内の変数を変更するために使われます。
書式: "/regex/replace" または "/regex/replace/var" (ここで
_var_ はハッシュテーブルの変数)。 +
_var_ はハッシュテーブルの変数)。
// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.
_var_
が指定されなかった場合、デフォルト変数を使います、これはフックの種類に依存します:

View File

@ -3741,7 +3741,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
Wyrażenia regularne są używane do zmiany zmiennych w tablicy hashy callbacka.
Format: "/wyrażenie/zamień" lub "/wyrażenie/zamień/zmienna" (gdzie _zmienna_ to
zmienna tablicy hashy). +
zmienna tablicy hashy).
// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.
Jeśli _zmienna_ nie zostanie podana, użyta zostanie domyślna zmienna, zależy ona
od typu uchwytu:

View File

@ -277,9 +277,10 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
{
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
"\t regex %d (%s): %s",
i + 1, ptr_key, _("empty variable"));
i + 1, ptr_key, _("creating variable"));
}
continue;
weechat_hashtable_set (extra_vars, ptr_key, "");
ptr_value = weechat_hashtable_get (extra_vars, ptr_key);
}
weechat_hashtable_set (pointers, "regex", trigger->regex[i].regex);