core: allow floating point and hexadecimal numbers in comparison of evaluated values

v2.8-utf8proc
Sébastien Helleu 2017-10-17 20:43:40 +02:00
parent 5233160d82
commit 1d56e17b2f
28 changed files with 714 additions and 627 deletions

View File

@ -30,6 +30,7 @@ New features::
Improvements::
* core: allow floating point and hexadecimal numbers in comparison of evaluated values
* core: add option weechat.look.save_config_with_fsync (issue #1083)
* api: add argument "recurse_subdirs" in function exec_on_files()
* script: add local variable "filter" in the script buffer (issue #1037)

View File

@ -257,56 +257,59 @@ infolists: zeigt Information über die Infolists an
/eval [-n|-s] <expression>
[-n] -c <expression1> <operator> <expression2>
-n: gibt das Ergebnis aus, ohne das dieses in den Buffer gesendet wird (debug Modus)
-s: teilt Ausdrücke bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden)
-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)
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-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 (wildcard "*" is allowed)
!* is NOT matching mask (wildcard "*" is allowed)
Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, leer und von "0" abweichend ist.
Der Vergleich findet zwischen zwei Integer Werten statt, sofern die beiden Ausdrücke gültige Integer-Werte sind.
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 welche 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 Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")\n
6. eine Info (Format: "info:Name,Argumente", Argumente sind optional)
7. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
8. eine Umgebungsvariable (Format: "env:XXX")
9. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
10. eine Option (Format: "file.section.option")
11. der Name einer lokalen Variablen eines Buffer
12. ein 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. 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")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a color (format: "color:xxx", see "Plugin API reference", function "color")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
8. an environment variable (format: "env:XXX")
9. a ternary operator (format: "if:condition?value_if_true:value_if_false")
10. an option (format: "file.section.option")
11. a local variable in buffer
12. 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 ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
@ -321,15 +324,15 @@ Beispiele (einfache Zeichenketten):
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
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
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
----

View File

@ -278,8 +278,11 @@ expression: expression to evaluate, variables with format ${variable} are replac
!* is NOT matching mask (wildcard "*" is allowed)
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using integers if the two expressions are valid integers.
To force a string comparison, add double quotes around each expression, for example:
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

View File

@ -1955,7 +1955,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 and 1.8._
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8 and 2.0._
Evaluate an expression and return result as a string.
Special variables with format `+${variable}+` are expanded (see table below).
@ -1976,7 +1976,8 @@ char *weechat_string_eval_expression (const char *expr,
Arguments:
* _expr_: the expression to evaluate (see table below)
* _expr_: the expression to evaluate (see <<eval_conditions,conditions>> and
<<eval_variables,variables>>)
* _pointers_: hashtable with pointers (keys must be string, values must be
pointer); pointers "window" and "buffer" are automatically added if they are
not in hashtable (with pointer to current window/buffer) (can be NULL):
@ -2008,6 +2009,74 @@ Return value:
* evaluated expression (must be freed by calling "free" after use), or NULL
if problem (invalid expression or not enough memory)
C examples:
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* simple expression */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* replace with regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* add brackets around URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* hide passwords */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python):
[source,python]
----
# prototype
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# examples
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# simple expression
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# replace with regex: add brackets around URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# replace with regex: hide passwords
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
[[eval_conditions]]
===== Conditions
List of logical operators that can be used in conditions (by order of priority,
from first used to last):
@ -2126,6 +2195,22 @@ from first used to last):
`+1+`
|===
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) (_WeeChat ≥ 2.0_)
* hexadecimal number (examples: 0xA3, -0xA3) (_WeeChat ≥ 2.0_)
To force a string comparison, you can add double quotes around each expression,
for example:
* `50 > 100` returns 0 (number comparison)
* `"50" > "100"` returns 1 (string comparison)
[[eval_variables]]
===== Variables
List of variables expanded in expression (by order of priority, from first
expanded to last):
@ -2270,71 +2355,6 @@ expanded to last):
`+1+`
|===
C examples:
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* simple expression */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* replace with regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* add brackets around URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* hide passwords */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python):
[source,python]
----
# prototype
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# examples
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# simple expression
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# replace with regex: add brackets around URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# replace with regex: hide passwords
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
==== string_dyn_alloc
_WeeChat ≥ 1.8._

View File

@ -278,8 +278,11 @@ expression : expression à évaluer, les variables avec le format ${variable} s
!= ne correspond PAS au masque (le caractère joker "*" est autorisé)
Une expression est considérée comme "vraie" si elle est non NULL, non vide, et différente de "0".
La comparaison est faite en utilisant des entiers si les deux expressions sont des entiers valides.
Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque expression, par exemple :
La comparaison est faite en utilisant des nombres à virgule si les deux expressions sont des nombres valides, avec l'un de ces formats :
- entier (exemples : 5, -7)
- nombre à virgule (exemples : 5.2, -7.5, 2.83e-2)
- nombre hexadécimal (exemples : 0xA3, -0xA3)
Pour forcer une comparaison de chaînes, vous pouvez ajouter des guillemets autour de chaque expression, par exemple :
50 > 100 ==> 0
"50" > "100" ==> 1

View File

@ -1991,7 +1991,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 et 1.8._
_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 et 2.0._
É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
@ -2013,7 +2013,8 @@ char *weechat_string_eval_expression (const char *expr,
Paramètres :
* _expr_ : l'expression à évaluer (voir le tableau ci-dessous)
* _expr_ : l'expression à évaluer (voir les <<eval_conditions,conditions>> et
<<eval_variables,variables>>)
* _pointers_ : table de hachage avec les pointeurs (les clés doivent être des
chaînes, les valeurs doivent être des pointeurs); les pointeurs "window" et
"buffer" sont automatiquement ajoutés s'ils ne sont pas dans la table de
@ -2050,6 +2051,74 @@ Valeur de retour :
utilisation), ou NULL si problème (expression invalide ou pas assez de
mémoire)
Exemples en C :
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* expression simple */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* remplacement avec regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* ajout de crochets autour des URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test : https://weechat.org", NULL, NULL, NULL); /* "test : [ https://weechat.org ]" */
/* masquage des mots de passe */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python) :
[source,python]
----
# prototype
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# exemples
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# expression simple
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# remplacement avec regex : ajout de crochets autour des URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test : https://weechat.org", {}, {}, options) # "test : [ https://weechat.org ]"
# replace with regex : masquage des mots de passe
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
[[eval_conditions]]
===== Conditions
Liste des opérateurs logiques qui peuvent être utilisés dans les conditions
(par ordre de priorité, du premier utilisé au dernier) :
@ -2168,6 +2237,22 @@ Liste des opérateurs de comparaison qui peuvent être utilisés dans les condit
`+1+`
|===
La comparaison est faite en utilisant des nombres à virgule si les deux expressions
sont des nombres valides, avec l'un de ces formats :
* entier (exemples : 5, -7)
* nombre à virgule (exemples : 5.2, -7.5, 2.83e-2) (_WeeChat ≥ 2.0_)
* nombre hexadécimal (exemples : 0xA3, -0xA3) (_WeeChat ≥ 2.0_)
Pour forcer une comparaison de chaînes, vous pouvez ajouter des guillemets autour
de chaque expression, par exemple :
* `50 > 100` retourne 0 (comparaison de nombres)
* `"50" > "100"` retourne 1 (comparaison de chaînes)
[[eval_variables]]
===== Variables
Liste des variables étendues dans l'expression (par ordre de priorité, de la
première étendue à la dernière) :
@ -2313,71 +2398,6 @@ première étendue à la dernière) :
`+1+`
|===
Exemples en C :
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* expression simple */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* remplacement avec regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* ajout de crochets autour des URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test : https://weechat.org", NULL, NULL, NULL); /* "test : [ https://weechat.org ]" */
/* masquage des mots de passe */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python) :
[source,python]
----
# prototype
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# exemples
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# expression simple
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# remplacement avec regex : ajout de crochets autour des URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test : https://weechat.org", {}, {}, options) # "test : [ https://weechat.org ]"
# replace with regex : masquage des mots de passe
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
==== string_dyn_alloc
_WeeChat ≥ 1.8._

View File

@ -278,8 +278,11 @@ expression: expression to evaluate, variables with format ${variable} are replac
!* is NOT matching mask (wildcard "*" is allowed)
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using integers if the two expressions are valid integers.
To force a string comparison, add double quotes around each expression, for example:
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

View File

@ -2027,7 +2027,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression
// TRANSLATION MISSING
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6 and 1.8._
_WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8 and 2.0._
// TRANSLATION MISSING
Evaluate an expression and return result as a string.
@ -2051,7 +2051,8 @@ char *weechat_string_eval_expression (const char *expr,
Argomenti:
// TRANSLATION MISSING
* _expr_: the expression to evaluate (see table below)
* _expr_: the expression to evaluate (see <<eval_conditions,conditions>> and
<<eval_variables,variables>>)
* _pointers_: hashtable with pointers (keys must be string, values must be
pointer); pointers "window" and "buffer" are automatically added if they are
not in hashtable (with pointer to current window/buffer) (can be NULL):
@ -2084,6 +2085,75 @@ Valore restituito:
* evaluated expression (must be freed by calling "free" after use), or NULL
if problem (invalid expression or not enough memory)
Esempi in C:
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* simple expression */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* replace with regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* add brackets around URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* hide passwords */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python):
[source,python]
----
# prototipo
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# esempi
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# simple expression
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# replace with regex: add brackets around URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# replace with regex: hide passwords
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
// TRANSLATION MISSING
[[eval_conditions]]
===== Conditions
// TRANSLATION MISSING
List of logical operators that can be used in conditions (by order of priority,
from first used to last):
@ -2206,6 +2276,25 @@ from first used to last):
`+1+`
|===
// TRANSLATION MISSING
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) (_WeeChat ≥ 2.0_)
* hexadecimal number (examples: 0xA3, -0xA3) (_WeeChat ≥ 2.0_)
// TRANSLATION MISSING
To force a string comparison, you can add double quotes around each expression,
for example:
* `50 > 100` returns 0 (number comparison)
* `"50" > "100"` returns 1 (string comparison)
// TRANSLATION MISSING
[[eval_variables]]
===== Variables
// TRANSLATION MISSING
List of variables expanded in expression (by order of priority, from first
expanded to last):
@ -2351,71 +2440,6 @@ expanded to last):
`+1+`
|===
Esempi in C:
[source,C]
----
/* conditions */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* simple expression */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* replace with regex */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* add brackets around URLs */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* hide passwords */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
Script (Python):
[source,python]
----
# prototipo
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# esempi
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# simple expression
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# replace with regex: add brackets around URLs
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# replace with regex: hide passwords
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
==== string_dyn_alloc
_WeeChat ≥ 1.8._

View File

@ -257,56 +257,59 @@ infolists: インフォリストに関する情報を表示
/eval [-n|-s] <expression>
[-n] -c <expression1> <operator> <expression2>
-n: 結果をバッファに送信せずに表示 (デバッグモード)
-s: 評価前に式を分割する (複数のコマンドを指定する場合はセミコロンで区切ってください)
-c: 条件として評価: 演算子と括弧をを使い、ブール値 ("0" または "1") を返します
expression: 評価する式、${variable} 型の書式の変数は置換されます (以下を参照); 複数のコマンドを指定する場合はセミコロンで区切ってください
operator: 論理演算子や比較演算子:
- 論理演算子:
&& ブール演算の "and"
|| ブール演算の "or"
- 比較演算子:
== 等しい
!= 等しくない
<= 以下
< より少ない
>= 以上
> より大きい
=~ POSIX 拡張正規表現にマッチ
!~ POSIX 拡張正規表現にマッチしない
=* マスクにマッチ (ワイルドカード "*" を使えます)
!* マスクにマッチしない (ワイルドカード "*" を使えます)
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-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 (wildcard "*" is allowed)
!* is NOT matching mask (wildcard "*" is allowed)
式が NULL でない場合、空でない場合、"0" でない場合、式は "真" と評価されます。
両方の式が有効な整数である場合、比較は整数を使って行われます。
文字列比較を強制するには、それぞれの式をダブルクォートで囲みます、例:
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
式中の ${variable} 型の書式の変数は置換されます。変数は以下の優先順位に従います:
1. 評価済みのサブ文字列 (書式: "eval:xxx")
2. エスケープ文字を含む文字列 (書式: "esc:xxx" または "\xxx")
3. 隠す文字を含む文字列 (書式: "hide:char,string")
4. 最大文字数を指定した文字列 (書式: "cut:max,suffix,string" または "cut:+max,suffix,string")
または最大文字表示幅を指定した文字列 (書式: "cutscr:max,suffix,string" または "cutscr:+max,suffix,string")
5. 色 (書式: "color:xxx"、"プラグイン API リファレンス" の "color" 関数を参照してください)
6. 情報 (書式: "info:name,arguments"、arguments は任意)
7. 現在の日付/時刻 (書式: "date" または "date:format")
8. 環境変数 (書式: "env:XXX")
9. 三項演算子 (書式: "if:condition?value_if_true:value_if_false")
10. オプション (書式: "file.section.option")
11. バッファのローカル変数
12. hdata の名前/変数 (値は自動的に文字列に変換されます)、デフォルトでは "window" と "buffer" は現在のウィンドウ/バッファを指します。
hdata の書式は以下の 1 つです:
hdata.var1.var2...: hdata (ポインタは既知) で開始し、1 個ずつ変数を続ける (他の hdata を続けることも可能)
hdata[list].var1.var2...: リストを使う hdata で開始する、例:
${buffer[gui_buffers].full_name}: バッファリストにリンクされた最初のバッファのフルネーム
${plugin[weechat_plugins].name}: プラグインリストにリンクされた最初のプラグインの名前
hdata[pointer].var1.var2...: ポインタを使う hdata で開始する、例:
${buffer[0x1234abcd].full_name}: 与えたポインタを持つバッファの完全な名前 (トリガ中で使うことが可能です)
hdata と変数の名前については、"プラグイン API リファレンス" の "weechat_hdata_get" 関数を参照してください。
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")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a color (format: "color:xxx", see "Plugin API reference", function "color")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
8. an environment variable (format: "env:XXX")
9. a ternary operator (format: "if:condition?value_if_true:value_if_false")
10. an option (format: "file.section.option")
11. a local variable in buffer
12. 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".
例 (単純な文字列):
Examples (simple strings):
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
@ -321,7 +324,7 @@ hdata と変数の名前については、"プラグイン API リファレン
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
例 (条件):
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

View File

@ -1961,7 +1961,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test"
==== string_eval_expression
_WeeChat バージョン 0.4.0 以上で利用可、バージョン 0.4.2、0.4.3、1.0、1.1、1.2、1.3、1.6、1.8 で更新。_
_WeeChat バージョン 0.4.0 以上で利用可、バージョン 0.4.2、0.4.3、1.0、1.1、1.2、1.3、1.6、1.8、2.0 で更新。_
式を評価して文字列として返す。`+${variable}+`
という書式で書かれた特殊変数は展開されます (以下の表を参照)。
@ -1982,7 +1982,9 @@ char *weechat_string_eval_expression (const char *expr,
引数:
* _expr_: 評価する式 (以下の表を参照)
// TRANSLATION MISSING
* _expr_: 評価する式 (see <<eval_conditions,conditions>> and
<<eval_variables,variables>>)
* _pointers_: ポインタを含むハッシュテーブル (キーは文字列、値はポインタ);
(現在のウィンドウやバッファへのポインタを持つ) ハッシュテーブルが "window" と
"buffer" ポインタを持たない場合はこれらは自動的に追加される (NULL でも可):
@ -2014,6 +2016,75 @@ char *weechat_string_eval_expression (const char *expr,
* 評価された式 (使用後には必ず "free" を呼び出して領域を開放してください)、失敗した場合は
NULL (式が不正な場合やメモリが不足している場合)
C 言語での使用例:
[source,C]
----
/* 条件式の評価 */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* 単純な展開 */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* 正規表現を用いた置換 */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* URL に関するブラックリストを追加 */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* パスワードを隠す */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
スクリプト (Python) での使用例:
[source,python]
----
# プロトタイプ
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# 例
# 条件式の評価
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# 単純な展開
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# 正規表現を用いた置換: URL に関するブラックリストを追加
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# 正規表現を用いた置換: パスワードを隠す
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
// TRANSLATION MISSING
[[eval_conditions]]
===== Conditions
条件に使える論理演算子のリスト
(上から優先順位の高い順):
@ -2132,6 +2203,25 @@ char *weechat_string_eval_expression (const char *expr,
`+1+`
|===
// TRANSLATION MISSING
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) (_WeeChat ≥ 2.0_)
* hexadecimal number (examples: 0xA3, -0xA3) (_WeeChat ≥ 2.0_)
// TRANSLATION MISSING
To force a string comparison, you can add double quotes around each expression,
for example:
* `50 > 100` returns 0 (number comparison)
* `"50" > "100"` returns 1 (string comparison)
// TRANSLATION MISSING
[[eval_variables]]
===== Variables
式中で展開される変数のリスト
(優先度の高い順、展開順の早いものを上に遅いものを下に):
@ -2276,71 +2366,6 @@ char *weechat_string_eval_expression (const char *expr,
`+1+`
|===
C 言語での使用例:
[source,C]
----
/* 条件式の評価 */
struct t_hashtable *options1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options1, "type", "condition");
char *str1 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options1); /* "1" */
char *str2 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options1); /* "0" */
/* 単純な展開 */
char *str3 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */
/* 正規表現を用いた置換 */
struct t_hashtable *options2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
/* URL に関するブラックリストを追加 */
weechat_hashtable_set (options2, "regex", "\\w+://\\S+");
weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]");
char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */
/* パスワードを隠す */
weechat_hashtable_set (options2, "regex", "(password=)(\\S+)");
weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}");
char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */
----
スクリプト (Python) での使用例:
[source,python]
----
# プロトタイプ
str = weechat.string_eval_expression(expr, pointers, extra_vars, options)
# 例
# 条件式の評価
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# 単純な展開
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# 正規表現を用いた置換: URL に関するブラックリストを追加
options = {
"regex": "\\w+://\\S+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# 正規表現を用いた置換: パスワードを隠す
options = {
"regex": "(password=)(\\S+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
----
==== string_dyn_alloc
_WeeChat バージョン 1.8 以上で利用可_

View File

@ -257,56 +257,59 @@ infolists: wyświetla informacje o infolistach
/eval [-n|-s] <wyrażenie>
[-n] -c <wyrażenie1> <operator> <wyrażenie2>
-n: wyświetla wynik bez wysyłania go do buforu (tryb debugowania)
-s: podziel wyażenie przed przetworzeniem go (wiele komend może być oddzielonych średnikami)
-c: przetwarza jako warunek: użyj operatorów i nawiasów, zwraca wartość logiczną ("0" lub "1")
wyrażenie: wyrażenie do przetworzenia, zmienne o formacie ${zmienna} są zastępowane (zobacz niżej); wiele komend można oddzielić średnikami
operator: operator logiczny lub porównania:
- operatory logiczne:
&& boolowskie "i"
|| boolowskie "lub"
- operatory porównania:
== równy
!= różny
<= mniejszy lub równy
< mniejszy
>= większy lub równy
> większy
=~ pasuje do rozszerzonego wyrażenia regularnego POSIX
!~ NIE pasuje do rozszerzonego wyrażenia regularnego POSIX
=* pasuje do maski (dzika karta "*" dozwolona)
!* NIE pasuje do maski (dzika karta "*" dozwolona)
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-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 (wildcard "*" is allowed)
!* is NOT matching mask (wildcard "*" is allowed)
Wyrażenie jest uznawane za "prawdziwe" jeśli nie jest NULL, nie jest puste, oraz różni się od "0".
Porównania dokonuje się z użyciem liczb całkowitych jeśli oba wyrażenia są liczbami całkowitymi.
W celu wymuszenia porównywania ciągów, należy umieścić każde wyrażenie w cudzysłowie, na przykład:
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
Niektóre zmienne w wyrażeniach są zamieniane, poprzez zastosowanie formatu ${zmienna}, według priorytetu zmienną może być:
1. przetworzony ciąg (format: "eval:xxx")
2. ciąg z wyescapowanymi znakami (format: "esc:xxx" lub "\xxx")
3. ciąg ze znakami do ukrycia (format: "hide:char,string")
4. ciąg o maksymalnej długości (format: "cut:max,suffix,string" lub "cut:+max,suffix,string")
lub maksymalna ilość znaków wyświetlanych na ekranie (format: "cutscr:max,suffix,string" lub "cutscr:+max,suffix,string")
5. kolor (format color:xxx)
6. informacja (format: "info:nazwa,argumenty", argumenty są opcjonalne)
7. obecna data/czas (format: "date" lub "date:format")
8. zmienna środowiskowa (format: "env:XXX")
9. wyrażenie warunkowe (format: "if:condition?value_if_true:value_if_false")
10. opcja (format: plik.sekcja.opcja)
11. zmienna lokalna w buforze
12. nazwa hdatay/zmiennej (wartość jest automatycznie konwertowana na ciąg znaków), domyślnie "window" i "buffer" wskazują na aktualne okno/bufor.
Format dla hdata może być jednym z poniższych:
hdata.zmienna1.zmienna2...: inicjuje hdata (wskaźnik musi być znany), następnie wypytuje zmienne jedna po drugiej (inne hdata mogą być następne)
hdata[list].zmienna1.zmienna2...: inicjuje hdata z wykorzystaniem listy, na przykład:
${buffer[gui_buffers].full_name}: pełna nazwa buforu w połączonej liście buforów
${plugin[weechat_plugins].name}: nazwa pierwszej wtyczki w połączonej liście wtyczek
hdata[wskaźnik].zmienna1.zmienna2...: zacznij z hdata używając wskaźnika, na przykład:
${buffer[0x1234abcd].full_name}: pełna nazwa buforu z tym wskaźnikiem (może zostać użyte w triggerach)
Nazwy hdata i zmiennych, można znaleźć w "Opisie API wtyczek", fukcja "weechat_hdata_get".
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")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a color (format: "color:xxx", see "Plugin API reference", function "color")
6. an info (format: "info:name,arguments", arguments are optional)
7. current date/time (format: "date" or "date:format")
8. an environment variable (format: "env:XXX")
9. a ternary operator (format: "if:condition?value_if_true:value_if_false")
10. an option (format: "file.section.option")
11. a local variable in buffer
12. 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".
Przykłady (proste ciągi):
Examples (simple strings):
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
@ -321,7 +324,7 @@ Przykłady (proste ciągi):
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
Przykłady (warunki):
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

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:32+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:12+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: cs\n"
@ -1472,10 +1472,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -12312,11 +12315,3 @@ msgstr "%s%s: vypršel časový limit \"%s\" pro %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nemohu se připojit\" neočekávaná chyba (%d)"
#, fuzzy
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "maximální počet řádků pro vložení bez dotazování uživatele (0 = vypnout "
#~ "tuto vlastnost)"

View File

@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-14 18:32+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1544,6 +1544,7 @@ msgstr "evaluierter Ausdruck"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n|-s] <expression> || [-n] -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 "
@ -1570,10 +1571,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"

View File

@ -22,8 +22,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:32+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:12+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: es\n"
@ -1503,10 +1503,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -12588,10 +12591,3 @@ msgstr "%s%s: tiempo de espera máximo para \"%s\" con %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: no es posible conectarse al transmisor"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "número máximo de líneas que el usuario puede pegar sin pedir confirmación "
#~ "(-1 = deshabilitar esta función)"

103
po/fr.po
View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-10-14 07:48+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:12+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -1547,10 +1547,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -1617,13 +1620,9 @@ msgid ""
" /eval -n -c abcd =* a*d ==> 1"
msgstr ""
" -n : afficher le résultat sans envoyer au tampon (mode debug)\n"
" -s : découper l'expression avant de l'évaluer (plusieurs commandes "
"peuvent être séparées par des points-virgules)\n"
" -c : évaluer comme une condition : utiliser les opérateurs et les "
"parenthèses, retourner une valeur booléenne (\"0\" ou \"1\")\n"
"expression : expression à évaluer, les variables avec le format ${variable} "
"sont remplacées (voir ci-dessous) ; plusieurs commandes peuvent être "
"séparées par des points-virgules\n"
" -s : découper l'expression avant de l'évaluer (plusieurs commandes peuvent être séparées par des points-virgules)\n"
" -c : évaluer comme une condition : utiliser les opérateurs et les parenthèses, retourner une valeur booléenne (\"0\" ou \"1\")\n"
"expression : expression à évaluer, les variables avec le format ${variable} sont remplacées (voir ci-dessous) ; plusieurs commandes peuvent être séparées par des points-virgules\n"
" opérateur : un opérateur logique ou de comparaison :\n"
" - opérateurs logiques :\n"
" && \"et\" booléen\n"
@ -1636,62 +1635,41 @@ msgstr ""
" >= supérieur ou égal\n"
" > supérieur\n"
" =~ correspond à l'expression régulière POSIX étendue\n"
" !~ ne correspond PAS à l'expression régulière POSIX "
"étendue\n"
" =* correspond au masque (le caractère joker \"*\" est "
"autorisé)\n"
" != ne correspond PAS au masque (le caractère joker \"*\" "
"est autorisé)\n"
" !~ ne correspond PAS à l'expression régulière POSIX étendue\n"
" =* correspond au masque (le caractère joker \"*\" est autorisé)\n"
" != ne correspond PAS au masque (le caractère joker \"*\" est autorisé)\n"
"\n"
"Une expression est considérée comme \"vraie\" si elle est non NULL, non "
"vide, et différente de \"0\".\n"
"La comparaison est faite en utilisant des entiers si les deux expressions "
"sont des entiers valides.\n"
"Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de "
"chaque expression, par exemple :\n"
"Une expression est considérée comme \"vraie\" si elle est non NULL, non vide, et différente de \"0\".\n"
"La comparaison est faite en utilisant des nombres à virgule si les deux expressions sont des nombres valides, avec l'un de ces formats :\n"
" - entier (exemples : 5, -7)\n"
" - nombre à virgule (exemples : 5.2, -7.5, 2.83e-2)\n"
" - nombre hexadécimal (exemples : 0xA3, -0xA3)\n"
"Pour forcer une comparaison de chaînes, vous pouvez ajouter des guillemets autour de chaque expression, par exemple :\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
"Des variables sont remplacées dans l'expression, en utilisant le format "
"${variable}, la variable pouvant être, par ordre de priorité :\n"
"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"
"\")\n"
" 3. 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,"
"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 couleur (format : \"color:xxx\", voir la \"Référence API extension"
"\", fonction \"color\")\n"
" 6. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
" 2. 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,chaîne\")\n"
" 4. 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 couleur (format : \"color:xxx\", voir la \"Référence API extension\", fonction \"color\")\n"
" 6. une info (format : \"info:nom,paramètres\", les paramètres sont optionnels)\n"
" 7. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 8. une variable d'environnement (format : \"env:XXX\")\n"
" 9. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
"valeur_si_faux\")\n"
" 9. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:valeur_si_faux\")\n"
" 10. une option (format : \"fichier.section.option\")\n"
" 11. une variable locale du tampon\n"
" 12. 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"
" 12. 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"
" 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)\n"
" hdata[liste].var1.var2... : démarrer avec un hdata en utilisant une liste, "
"par exemple :\n"
" ${buffer[gui_buffers].full_name} : nom complet du premier tampon dans la "
"liste chaînée des tampons\n"
" ${plugin[weechat_plugins].name} : nom de la première extension dans la "
"liste chaînée des extensions\n"
" hdata[pointeur].var1.var2... : démarrer avec un hdata en utilisant un "
"pointeur, par exemple :\n"
" ${buffer[0x1234abcd].full_name} : nom complet du tampon avec ce pointeur "
"(peut être utilisé dans les triggers)\n"
"Pour le nom du hdata et des variables, voir la \"Référence API extension\", "
"fonction \"weechat_hdata_get\".\n"
" 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)\n"
" hdata[liste].var1.var2... : démarrer avec un hdata en utilisant une liste, par exemple :\n"
" ${buffer[gui_buffers].full_name} : nom complet du premier tampon dans la liste chaînée des tampons\n"
" ${plugin[weechat_plugins].name} : nom de la première extension dans la liste chaînée des extensions\n"
" hdata[pointeur].var1.var2... : démarrer avec un hdata en utilisant un pointeur, par exemple :\n"
" ${buffer[0x1234abcd].full_name} : nom complet du tampon avec ce pointeur (peut être utilisé dans les triggers)\n"
"Pour le nom du hdata et des variables, voir la \"Référence API extension\", fonction \"weechat_hdata_get\".\n"
"\n"
"Exemples (chaînes simples) :\n"
" /eval -n ${info:version} ==> 0.4.3\n"
@ -14027,10 +14005,3 @@ msgstr "%s%s : délai d'attente dépassé pour \"%s\" avec %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s : impossible de se connecter : erreur inattendue (%d)"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "nombre maximum de lignes pour la détection de collage sans demander à "
#~ "l'utilisateur (-1 = désactiver cette fonctionnalité)"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:32+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: hu\n"
@ -1393,10 +1393,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -11604,11 +11607,3 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s DCC: nem sikerült kapcsolódni a küldőhöz\n"
#, fuzzy
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "maximálisan beilleszthető sorok száma a felhasználó megkérdezése nélkül "
#~ "(0 = szolgáltatás kikapcsolása)"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:32+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: it\n"
@ -1486,10 +1486,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -12806,10 +12809,3 @@ msgstr "%s%s: timeout per \"%s\" con %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: impossibile connettersi al mittente"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "numero massimo di righe da incollare senza conferma dell'utente (-1 = "
#~ "disabilita questa caratteristica)"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-10-14 09:00+0900\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
"translation/ja_JP>\n"
@ -1486,6 +1486,7 @@ msgstr "式を評価"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n|-s] <expression> || [-n] -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 "
@ -1512,10 +1513,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -13485,9 +13489,3 @@ msgstr "%s%s: \"%s\" のタイムアウト %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: 接続できません: 未定義のエラー (%d)"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "ユーザへの確認無しにペーストする行数の最大値 (-1 = この機能を無効化)"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-07-22 12:55+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: pl\n"
@ -1525,6 +1525,7 @@ msgstr "przetwórz wyrażenie"
msgid "[-n|-s] <expression> || [-n] -c <expression1> <operator> <expression2>"
msgstr "[-n|-s] <wyrażenie> || [-n] -c <wyrażenie1> <operator> <wyrażenie2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression before evaluating it (many commands can be "
@ -1551,10 +1552,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -13547,10 +13551,3 @@ msgstr "%s%s: przekroczono czas na \"%s\" z %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nie można połączyć: niespodziewany błąd (%d)"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "maksymalna ilość linii do wklejenia bez pytania użytkownika (-1 = wyłącza "
#~ "tę opcję)"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-07-22 12:55+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
"Language: pt\n"
@ -1540,10 +1540,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -13439,10 +13442,3 @@ msgstr "%s%s: tempo limite de \"%s\" com %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar: erro inesperado (%d)"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "número máximo de linhas para colar sem solicitar o utilizador (-1 = "
#~ "desativar a funcionalidade)"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:33+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: pt_BR\n"
@ -1548,10 +1548,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -12085,10 +12088,3 @@ msgstr "%s%s: tempo esgotado para \"%s\" com %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar ao remetente"
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "número máximo de linhas para serem coladas sem perguntar ao usuário (-1 = "
#~ "desabilita essa característica)"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"PO-Revision-Date: 2017-06-26 23:33+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-10-17 20:14+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: ru\n"
@ -1415,10 +1415,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
@ -11636,11 +11639,3 @@ msgstr "%s нет аргумента для параметра \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s DCC: не могу соединиться с отправителем\n"
#, fuzzy
#~ msgid ""
#~ "max number of lines for paste without asking user (-1 = disable this "
#~ "feature)"
#~ msgstr ""
#~ "максимальное количество строк, вставляемых без подтверждения (0 = "
#~ "отключить подтверждение)"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-10-14 07:47+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\n"
"PO-Revision-Date: 2017-06-26 23:33+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1248,10 +1248,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\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: 2017-10-14 07:47+0200\n"
"POT-Creation-Date: 2017-10-17 16:39+0200\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"
@ -1250,10 +1250,13 @@ msgid ""
"\n"
"An expression is considered as \"true\" if it is not NULL, not empty, and "
"different from \"0\".\n"
"The comparison is made using integers if the two expressions are valid "
"integers.\n"
"To force a string comparison, add double quotes around each expression, for "
"example:\n"
"The comparison is made using floating point numbers if the two expressions "
"are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around each "
"expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"

View File

@ -7251,10 +7251,13 @@ command_init ()
"\n"
"An expression is considered as \"true\" if it is not NULL, not "
"empty, and different from \"0\".\n"
"The comparison is made using integers if the two expressions are "
"valid integers.\n"
"To force a string comparison, add double quotes around each "
"expression, for example:\n"
"The comparison is made using floating point numbers if the two "
"expressions are valid numbers, with one of the following formats:\n"
" - integer (examples: 5, -7)\n"
" - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
" - hexadecimal number (examples: 0xA3, -0xA3)\n"
"To force a string comparison, you can add double quotes around "
"each expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"

View File

@ -769,7 +769,7 @@ eval_compare (const char *expr1, int comparison, const char *expr2)
{
int rc, string_compare, length1, length2;
regex_t regex;
long value1, value2;
double value1, value2;
char *error;
rc = 0;
@ -816,12 +816,14 @@ eval_compare (const char *expr1, int comparison, const char *expr2)
if (!string_compare)
{
value1 = strtol (expr1, &error, 10);
value1 = strtod (expr1, &error);
if (!error || error[0])
{
string_compare = 1;
}
else
{
value2 = strtol (expr2, &error, 10);
value2 = strtod (expr2, &error);
if (!error || error[0])
string_compare = 1;
}

View File

@ -69,6 +69,9 @@ def test_strings():
check(weechat.string_input_for_buffer('/test') == '')
check(weechat.string_input_for_buffer('//test') == '/test')
check(weechat.string_eval_expression("100 > 50", {}, {}, {"type": "condition"}) == '1')
check(weechat.string_eval_expression("-50 < 100", {}, {}, {"type": "condition"}) == '1')
check(weechat.string_eval_expression("18.2 > 5", {}, {}, {"type": "condition"}) == '1')
check(weechat.string_eval_expression("0xA3 > 2", {}, {}, {"type": "condition"}) == '1')
check(weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) == 'core.weechat')

View File

@ -101,6 +101,19 @@ TEST(Eval, EvalCondition)
WEE_CHECK_EVAL("0", "2 != 2");
WEE_CHECK_EVAL("0", "18 < 5");
WEE_CHECK_EVAL("0", "5 > 18");
WEE_CHECK_EVAL("0", "18 < -5");
WEE_CHECK_EVAL("0", "-5 > 18");
WEE_CHECK_EVAL("0", "-18 > 5");
WEE_CHECK_EVAL("0", "5 < -18");
WEE_CHECK_EVAL("0", "18.2 < 5");
WEE_CHECK_EVAL("0", "5 > 18.2");
WEE_CHECK_EVAL("0", "18.2 < -5");
WEE_CHECK_EVAL("0", "-5 > 18.2");
WEE_CHECK_EVAL("0", "-18.2 > 5");
WEE_CHECK_EVAL("0", "5 < -18.2");
WEE_CHECK_EVAL("0", "2.3e-2 != 0.023");
WEE_CHECK_EVAL("0", "0xA3 < 2");
WEE_CHECK_EVAL("0", "-0xA3 > 2");
WEE_CHECK_EVAL("0", "1 == 5 > 18");
WEE_CHECK_EVAL("0", "abc == def");
WEE_CHECK_EVAL("0", "()");
@ -140,6 +153,19 @@ TEST(Eval, EvalCondition)
WEE_CHECK_EVAL("1", "1 != 2");
WEE_CHECK_EVAL("1", "18 > 5");
WEE_CHECK_EVAL("1", "5 < 18");
WEE_CHECK_EVAL("1", "18 > -5");
WEE_CHECK_EVAL("1", "-5 < 18");
WEE_CHECK_EVAL("1", "-18 < 5");
WEE_CHECK_EVAL("1", "5 > -18");
WEE_CHECK_EVAL("1", "18.2 > 5");
WEE_CHECK_EVAL("1", "5 < 18.2");
WEE_CHECK_EVAL("1", "18.2 > -5");
WEE_CHECK_EVAL("1", "-5 < 18.2");
WEE_CHECK_EVAL("1", "-18.2 < 5");
WEE_CHECK_EVAL("1", "5 > -18.2");
WEE_CHECK_EVAL("1", "2.3e-2 == 0.023");
WEE_CHECK_EVAL("1", "0xA3 > 2");
WEE_CHECK_EVAL("1", "-0xA3 < 2");
WEE_CHECK_EVAL("1", "1 == 18 > 5");
WEE_CHECK_EVAL("1", "abc == abc");
WEE_CHECK_EVAL("1", "(26 > 5)");