core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (closes #1582)

This commit is contained in:
Sébastien Helleu 2020-11-14 09:28:46 +01:00
parent eb90a73fe8
commit b626df72fb
27 changed files with 574 additions and 468 deletions

View File

@ -18,6 +18,10 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
[[v3.1]]
== Version 3.1 (under dev)
New features::
* core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (issue #1582)
Bug fixes::
* spell: fix refresh of bar item "spell_suggest" when the input becomes empty (issue #1586)

View File

@ -1298,76 +1298,78 @@ infolists: zeigt Information über die Infolists an
/eval [-n|-s] [-d] <expression>
[-n] [-d] -c <expression1> <operator> <expression2>
-n: gibt das Ergebnis aus, ohne dass dieses in den Buffer gesendet wird (debug Modus)
-s: teilt Ausdrücke, bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden)
-d: eine Debug-Ausgabe nach Auswertung anzeigen
-c: Auswertung als Bedingung: nutzt Operatoren und runde Klammern, Rückgabewert als Boolean-Wert ("0" oder "1")
expression: Ausdruck welcher verarbeitet werden soll. Variablen im Format ${variable} werden ersetzt (siehe unten); mehrere Befehle werden durch ein Semikolon voneinander getrennt
operator: ein logischer oder vergleichender Operand:
- logische Operanden:
&& boolean "und"
|| boolean "oder"
- vergleichende Operanden:
== gleich
!= ungleich
<= kleiner oder gleich
< kleiner
>= größer oder gleich
> größer
=~ stimmt mit regulärem POSIX Ausdruck überein
!~ stimmt NICHT mit regulärem POSIX Ausdruck überein
==* stimmt mit Maske überein (Platzhalter "*" ist erlaubt)
!!* stimmt mit Maske NICHT überein (Platzhalter "*" ist erlaubt)
=* stimmt mit Maske überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
!* stimmt mit Maske NICHT überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
==- ist enthalten, Groß- und Kleinschreibung wird beachtet
!!- ist NICHT enthalten, Groß- und Kleinschreibung wird beachtet
=- ist enthalten, Groß- und Kleinschreibung wird nicht beachtet
!- ist NICHT enthalten, Groß- und Kleinschreibung wird nicht beachtet
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-d: display debug output after evaluation
-c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1")
expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons
operator: a logical or comparison operator:
- logical operators:
&& boolean "and"
|| boolean "or"
- comparison operators:
== equal
!= not equal
<= less or equal
< less
>= greater or equal
> greater
=~ is matching POSIX extended regex
!~ is NOT matching POSIX extended regex
==* is matching mask, case sensitive (wildcard "*" is allowed)
!!* is NOT matching mask, case sensitive (wildcard "*" is allowed)
=* is matching mask, case insensitive (wildcard "*" is allowed)
!* is NOT matching mask, case insensitive (wildcard "*" is allowed)
==- is included, case sensitive
!!- is NOT included, case sensitive
=- is included, case insensitive
!- is NOT included, case insensitive
Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, nicht leer und von "0" abweichend ist.
Für einen Vergleich werden Fließkommazahlen genutzt, insofern es sich bei beiden Ausdrücken um gültige Zahlen handelt, folgende Formate werden unterstützt:
- Integer (Beispiele: 5, -7)
- Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2)
- hexadezimale Zahl (Beispiele: 0xA3, -0xA3)
Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel:
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
- integer (examples: 5, -7)
- floating point number (examples: 5.2, -7.5, 2.83e-2)
- hexadecimal number (examples: 0xA3, -0xA3)
To force a string comparison, you can add double quotes around each expression, for example:
50 > 100 ==> 0
"50" > "100" ==> 1
Einige Variablen werden im Ausdruck mittels der Formatierung ${variable} ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität:
1. eine evaluierte Teilzeichenkette (Format: "eval:xxx")
2. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx")
3. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette")
4. eine Zeichenkette mit einer maximalen Anzahl an Zeichen (Format: "cut:+Max,Suffix,Zeichenkette")
oder maximale Anzahl an Zeichen die auf dem Bildschirm angezeigt werden sollen (Format: "cutscr:Max,Suffix,Zeichenkette oder "cutscr:+Max,Suffix,Zeichenkette")
5. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx")
6. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette")
7. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx")
8. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")
9. ein Modifizierer (Format: "info:Name,Argumente", Argumente sind optional)
10. eine Info (Format: "Info:Name,Argumente", Argumente sind optional)
11. eine Basis 16/32/64 kodierte / dekodierte Zeichenfolge (Format: "base_encode:base,xxx" oder "base_decode:base,xxx")
12. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
13. eine Umgebungsvariable (Format: "env:XXX")
14. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
15. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx")
16. eine Option (Format: "file.section.option")
17. eine lokale Variable eines Buffers
18. ein(e) hdata - Name/Variable (der Wert wird automatisch in eine Zeichenkette konvertiert), standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet.
Das Format für hdata kann wie folgt aufgebaut sein:
hdata.var1.var2...: startet mit hdata (der Pointer muss bekannt sein) und fragt eine Variable nach der anderen ab (weitere hdata können folgen)
hdata[list].var1.var2...: startet hdata mittels einer Liste, zum Beispiel:
${buffer[gui_buffers].full_name}: der vollständige Name des ersten Buffers, in der verknüpften Liste aller Buffer
${plugin[weechat_plugins].name}: Name der ersten Erweiterung, in der verknüpften Liste aller Erweiterungen
hdata[pointer].var1.var2...: startet hdata mittels einem Pointer, zum Beispiel:
${buffer[0x1234abcd].full_name}: vollständiger Name eines Buffers und des dazugehörigen Pointers (kann in triggern benutzt werden)
Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. an evaluated condition (format: "eval_cond:xxx")
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
4. a string with chars to hide (format: "hide:char,string")
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
7. a repeated string (format: "repeat:count,string")
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
10. a modifier (format: "modifier:name,data,string")
11. an info (format: "info:name,arguments", arguments are optional)
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
13. current date/time (format: "date" or "date:format")
14. an environment variable (format: "env:XXX")
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
17. an option (format: "file.section.option")
18. a local variable in buffer
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers
${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Beispiele (einfache Zeichenketten):
Examples (simple strings):
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
/eval -n ${sec.data.freenode_password} ==> geheim
/eval -n ${sec.data.freenode_password} ==> secret
/eval -n ${window} ==> 0x2549aa0
/eval -n ${window.buffer} ==> 0x2549320
/eval -n ${window.buffer.full_name} ==> core.weechat
@ -1385,17 +1387,17 @@ Beispiele (einfache Zeichenketten):
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Beispiele (Bedingungen):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
----
[[command_weechat_filter]]

View File

@ -1336,24 +1336,25 @@ To force a string comparison, you can add double quotes around each expression,
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
2. an evaluated condition (format: "eval_cond:xxx")
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
4. a string with chars to hide (format: "hide:char,string")
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx" or "revscr:xxx")
6. a repeated string (format: "repeat:count,string")
7. length of a string (format: "length:xxx" or "lengthscr:xxx")
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
7. a repeated string (format: "repeat:count,string")
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
10. a modifier (format: "modifier:name,data,string")
11. an info (format: "info:name,arguments", arguments are optional)
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
13. current date/time (format: "date" or "date:format")
14. an environment variable (format: "env:XXX")
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
17. an option (format: "file.section.option")
18. a local variable in buffer
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@ -1364,6 +1365,7 @@ Format for hdata can be one of following:
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Examples (simple strings):
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3

View File

@ -2198,7 +2198,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7 and 2.9._
2.2, 2.3, 2.7, 2.9 and 3.1._
Evaluate an expression and return result as a string.
Special variables with format `+${variable}+` are expanded (see table below).
@ -2521,6 +2521,12 @@ expanded to last):
`+19:02:45+` (with colors if there are color codes in the option
weechat.look.buffer_time_format)
| `+${eval_cond:xxx}+` +
_(WeeChat ≥ 3.1)_ |
String to evaluate as condition. |
`+${eval_cond:${window.win_width} > 100}+` |
`+1+`
| `+${esc:xxx}+` +
`+${\xxx}+` +
_(WeeChat ≥ 1.0)_ |

View File

@ -1336,24 +1336,25 @@ Pour forcer une comparaison de chaînes, vous pouvez ajouter des guillemets auto
Des variables sont remplacées dans l'expression, en utilisant le format ${variable}, la variable pouvant être, par ordre de priorité :
1. une sous-chaîne évaluée (format : "eval:xxx")
2. une chaîne avec les caractères échappés (format : "esc:xxx" ou "\xxx")
3. une chaîne avec des caractères à cacher (format : "hide:caractère,chaîne")
4. une chaîne avec un maximum de caractères (format : "cut:max,suffixe,chaîne" ou "cut:+max,suffixe,chaîne")
2. une condition évaluée (format : "eval_cond:xxx")
3. une chaîne avec les caractères échappés (format : "esc:xxx" ou "\xxx")
4. une chaîne avec des caractères à cacher (format : "hide:caractère,chaîne")
5. une chaîne avec un maximum de caractères (format : "cut:max,suffixe,chaîne" ou "cut:+max,suffixe,chaîne")
ou un maximum de caractères affichés à l'écran (format : "cutscr:max,suffixe,chaîne" ou "cutscr:+max,suffixe,chaîne")
5. une chaîne inversée (format : "rev:xxx" ou "revscr:xxx")
6. une chaîne répétée (format : "repeat:nombre,chaîne")
7. longueur d'une chaîne (format : "length:xxx" ou "lengthscr:xxx")
8. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
9. un modificateur (format : "modifier:nom,données,chaîne")
10. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
11. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "base_encode:base,xxx" ou "base_decode:base,xxx")
12. la date/heure courante (format : "date" ou "date:format")
13. une variable d'environnement (format : "env:XXX")
14. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
15. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx")
16. une option (format : "fichier.section.option")
17. une variable locale du tampon
18. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants.
6. une chaîne inversée (format : "rev:xxx" ou "revscr:xxx")
7. une chaîne répétée (format : "repeat:nombre,chaîne")
8. longueur d'une chaîne (format : "length:xxx" ou "lengthscr:xxx")
9. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
10. un modificateur (format : "modifier:nom,données,chaîne")
11. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
12. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "base_encode:base,xxx" ou "base_decode:base,xxx")
13. la date/heure courante (format : "date" ou "date:format")
14. une variable d'environnement (format : "env:XXX")
15. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
16. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx")
17. une option (format : "fichier.section.option")
18. une variable locale du tampon
19. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants.
Le format du hdata peut être le suivant :
hdata.var1.var2... : démarrer avec un hdata (le pointeur doit être connu), et demander les variables l'une après l'autre (d'autres hdata peuvent être suivis)
hdata[liste].var1.var2... : démarrer avec un hdata en utilisant une liste, par exemple :
@ -1364,6 +1365,7 @@ Le format du hdata peut être le suivant :
Pour le nom du hdata et des variables, voir la "Référence API extension", fonction "weechat_hdata_get".
Exemples (chaînes simples) :
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3

View File

@ -2235,7 +2235,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression
_WeeChat ≥ 0.4.0, mis à jour dans la 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8,
2.0, 2.2, 2.3, 2.7 et 2.9._
2.0, 2.2, 2.3, 2.7, 2.9 et 3.1._
Évaluer l'expression et retourner le résultat sous forme de chaîne.
Les variables spéciales avec le format `+${variable}+` sont étendues (voir le
@ -2564,6 +2564,12 @@ première étendue à la dernière) :
`+19:02:45+` (avec des couleurs s'il y a des codes couleur dans l'option
weechat.look.buffer_time_format)
| `+${eval_cond:xxx}+` +
_(WeeChat ≥ 3.1)_ |
Chaîne à évaluer comme condition. |
`+${eval_cond:${window.win_width} > 100}+` |
`+1+`
| `+${esc:xxx}+` +
`+${\xxx}+` +
_(WeeChat ≥ 1.0)_ |

View File

@ -1336,24 +1336,25 @@ To force a string comparison, you can add double quotes around each expression,
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
2. an evaluated condition (format: "eval_cond:xxx")
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
4. a string with chars to hide (format: "hide:char,string")
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx" or "revscr:xxx")
6. a repeated string (format: "repeat:count,string")
7. length of a string (format: "length:xxx" or "lengthscr:xxx")
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
7. a repeated string (format: "repeat:count,string")
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
10. a modifier (format: "modifier:name,data,string")
11. an info (format: "info:name,arguments", arguments are optional)
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
13. current date/time (format: "date" or "date:format")
14. an environment variable (format: "env:XXX")
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
17. an option (format: "file.section.option")
18. a local variable in buffer
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@ -1364,6 +1365,7 @@ Format for hdata can be one of following:
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Examples (simple strings):
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3

View File

@ -2294,7 +2294,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
// TRANSLATION MISSING
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7 and 2.9._
2.2, 2.3, 2.7, 2.9 and 3.1._
// TRANSLATION MISSING
Evaluate an expression and return result as a string.
@ -2631,6 +2631,12 @@ expanded to last):
`+19:02:45+` (with colors if there are color codes in the option
weechat.look.buffer_time_format)
| `+${eval_cond:xxx}+` +
_(WeeChat ≥ 3.1)_ |
String to evaluate as condition. |
`+${eval_cond:${window.win_width} > 100}+` |
`+1+`
| `+${esc:xxx}+` +
`+${\xxx}+` +
_(WeeChat ≥ 1.0)_ |

View File

@ -1336,24 +1336,25 @@ To force a string comparison, you can add double quotes around each expression,
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
2. an evaluated condition (format: "eval_cond:xxx")
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
4. a string with chars to hide (format: "hide:char,string")
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx" or "revscr:xxx")
6. a repeated string (format: "repeat:count,string")
7. length of a string (format: "length:xxx" or "lengthscr:xxx")
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
7. a repeated string (format: "repeat:count,string")
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
10. a modifier (format: "modifier:name,data,string")
11. an info (format: "info:name,arguments", arguments are optional)
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
13. current date/time (format: "date" or "date:format")
14. an environment variable (format: "env:XXX")
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
17. an option (format: "file.section.option")
18. a local variable in buffer
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@ -1364,6 +1365,7 @@ Format for hdata can be one of following:
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Examples (simple strings):
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3

View File

@ -2214,7 +2214,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
// TRANSLATION MISSING
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0,
2.2, 2.3, 2.7 and 2.9._
2.2, 2.3, 2.7, 2.9 and 3.1._
式を評価して文字列として返す。`+${variable}+`
という書式で書かれた特殊変数は展開されます (以下の表を参照)。
@ -2543,6 +2543,13 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
`+19:02:45+` (オプション weechat.look.buffer_time_format
内に色コードが存在する場合色付き)
// TRANSLATION MISSING
| `+${eval_cond:xxx}+` +
_(WeeChat バージョン 3.1 以上で利用可)_ |
String to evaluate as condition. |
`+${eval_cond:${window.win_width} > 100}+` |
`+1+`
| `+${esc:xxx}+` +
`+${\xxx}+` +
_(WeeChat バージョン 1.0 以上で利用可)_ |

View File

@ -1335,24 +1335,25 @@ To force a string comparison, you can add double quotes around each expression,
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
2. an evaluated condition (format: "eval_cond:xxx")
3. a string with escaped chars (format: "esc:xxx" or "\xxx")
4. a string with chars to hide (format: "hide:char,string")
5. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx" or "revscr:xxx")
6. a repeated string (format: "repeat:count,string")
7. length of a string (format: "length:xxx" or "lengthscr:xxx")
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a reversed string (format: "rev:xxx" or "revscr:xxx")
7. a repeated string (format: "repeat:count,string")
8. length of a string (format: "length:xxx" or "lengthscr:xxx")
9. a color (format: "color:xxx", see "Plugin API reference", function "color")
10. a modifier (format: "modifier:name,data,string")
11. an info (format: "info:name,arguments", arguments are optional)
12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
13. current date/time (format: "date" or "date:format")
14. an environment variable (format: "env:XXX")
15. a ternary operator (format: "if:condition?value_if_true:value_if_false")
16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
17. an option (format: "file.section.option")
18. a local variable in buffer
19. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
Format for hdata can be one of following:
hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed)
hdata[list].var1.var2...: start with a hdata using a list, for example:
@ -1363,6 +1364,7 @@ Format for hdata can be one of following:
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Examples (simple strings):
/eval -n ${eval_cond:${window.win_width}>100} ==> 1
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1591,30 +1591,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1633,6 +1634,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-10-16 16:30+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1682,6 +1682,7 @@ msgstr ""
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
"<expression2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression before evaluating it (many commands can be "
@ -1732,30 +1733,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1774,6 +1776,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1621,30 +1621,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1663,6 +1664,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"PO-Revision-Date: 2020-10-11 16:24+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-11-14 09:22+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -1704,30 +1704,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1746,6 +1747,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"
@ -1830,33 +1832,34 @@ msgstr ""
"Des variables sont remplacées dans l'expression, en utilisant le format "
"${variable}, la variable pouvant être, par ordre de priorité :\n"
" 1. une sous-chaîne évaluée (format : \"eval:xxx\")\n"
" 2. une chaîne avec les caractères échappés (format : \"esc:xxx\" ou \"\\xxx"
" 2. une condition évaluée (format : \"eval_cond:xxx\")\n"
" 3. une chaîne avec les caractères échappés (format : \"esc:xxx\" ou \"\\xxx"
"\")\n"
" 3. une chaîne avec des caractères à cacher (format : \"hide:caractère,"
" 4. une chaîne avec des caractères à cacher (format : \"hide:caractère,"
"chaîne\")\n"
" 4. une chaîne avec un maximum de caractères (format : \"cut:max,suffixe,"
" 5. une chaîne avec un maximum de caractères (format : \"cut:max,suffixe,"
"chaîne\" ou \"cut:+max,suffixe,chaîne\")\n"
" ou un maximum de caractères affichés à l'écran (format : \"cutscr:max,"
"suffixe,chaîne\" ou \"cutscr:+max,suffixe,chaîne\")\n"
" 5. une chaîne inversée (format : \"rev:xxx\" ou \"revscr:xxx\")\n"
" 6. une chaîne répétée (format : \"repeat:nombre,chaîne\")\n"
" 7. longueur d'une chaîne (format : \"length:xxx\" ou \"lengthscr:xxx\")\n"
" 8. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
" 6. une chaîne inversée (format : \"rev:xxx\" ou \"revscr:xxx\")\n"
" 7. une chaîne répétée (format : \"repeat:nombre,chaîne\")\n"
" 8. longueur d'une chaîne (format : \"length:xxx\" ou \"lengthscr:xxx\")\n"
" 9. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
"\", fonction \"color\")\n"
" 9. un modificateur (format : \"modifier:nom,données,chaîne\")\n"
" 10. une info (format : \"info:nom,paramètres\", les paramètres sont "
" 10. un modificateur (format : \"modifier:nom,données,chaîne\")\n"
" 11. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
" 11. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "
" 12. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "
"\"base_encode:base,xxx\" ou \"base_decode:base,xxx\")\n"
" 12. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 13. une variable d'environnement (format : \"env:XXX\")\n"
" 14. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
" 13. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 14. une variable d'environnement (format : \"env:XXX\")\n"
" 15. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
"valeur_si_faux\")\n"
" 15. le résultat d'une expression avec parenthèses et les opérateurs + - "
" 16. le résultat d'une expression avec parenthèses et les opérateurs + - "
"* / // % ** (format: \"calc:xxx\")\n"
" 16. une option (format : \"fichier.section.option\")\n"
" 17. une variable locale du tampon\n"
" 18. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
" 17. une option (format : \"fichier.section.option\")\n"
" 18. une variable locale du tampon\n"
" 19. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
"par défaut \"window\" et \"buffer\" pointent vers la fenêtre et le tampon "
"courants.\n"
"Le format du hdata peut être le suivant :\n"
@ -1877,6 +1880,7 @@ msgstr ""
"fonction \"weechat_hdata_get\".\n"
"\n"
"Exemples (chaînes simples) :\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1509,30 +1509,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1551,6 +1552,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1604,30 +1604,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1646,6 +1647,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -1661,30 +1661,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1703,6 +1704,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -1697,30 +1697,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1739,6 +1740,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -1663,30 +1663,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1705,6 +1706,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-18 11:34+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1667,30 +1667,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1709,6 +1710,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1531,30 +1531,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1573,6 +1574,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1362,30 +1362,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1404,6 +1405,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-10-11 16:22+0200\n"
"POT-Creation-Date: 2020-11-14 09:19+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1364,30 +1364,31 @@ msgid ""
"Some variables are replaced in expression, using the format ${variable}, "
"variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" or \"cut:"
"+max,suffix,string\")\n"
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or \"lengthscr:xxx\")\n"
" 9. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 12. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 15. result of an expression with parentheses and operators + - * / // % ** "
" 16. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted to "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1406,6 +1407,7 @@ msgid ""
"function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -7431,33 +7431,34 @@ command_init ()
"Some variables are replaced in expression, using the format "
"${variable}, variable can be, by order of priority:\n"
" 1. an evaluated sub-string (format: \"eval:xxx\")\n"
" 2. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 3. a string with chars to hide (format: \"hide:char,string\")\n"
" 4. a string with max chars (format: \"cut:max,suffix,string\" "
" 2. an evaluated condition (format: \"eval_cond:xxx\")\n"
" 3. a string with escaped chars (format: \"esc:xxx\" or \"\\xxx\")\n"
" 4. a string with chars to hide (format: \"hide:char,string\")\n"
" 5. a string with max chars (format: \"cut:max,suffix,string\" "
"or \"cut:+max,suffix,string\")\n"
" or max chars displayed on screen "
"(format: \"cutscr:max,suffix,string\" or "
"\"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. length of a string (format: \"length:xxx\" or "
" 6. a reversed string (format: \"rev:xxx\" or \"revscr:xxx\")\n"
" 7. a repeated string (format: \"repeat:count,string\")\n"
" 8. length of a string (format: \"length:xxx\" or "
"\"lengthscr:xxx\")\n"
" 8. a color (format: \"color:xxx\", see \"Plugin API "
" 9. a color (format: \"color:xxx\", see \"Plugin API "
"reference\", function \"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are "
" 10. a modifier (format: \"modifier:name,data,string\")\n"
" 11. an info (format: \"info:name,arguments\", arguments are "
"optional)\n"
" 11. a base 16/32/64 encoded/decoded string (format: "
" 12. a base 16/32/64 encoded/decoded string (format: "
"\"base_encode:base,xxx\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: "
" 13. current date/time (format: \"date\" or \"date:format\")\n"
" 14. an environment variable (format: \"env:XXX\")\n"
" 15. a ternary operator (format: "
"\"if:condition?value_if_true:value_if_false\")\n"
" 15. result of an expression with parentheses and operators "
" 16. result of an expression with parentheses and operators "
"+ - * / // % ** (format: \"calc:xxx\")\n"
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. a hdata name/variable (the value is automatically converted "
" 17. an option (format: \"file.section.option\")\n"
" 18. a local variable in buffer\n"
" 19. a hdata name/variable (the value is automatically converted "
"to string), by default \"window\" and \"buffer\" point to current "
"window/buffer.\n"
"Format for hdata can be one of following:\n"
@ -7477,6 +7478,7 @@ command_init ()
"reference\", function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${eval_cond:${window.win_width}>100} ==> 1\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"

View File

@ -188,6 +188,27 @@ eval_strstr_level (const char *string, const char *search,
return NULL;
}
/*
* Evaluates a condition and returns boolean result:
* "0" if false
* "1" if true
*
* Note: result must be freed after use.
*/
char *
eval_string_eval_cond (const char *text, struct t_eval_context *eval_context)
{
char *tmp;
int rc;
tmp = eval_expression_condition (text, eval_context);
rc = eval_is_true (tmp);
if (tmp)
free (tmp);
return strdup ((rc) ? EVAL_STR_TRUE : EVAL_STR_FALSE);
}
/*
* Hides chars in a string.
*
@ -569,7 +590,7 @@ eval_string_date (const char *text)
}
/*
* Evaluates a condition.
* Evaluates a condition and returns evaluated if/else clause.
*
* Note: result must be freed after use.
*/
@ -893,29 +914,30 @@ end:
* Replaces variables, which can be, by order of priority:
* 1. an extra variable from hashtable "extra_vars"
* 2. a string to evaluate (format: eval:xxx)
* 3. a string with escaped chars (format: esc:xxx or \xxx)
* 4. a string with chars to hide (format: hide:char,string)
* 5. a string with max chars (format: cut:max,suffix,string or
* 3. a condition to evaluate (format: eval_cond:xxx)
* 4. a string with escaped chars (format: esc:xxx or \xxx)
* 5. a string with chars to hide (format: hide:char,string)
* 6. a string with max chars (format: cut:max,suffix,string or
* cut:+max,suffix,string) or max chars on screen
* (format: cutscr:max,suffix,string or cutscr:+max,suffix,string)
* 6. a reversed string (format: rev:xxx) or reversed string for screen,
* 7. a reversed string (format: rev:xxx) or reversed string for screen,
* color codes are not reversed (format: revscr:xxx)
* 7. a repeated string (format: repeat:count,string)
* 8. length of a string (format: length:xxx) or length of a string on screen
* 8. a repeated string (format: repeat:count,string)
* 9. length of a string (format: length:xxx) or length of a string on screen
* (format: lengthscr:xxx); color codes are ignored
* 9. a regex group captured (format: re:N (0.99) or re:+)
* 10. a color (format: color:xxx)
* 11. a modifier (format: modifier:name,data,xxx)
* 12. an info (format: info:name,arguments)
* 13. a base 16/32/64 encoded/decoded string (format: base_encode:base,xxx
* 10. a regex group captured (format: re:N (0.99) or re:+)
* 11. a color (format: color:xxx)
* 12. a modifier (format: modifier:name,data,xxx)
* 13. an info (format: info:name,arguments)
* 14. a base 16/32/64 encoded/decoded string (format: base_encode:base,xxx
* or base_decode:base,xxx)
* 14. current date/time (format: date or date:xxx)
* 15. an environment variable (format: env:XXX)
* 16. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 17. calculate result of an expression (format: calc:xxx)
* 18. an option (format: file.section.option)
* 19. a buffer local variable
* 20. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* 15. current date/time (format: date or date:xxx)
* 16. an environment variable (format: env:XXX)
* 17. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 18. calculate result of an expression (format: calc:xxx)
* 19. an option (format: file.section.option)
* 20. a buffer local variable
* 21. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* or hdata[ptr].var1.var2)
*
* See /help in WeeChat for examples.
@ -969,18 +991,25 @@ eval_replace_vars_cb (void *data, const char *text)
if (strncmp (text, "eval:", 5) == 0)
return eval_replace_vars (text + 5, eval_context);
/* 3. convert escaped chars */
/*
* 3. force evaluation of condition (recursive call)
* --> use with caution: the text must be safe!
*/
if (strncmp (text, "eval_cond:", 10) == 0)
return eval_string_eval_cond (text + 10, eval_context);
/* 4. convert escaped chars */
if (strncmp (text, "esc:", 4) == 0)
return string_convert_escaped_chars (text + 4);
if ((text[0] == '\\') && text[1] && (text[1] != '\\'))
return string_convert_escaped_chars (text);
/* 4. hide chars: replace all chars by a given char/string */
/* 5. hide chars: replace all chars by a given char/string */
if (strncmp (text, "hide:", 5) == 0)
return eval_string_hide (text + 5);
/*
* 5. cut chars:
* 6. cut chars:
* cut: max number of chars, and add an optional suffix when the
* string is cut
* cutscr: max number of chars displayed on screen, and add an optional
@ -991,18 +1020,18 @@ eval_replace_vars_cb (void *data, const char *text)
if (strncmp (text, "cutscr:", 7) == 0)
return eval_string_cut (text + 7, 1);
/* 6. reverse string */
/* 7. reverse string */
if (strncmp (text, "rev:", 4) == 0)
return string_reverse (text + 4);
if (strncmp (text, "revscr:", 7) == 0)
return string_reverse_screen (text + 7);
/* 7. repeated string */
/* 8. repeated string */
if (strncmp (text, "repeat:", 7) == 0)
return eval_string_repeat (text + 7);
/*
* 8. length of string:
* 9. length of string:
* length: number of chars
* lengthscr: number of chars displayed on screen
*/
@ -1019,33 +1048,33 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (str_value);
}
/* 9. regex group captured */
/* 10. regex group captured */
if (strncmp (text, "re:", 3) == 0)
return eval_string_regex_group (text + 3, eval_context);
/* 10. color code */
/* 11. color code */
if (strncmp (text, "color:", 6) == 0)
return eval_string_color (text + 6);
/* 11. modifier */
/* 12. modifier */
if (strncmp (text, "modifier:", 9) == 0)
return eval_string_modifier (text + 9);
/* 12. info */
/* 13. info */
if (strncmp (text, "info:", 5) == 0)
return eval_string_info (text + 5);
/* 13. base_encode/base_decode */
/* 14. base_encode/base_decode */
if (strncmp (text, "base_encode:", 12) == 0)
return eval_string_base_encode (text + 12);
if (strncmp (text, "base_decode:", 12) == 0)
return eval_string_base_decode (text + 12);
/* 14. current date/time */
/* 15. current date/time */
if ((strncmp (text, "date", 4) == 0) && (!text[4] || (text[4] == ':')))
return eval_string_date (text + 4);
/* 15. environment variable */
/* 16. environment variable */
if (strncmp (text, "env:", 4) == 0)
{
ptr_value = getenv (text + 4);
@ -1053,18 +1082,18 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 16: ternary operator: if:condition?value_if_true:value_if_false */
/* 17: ternary operator: if:condition?value_if_true:value_if_false */
if (strncmp (text, "if:", 3) == 0)
return eval_string_if (text + 3, eval_context);
/*
* 17. calculate the result of an expression
* 18. calculate the result of an expression
* (with number, operators and parentheses)
*/
if (strncmp (text, "calc:", 5) == 0)
return calc_expression (text + 5);
/* 18. option: if found, return this value */
/* 19. option: if found, return this value */
if (strncmp (text, "sec.data.", 9) == 0)
{
ptr_value = hashtable_get (secure_hashtable_data, text + 9);
@ -1094,7 +1123,7 @@ eval_replace_vars_cb (void *data, const char *text)
}
}
/* 19. local variable in buffer */
/* 20. local variable in buffer */
ptr_buffer = hashtable_get (eval_context->pointers, "buffer");
if (ptr_buffer)
{
@ -1103,7 +1132,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 20. hdata */
/* 21. hdata */
return eval_string_hdata (text, eval_context);
}

View File

@ -384,6 +384,11 @@ TEST(CoreEval, EvalExpression)
/* test eval of substring */
WEE_CHECK_EVAL("\t", "${eval:${\\t}}");
/* test eval of condition */
WEE_CHECK_EVAL("0", "${eval_cond:}");
WEE_CHECK_EVAL("0", "${eval_cond:${buffer.number} == 2}");
WEE_CHECK_EVAL("1", "${eval_cond:${buffer.number} == 1}");
/* test value from extra_vars */
WEE_CHECK_EVAL("value", "${test}");