diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/de/weechat_user.de.adoc | 151 | ||||
-rw-r--r-- | doc/en/weechat_user.en.adoc | 131 | ||||
-rw-r--r-- | doc/fr/weechat_user.fr.adoc | 132 | ||||
-rw-r--r-- | doc/it/weechat_user.it.adoc | 127 | ||||
-rw-r--r-- | doc/ja/weechat_user.ja.adoc | 149 | ||||
-rw-r--r-- | doc/pl/weechat_user.pl.adoc | 147 | ||||
-rw-r--r-- | doc/sr/weechat_user.sr.adoc | 139 |
7 files changed, 729 insertions, 247 deletions
diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index f7c86c5cf..305a3dd6e 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -4942,19 +4942,120 @@ zu werden: ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) ---- +// TRANSLATION MISSING [[trigger_regex]] -=== reguläre Ausdrücke +=== Regular expression -Reguläre Ausdrücke werden verwendet um Variablen in einem Callback Hashtable zu ändern. +The regular expression is used to change variables in callback hashtable. -Das Format ist: "/regex/replace" oder "/regex/replace/var" (wobei _var_ eine -Variable eines Hashtable darstellt). +Format is one of the following: -Falls _var_ in der Hashtabelle nicht existieren sollte, wird diese automatisch mit einem -leeren Wert angelegt. Damit kann man temporär benutzerspezifische Variablen erstellen. +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- + +Fields: + +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update + +Many regular expressions can be separated by a space, for example: + +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +// TRANSLATION MISSING +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). + +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). + +Matching groups can be used in _replace_: + +* `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to + `+${re:99}+` are groups captured +* `+${re:+}+`: the last match (with highest number) +* `+${hide:c,${re:N}}+`: match "N" with all chars replaced by "c" + (example: `+${hide:*,${re:2}}+` is the group #2 with all chars replaced by + `+*+`). + +Example: use bold for words between `+*+`: + +---- +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +---- + +Example: default trigger _server_pass_ uses this regular expression to hide +password in commands `/server` and `/connect` (chars in passwords are replaced +by `+*+`): + +---- +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +---- + +[NOTE] +In this example, the delimiter used is "==" because there is a "/" in the +regular expression. + +// TRANSLATION MISSING +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- -Sollte _var_ nicht näher spezifiziert sein, wird die Standard-Variable genutzt, -welche abhängig von dem genutzten Hook ist: +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +// TRANSLATION MISSING +[[trigger_regex_variable]] +==== Variable + +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: [width="100%",cols="2,3,7",options="header"] |=== @@ -4978,40 +5079,6 @@ welche abhängig von dem genutzten Hook ist: haben einen Einfluss auf den Wert der vom Trigger zurückgegeben wird und dann von WeeChat genutzt wird. -Mehrere reguläre Ausdrücke können durch ein Leerzeichen voneinander -getrennt werden, zum Beispiel: -"/regex1/replace1/var1 /regex2/replace2/var2". - -Das Zeichen "/" kann durch jedes andere Zeichen ersetzt werden (ein -oder mehrere identische Zeichen). - -Matching groups können in "replace" genutzt werden: - -* `+${re:0}+` bis `+${re:99}+`: `+${re:0}+` um alles zu matchen, `+${re:1}+` bis - `+${re:99}+` um Gruppen zu fangen -* `+${re:+}+`: der letzte match (mit der höchsten Nummer) -* `+${hide:c,${re:N}}+`: match "N" mit allen Zeichen die durch "c" ersetzt wurden - (Beispiel: `+${hide:*,${re:2}}+` ist die group #2 mit allen Zeichen die durch - `+*+` ersetzt wurden). - -Beispiel: nutzte Fettschrift zwischen dem Zeichen `+*+`: - ----- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ----- - -Beispiel: der Standard-Trigger _server_pass_ nutzt folgenden regulären Ausdruck -um ein Passwort in den Befehlen `/server` und `/connect` zu verbergen (die -einzelnen Zeichen des Passwortes werden durch `+*+` ersetzt): - ----- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ----- - -[NOTE] -In diesem Beispiel wird "==" als Trennzeichen verwendet, da ein "/" in -dem regulären Ausdruck genutzt wird. - [[trigger_command]] === Befehl diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index 10f23bc78..afe02e2fe 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -4660,8 +4660,8 @@ A trigger has the following options (names are <<command_weechat_eval,/eval>>). | regex | string -| One or more POSIX extended regular expressions, to change data received in the - hook callback (and some stuff added by trigger plugin), see +| One or more regex "commands" (similar to the `sed` command) to change data + received in the hook callback (and some stuff added by trigger plugin), see <<trigger_regex,regular expression>>. | command | string @@ -4834,42 +4834,47 @@ ${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). +Format is one of the following: -If _var_ does not exist in the hashtable, it is created automatically with an -empty value. This allows to create custom temporary variables. +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- -If _var_ is not specified, the default variable is used, it depends on hook -type: +Fields: -[width="100%",cols="2,3,7",options="header"] -|=== -| Hook | Default variable | Update allowed ^(1)^ -| signal | tg_signal_data | -| hsignal | | -| modifier | tg_string | tg_string -| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message -| print | tg_message | -| command | tg_argv_eol1 | -| command_run | tg_command | -| timer | tg_remaining_calls | -| config | tg_value | -| focus | | -| info | tg_info | tg_info -| info_hashtable | | all variables received in hashtable -|=== - -[NOTE] -^(1)^ All variables can be updated in the trigger, but only these variables -have an effect on the value returned by the trigger and used by WeeChat. +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update Many regular expressions can be separated by a space, for example: -"/regex1/replace1/var1 /regex2/replace2/var2". -The char "/" can be replaced by any char (one or more identical chars). +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). -Matching groups can be used in "replace": +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). + +Matching groups can be used in _replace_: * `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to `+${re:99}+` are groups captured @@ -4881,7 +4886,7 @@ Matching groups can be used in "replace": Example: use bold for words between `+*+`: ---- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ---- Example: default trigger _server_pass_ uses this regular expression to hide @@ -4889,13 +4894,73 @@ password in commands `/server` and `/connect` (chars in passwords are replaced by `+*+`): ---- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ---- [NOTE] In this example, the delimiter used is "==" because there is a "/" in the regular expression. +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- + +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +[[trigger_regex_variable]] +==== Variable + +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: + +[width="100%",cols="2,3,7",options="header"] +|=== +| Hook | Default variable | Update allowed ^(1)^ +| signal | tg_signal_data | +| hsignal | | +| modifier | tg_string | tg_string +| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message +| print | tg_message | +| command | tg_argv_eol1 | +| command_run | tg_command | +| timer | tg_remaining_calls | +| config | tg_value | +| focus | | +| info | tg_info | tg_info +| info_hashtable | | all variables received in hashtable +|=== + +[NOTE] +^(1)^ All variables can be updated in the trigger, but only these variables +have an effect on the value returned by the trigger and used by WeeChat. + [[trigger_command]] === Command diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index 6085d37d9..5f0198506 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -4989,44 +4989,48 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) 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). +Le format est l'un des suivants : -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. +---- +/chaîne1/chaîne2 +s/chaîne1/chaîne2 +s/chaîne1/chaîne2/var +y/chaîne1/chaîne2 +y/chaîne1/chaîne2/var +---- -Si _var_ n'est pas spécifiée, la variable par défaut est utilisée, elle dépend -du type de hook : +Champs : -[width="100%",cols="2,3,7",options="header"] -|=== -| Hook | Variable par défaut | Mise à jour autorisée ^(1)^ -| signal | tg_signal_data | -| hsignal | | -| modifier | tg_string | tg_string -| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message -| print | tg_message | -| command | tg_argv_eol1 | -| command_run | tg_command | -| timer | tg_remaining_calls | -| config | tg_value | -| focus | | -| info | tg_info | tg_info -| info_hashtable | | toutes les variables reçues dans la table de hachage -|=== +* `s` ou `y` : une lettre avec la commande ; si manquante, la commande par défaut + est `s` et le premier caractère est alors utilisé comme délimiteur : +** `s` : remplacement par expression régulière : la première chaîne est l'expression + régulière, la seconde chaîne est le remplacement pour chaque chaîne trouvée +** `y` : traduction de caractères : la première chaîne est un ensemble de caractères + qui sont remplacés par les caractères de la seconde chaîne ; une fois évaluée, + chaque chaîne doit contenir exactement le même nombre de caractères UTF-8 +* `/` : le délimiteur d'expression régulière ; le caractère "/" peut être remplacé + par n'importe quel caractère (un ou plusieurs caractères identiques) +* `chaîne1` : la première chaîne (l'utilisation dépend de la commande) +* `chaîne2` : la seconde chaîne (l'utilisation dépend de la commande) +* `var` : la table de hachage avec la variable à mettre à jour -[NOTE] -^(1)^ Toutes les variables peuvent être mises à jour dans le trigger, mais -seulement ces variables ont un effet sur la valeur retournée par le trigger -et utilisée par WeeChat. +Plusieurs expressions régulières peuvent être séparées par un espace, par exemple : + +---- +s/regex1/remplacement1/var1 y/abcdef/ABDDEF/var2 +---- + +[[trigger_regex_replace]] +==== Regex replace -Plusieurs expressions régulières peuvent être séparées par un espace, par -exemple : "/regex1/remplacement1/var1 /regex2/remplacement2/var2". +Pour la commande `s`, le format est : `s/regex/remplacement` ou +`s/regex/remplacement/var` (où _var_ est une variable de la table de hachage). -Le caractère "/" peut être remplacé par tout caractère (un ou plusieurs -caractères identiques). +Comme `s` est la commande par défaut, elle peut être omise, donc `/regex/replace` +est également valide (mais le premier caractère, qui est le délimiteur, ne doit +pas être une lettre). -Les groupes de correspondance peuvent être utilisés dans le "remplacement" : +Les groupes de correspondance peuvent être utilisés dans le _remplacement_ : * `+${re:0}+` à `+${re:99}+` : `+${re:0}+` est la correspondance complète, `+${re:1}+` à `+${re:99}+` sont les groupes capturés @@ -5038,7 +5042,7 @@ Les groupes de correspondance peuvent être utilisés dans le "remplacement" : Exemple : utiliser du gras pour les mots entre `+*+` : ---- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ---- Exemple : le trigger par défaut _server_pass_ utilise cette expression régulière @@ -5046,13 +5050,75 @@ pour cacher le mot de passe dans les commandes `/server` et `/connect` (les caractères des mots de passe sont remplacés par `+*+`) : ---- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ---- [NOTE] Dans cet exemple, le séparateur utilisé est "==" car il y a "/" dans l'expression régulière. +[[trigger_regex_translate_chars]] +==== Translate chars + +Pour la commande `y`, le format est : `y/caractères1/caractères2` ou +`y/caractères1/caractères2/var` (où _var_ est une variable de la table de hachage). + +Exemple : remplacer "a", "b" et "c" par la lettre en majuscules : + +---- +y/abc/ABC/ +---- + +Exemple : faire tourner une flèche dans le sens horaire : + +---- +y/←↑→↓/↑→↓←/ +---- + +Exemple : convertir toutes les lettres en minuscules : + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Exemple : décaler toutes les lettres d'une position, en préservant la casse : +a→b, b→c … y→z, z→a : + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +[[trigger_regex_variable]] +==== Variable + +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 : + +[width="100%",cols="2,3,7",options="header"] +|=== +| Hook | Variable par défaut | Mise à jour autorisée ^(1)^ +| signal | tg_signal_data | +| hsignal | | +| modifier | tg_string | tg_string +| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message +| print | tg_message | +| command | tg_argv_eol1 | +| command_run | tg_command | +| timer | tg_remaining_calls | +| config | tg_value | +| focus | | +| info | tg_info | tg_info +| info_hashtable | | toutes les variables reçues dans la table de hachage +|=== + +[NOTE] +^(1)^ Toutes les variables peuvent être mises à jour dans le trigger, mais +seulement ces variables ont un effet sur la valeur retournée par le trigger +et utilisée par WeeChat. + [[trigger_command]] === Commande diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index a0b8d5119..a75a68884 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -5177,42 +5177,47 @@ ${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). +Format is one of the following: -If _var_ does not exist in the hashtable, it is created automatically with an -empty value. This allows to create custom temporary variables. +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- -If _var_ is not specified, the default variable is used, it depends on hook -type: +Fields: -[width="100%",cols="2,3,7",options="header"] -|=== -| Hook | Default variable | Update allowed ^(1)^ -| signal | tg_signal_data | -| hsignal | | -| modifier | tg_string | tg_string -| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message -| print | tg_message | -| command | tg_argv_eol1 | -| command_run | tg_command | -| timer | tg_remaining_calls | -| config | tg_value | -| focus | | -| info | tg_info | tg_info -| info_hashtable | | all variables received in hashtable -|=== - -[NOTE] -^(1)^ All variables can be updated in the trigger, but only these variables -have an effect on the value returned by the trigger and used by WeeChat. +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update Many regular expressions can be separated by a space, for example: -"/regex1/replace1/var1 /regex2/replace2/var2". -The char "/" can be replaced by any char (one or more identical chars). +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). -Matching groups can be used in "replace": +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). + +Matching groups can be used in _replace_: * `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to `+${re:99}+` are groups captured @@ -5224,7 +5229,7 @@ Matching groups can be used in "replace": Example: use bold for words between `+*+`: ---- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ---- Example: default trigger _server_pass_ uses this regular expression to hide @@ -5232,13 +5237,73 @@ password in commands `/server` and `/connect` (chars in passwords are replaced by `+*+`): ---- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ---- [NOTE] In this example, the delimiter used is "==" because there is a "/" in the regular expression. +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- + +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +[[trigger_regex_variable]] +==== Variable + +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: + +[width="100%",cols="2,3,7",options="header"] +|=== +| Hook | Default variable | Update allowed ^(1)^ +| signal | tg_signal_data | +| hsignal | | +| modifier | tg_string | tg_string +| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message +| print | tg_message | +| command | tg_argv_eol1 | +| command_run | tg_command | +| timer | tg_remaining_calls | +| config | tg_value | +| focus | | +| info | tg_info | tg_info +| info_hashtable | | all variables received in hashtable +|=== + +[NOTE] +^(1)^ All variables can be updated in the trigger, but only these variables +have an effect on the value returned by the trigger and used by WeeChat. + [[trigger_command]] === Command diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index 5494fcc2f..8bd7a5a6c 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -4985,19 +4985,120 @@ trigger.trigger.beep.post_action = none ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) ---- +// TRANSLATION MISSING [[trigger_regex]] -=== 正規表現 +=== Regular expression + +The regular expression is used to change variables in callback hashtable. + +Format is one of the following: + +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- + +Fields: + +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update + +Many regular expressions can be separated by a space, for example: + +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +// TRANSLATION MISSING +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). + +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). -正規表現はコールバックハッシュテーブル内の変数を変更するために使われます。 +Matching groups can be used in _replace_: -書式: "/regex/replace" または "/regex/replace/var" (ここで -_var_ はハッシュテーブルの変数)。 +* `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to + `+${re:99}+` are groups captured +* `+${re:+}+`: the last match (with highest number) +* `+${hide:c,${re:N}}+`: match "N" with all chars replaced by "c" + (example: `+${hide:*,${re:2}}+` is the group #2 with all chars replaced by + `+*+`). -ハッシュテーブル内に _var_ が存在しない場合、空の値を持つ _var_ -が自動的に作られます。これを使うことで一時的な任意の変数を作れます。 +Example: use bold for words between `+*+`: -_var_ -が指定されなかった場合、デフォルト変数を使います、これはフックの種類に依存します: +---- +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +---- + +Example: default trigger _server_pass_ uses this regular expression to hide +password in commands `/server` and `/connect` (chars in passwords are replaced +by `+*+`): + +---- +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +---- + +[NOTE] +In this example, the delimiter used is "==" because there is a "/" in the +regular expression. + +// TRANSLATION MISSING +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- + +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +// TRANSLATION MISSING +[[trigger_regex_variable]] +==== Variable + +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: [width="100%",cols="2,3,7",options="header"] |=== @@ -5020,38 +5121,6 @@ _var_ ^(1)^ トリガはすべての値を更新できますが、ここで挙げた変数だけがトリガによって返されて WeeChat によって使われる値に影響を及ぼします -複数の正規表現を使う場合は空白で区切ってください、例: -"/regex1/replace1/var1 /regex2/replace2/var2"。 - -文字 "/" を任意の文字 (1 つ以上の同じ文字) に変えることができます。 - -マッチグループを "replace" の中で利用できます: - -* `+${re:0}+` から `+${re:99}+`: `+${re:0}+` はマッチ部分の全体、`+${re:1}+` から - `+${re:99}+` はグループ化されたマッチ部分 -* `+${re:+}+`: 最後のマッチ部分 (最大のグループ番号を持つ) -* `+${hide:c,${re:N}}+`: マッチグループ "N" のすべての文字を "c" で置換した文字列 - (例: `+${hide:*,${re:2}}+` はグループ #2 のすべての文字を `+*+` - で置換した文字列)。 - -例: `+*+` で囲まれた文字を太字にする: - ----- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ----- - -例: デフォルトトリガ _server_pass_ はこの正規表現を使って、`/server` -と `/connect` コマンドのパスワードを隠しています (パスワード部分の文字を -`*` で置換しています): - ----- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ----- - -[NOTE] -この例では、区切り文字として "==" を使っています。これは正規表現内で -"/" を使うためです。 - [[trigger_command]] === コマンド diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index 9abb6e6f6..b7c4899e1 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -4904,19 +4904,120 @@ w przypadku podświetlenia lub otrzymania prywatnej wiadomości: ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) ---- +// TRANSLATION MISSING [[trigger_regex]] -=== Wyrażenia regularne +=== Regular expression + +The regular expression is used to change variables in callback hashtable. + +Format is one of the following: + +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- + +Fields: + +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update + +Many regular expressions can be separated by a space, for example: + +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +// TRANSLATION MISSING +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). + +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). -Wyrażenia regularne są używane do zmiany zmiennych w tablicy hashy callbacka. +Matching groups can be used in _replace_: -Format: "/wyrażenie/zamień" lub "/wyrażenie/zamień/zmienna" (gdzie _zmienna_ to -zmienna tablicy hashy). +* `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to + `+${re:99}+` are groups captured +* `+${re:+}+`: the last match (with highest number) +* `+${hide:c,${re:N}}+`: match "N" with all chars replaced by "c" + (example: `+${hide:*,${re:2}}+` is the group #2 with all chars replaced by + `+*+`). -Jeśli _zmienna_ nie istnieje w tablicy haszy zostanie automarycznie utworzona bez -wartości. Pozwala to tworzyć dowolne zmienne tymczasowe. +Example: use bold for words between `+*+`: -Jeśli _zmienna_ nie zostanie podana, użyta zostanie domyślna zmienna, zależy ona -od typu uchwytu: +---- +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +---- + +Example: default trigger _server_pass_ uses this regular expression to hide +password in commands `/server` and `/connect` (chars in passwords are replaced +by `+*+`): + +---- +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +---- + +[NOTE] +In this example, the delimiter used is "==" because there is a "/" in the +regular expression. + +// TRANSLATION MISSING +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- + +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +// TRANSLATION MISSING +[[trigger_regex_variable]] +==== Variable + +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: [width="100%",cols="2,3,7",options="header"] |=== @@ -4939,36 +5040,6 @@ od typu uchwytu: ^(1)^ Wszystkie zmienne mogą zostać zaktualizowane, jednak tylko te zmienne mają wpływ na zmienne zwrócone i użyte przez WeeChat. -Wiele wyrażeń może być oddzielonych spacją, na przykład: -"/regex1/zamień1/zmienna1 /regex2/zamień2/zmienna2". - -Znak "/" może zostać zastąpiony dowolnym znakiem (jednym lub kilkoma -identycznymi znakami). - -Dopasowane grupy, które mogą zostać użyte w "zamień": - -* `+${re:0}+` to `+${re:99}+`: `+${re:0}+` to pełne dopasowanie, `+${re:1}+` do - `+${re:99}+` to przechwycone grupy -* `+${re:+}+`: ostatnie dopasowanie (z najwyższym numerem) -* `+${hide:c,${re:N}}+`: dopasowanie "N" z wszystkimi znakami zastąpionymi "c" - (przykład: `+${hide:*,${re:2}}+` to grupa #2 ze znakami zastąpionymi `+*+`). - -Przykład: użyj pogrubienia dla słów pomiędzy `+*+`: - ----- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ----- - -Przykład: domyślny trigger _server_pass_ używa tego wyrażenia do ukrycia hasła -w komendach `/server` i `/connect` (znaki haseł są zastępowane przez `+*+`): - ----- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ----- - -[NOTE] -W tym przykładzie, użyty jest separator "==" ponieważ w wyrażeniu występuje "/". - [[trigger_command]] === Komenda diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc index 0e72af7a5..4f2c8c72e 100644 --- a/doc/sr/weechat_user.sr.adoc +++ b/doc/sr/weechat_user.sr.adoc @@ -4559,16 +4559,120 @@ link:weechat_plugin_api.sr.html#_hook_info[hook_info ^↗^,window=_blank] ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) ---- +// TRANSLATION MISSING [[trigger_regex]] -=== Регуларни израз +=== Regular expression + +The regular expression is used to change variables in callback hashtable. + +Format is one of the following: + +---- +/string1/string2 +s/string1/string2 +s/string1/string2/var +y/string1/string2 +y/string1/string2/var +---- + +Fields: + +* `s` or `y`: a letter with the command; if missing, default command is `s` + and the first char is then used as the delimiter: +** `s`: regex replacement: first string is a regular expression, second string + is the replacement for every matching string +** `y`: chars translation: first string is a set of characters that are replaced + by the characters in the second string; once evaluated, each string must have + exactly the same number of UTF-8 chars +* `/`: the regex delimiter; the char "/" can be replaced by any char + (one or more identical chars) +* `string1`: the first string (use depends on the command) +* `string2`: the second string (use depends on the command) +* `var`: the hashtable variable to update + +Many regular expressions can be separated by a space, for example: + +---- +s/regex1/replace1/var1 y/abcdef/ABDDEF/var2 +---- + +// TRANSLATION MISSING +[[trigger_regex_replace]] +==== Regex replace + +For the command `s`, the format is: `s/regex/replace` or `s/regex/replace/var` +(where _var_ is a variable of the hashtable). + +As `s` is the default command, it can be omitted, so `/regex/replace` is also +valid (but the first char, which is the delimiter, must not be a letter). -Регуларни израз се користи за измену променљивих у хеш табели функције повратног позива. +Matching groups can be used in _replace_: -Формат је следећи: „/регизраз/замена” или „/регизраз/замена/пром” (где је _пром_ променљива хеш табеле). +* `+${re:0}+` to `+${re:99}+`: `+${re:0}+` is the whole match, `+${re:1}+` to + `+${re:99}+` are groups captured +* `+${re:+}+`: the last match (with highest number) +* `+${hide:c,${re:N}}+`: match "N" with all chars replaced by "c" + (example: `+${hide:*,${re:2}}+` is the group #2 with all chars replaced by + `+*+`). -Ако _пром_ не постоји у хеш табели, она се аутоматски креира и има празну вредност. На овај начин могу да се креирају произвољне привремене променљиве. +Example: use bold for words between `+*+`: -Ако се _пром_ не наведе, користи се подразумевана променљива која зависи од типа употребљене куке: +---- +s/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ +---- + +Example: default trigger _server_pass_ uses this regular expression to hide +password in commands `/server` and `/connect` (chars in passwords are replaced +by `+*+`): + +---- +s==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} +---- + +[NOTE] +In this example, the delimiter used is "==" because there is a "/" in the +regular expression. + +// TRANSLATION MISSING +[[trigger_regex_translate_chars]] +==== Translate chars + +For the command `y`, the format is: `y/chars1/chars2` or `y/chars1/chars2/var` +(where _var_ is a variable of the hashtable). + +Example: replace "a", "b" and "c" by upper case letter: + +---- +y/abc/ABC/ +---- + +Example: rotate arrows clockwise: + +---- +y/←↑→↓/↑→↓←/ +---- + +Example: convert all letters to lower case: + +---- +y/${chars:upper}/${chars:lower}/ +---- + +Example: shift each letter by one position, preserving case: a→b, b→c … y→z, z→a: + +---- +y/${chars:a-z}${chars:A-Z}/${chars:b-z}a${chars:B-Z}A/ +---- + +// TRANSLATION MISSING +[[trigger_regex_variable]] +==== Variable + +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: [width="100%", cols="2,3,7", options="header"] |=== @@ -4590,31 +4694,6 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) [NOTE] ^(1)^ У окидачу је могуће ажурирање свих променљивих, али само ове променљиве утичу на вредност коју враћа окидач и коју користи програм WeeChat. -Више регуларних израза може да се раздвоји размаком, на пример: /регизраз1/замена1/пром1 /регизраз2/замена2/пром2". - -Карактер „/” може да се замени било којим карактером (један или више идентичних карактера). - -У „замена” могу да се користе групе подударања: - -* `+${re:0}+` до `+${re:99}+`: `+${re:0}+` је комплетно подударање, `+${re:1}+` до `+${re:99}+` су ухваћене групе -* `+${re:+}+`: последње подударање (са највишим бројем) -* `+${hide:c,${re:N}}+`: подударање „N” са свим карактерима се замењује са „c” (пример: `+${hide:*,${re:2}}+` је група #2 у којој су сви карактери замењени са `+*+`). - -Пример: користи подебљан текст за речи уоквирене са `+*+`: - ----- -/\*([^ ]+)\*/*${color:bold}${re:1}${color:-bold}*/ ----- - -Пример: подразумевани окидач _server_pass_ користи следећи регуларни израз да сакрије лозинке у командама `/server` и `/connect` (карактери у лозинкама се замењују са `+*+`): - ----- -==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5} ----- - -[NOTE] -У овом примеру се користи „==” као граничник јер у регуларном изразу постоји „/”. - [[trigger_command]] === Команда |