diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-03-17 21:56:07 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-03-17 21:57:16 +0100 |
commit | 8ee7d46605b70474350a20855e2ef755e6c3dc82 (patch) | |
tree | 3fd92bec9baa97726c9ea9a0982f51e35039aeff /doc | |
parent | c54cadace5fd262ac5c70226e98f3dd1bef4f689 (diff) | |
download | weechat-8ee7d46605b70474350a20855e2ef755e6c3dc82.zip |
api: add support of pointer names in function string_eval_expression (direct and in hdata)
These two formats are now supported, if "pointer_name" is present in the
"pointers" hashtable:
* "${pointer_name}": value of pointer (example: "0x1234abcd")
* ${buffer[pointer_name].full_name}: use of a pointer name instead of pointer
value or list name
Diffstat (limited to 'doc')
-rw-r--r-- | doc/de/includes/autogen_user_commands.de.adoc | 155 | ||||
-rw-r--r-- | doc/en/includes/autogen_user_commands.en.adoc | 3 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 11 | ||||
-rw-r--r-- | doc/fr/includes/autogen_user_commands.fr.adoc | 3 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.adoc | 12 | ||||
-rw-r--r-- | doc/it/includes/autogen_user_commands.it.adoc | 3 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 11 | ||||
-rw-r--r-- | doc/ja/includes/autogen_user_commands.ja.adoc | 3 | ||||
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.adoc | 13 | ||||
-rw-r--r-- | doc/pl/includes/autogen_user_commands.pl.adoc | 135 |
10 files changed, 193 insertions, 156 deletions
diff --git a/doc/de/includes/autogen_user_commands.de.adoc b/doc/de/includes/autogen_user_commands.de.adoc index 65ccc4d3d..01f51dd4d 100644 --- a/doc/de/includes/autogen_user_commands.de.adoc +++ b/doc/de/includes/autogen_user_commands.de.adoc @@ -1304,80 +1304,81 @@ infolists: zeigt Information über die Infolists an /eval [-n|-s] [-d] <expression> [-n] [-d [-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 (Nutzung von zwei -d: ausführliche Debug-Ausgabe) - -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 - -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: + -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 (with two -d: more verbose debug) + -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 + +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. die Zeichenfolge selbst ohne Auswertung (Format: "raw:xxx")\n - 2. eine evaluierte Teilzeichenkette (Format: "eval:xxx") - 3. eine evaluierte Bedingung (Format: "eval_cond:xxx") - 4. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx") - 5. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette") - 6. 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") - 7. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx") - 8. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette") - 9. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx") - 10. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color") - 11. ein Modifizierer (Format: "info:Name,Argumente", Argumente sind optional) - 12. eine Info (Format: "Info:Name,Argumente", Argumente sind optional) - 13. eine Basis 16/32/64 kodierte / dekodierte Zeichenfolge (Format: "base_encode:base,xxx" oder "base_decode:base,xxx") - 14. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format") - 15. eine Umgebungsvariable (Format: "env:XXX") - 16. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr") - 17. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx") - 18. eine Option (Format: "file.section.option") - 19. eine lokale Variable eines Buffers - 20. 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 - -Beispiele (einfache Zeichenketten): +Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: + 1. the string itself without evaluation (format: "raw:xxx") + 2. an evaluated sub-string (format: "eval:xxx") + 3. an evaluated condition (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 displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string") + 7. a reversed string (format: "rev:xxx" or "revscr:xxx") + 8. a repeated string (format: "repeat:count,string") + 9. length of a string (format: "length:xxx" or "lengthscr:xxx") + 10. a color (format: "color:xxx", see "Plugin API reference", function "color") + 11. a modifier (format: "modifier:name,data,string") + 12. an info (format: "info:name,arguments", arguments are optional) + 13. 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:format") + 15. an environment variable (format: "env:XXX") + 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 18. an option (format: "file.section.option") + 19. a local variable in buffer + 20. 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/pointer/pointer name, 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) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (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 ${raw:${info:version}} ==> ${info:version} /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 @@ -1395,17 +1396,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]] diff --git a/doc/en/includes/autogen_user_commands.en.adoc b/doc/en/includes/autogen_user_commands.en.adoc index 8bf456075..8eefbdbdc 100644 --- a/doc/en/includes/autogen_user_commands.en.adoc +++ b/doc/en/includes/autogen_user_commands.en.adoc @@ -1364,11 +1364,12 @@ Some variables are replaced in expression, using the format ${variable}, variabl 20. 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: + hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, 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) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (can be used in triggers) For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples (simple strings): diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index f5233c511..cc6ee1844 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -2209,7 +2209,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, 2.9 and 3.1._ +2.2, 2.3, 2.7, 2.9, 3.1 and 3.2._ Evaluate an expression and return result as a string. Special variables with format `+${variable}+` are expanded (see table below). @@ -2755,11 +2755,18 @@ expanded to last): `+${nick}+` | `+FlashCode+` +| `+${pointer}+` | + Variable `pointer` from hashtable _pointers_. | + `+${my_pointer}+` | + `+0x1234abcd+` + | `+${hdata.var1.var2...}+` + `+${hdata[list].var1.var2...}+` | Hdata value (pointers `window` and `buffer` are set by default with current - window/buffer). | + window/buffer), `list` can be a list name (example: "gui_buffers"), a pointer + (example: "0x1234abcd") or a pointer name (example: "my_pointer"). | `+${buffer[gui_buffers].full_name}+` + + `+${buffer[my_buffer_pointer].full_name}+` + `+${window.buffer.number}+` | `+core.weechat+` + `+1+` diff --git a/doc/fr/includes/autogen_user_commands.fr.adoc b/doc/fr/includes/autogen_user_commands.fr.adoc index 168484b98..5ebc45cd4 100644 --- a/doc/fr/includes/autogen_user_commands.fr.adoc +++ b/doc/fr/includes/autogen_user_commands.fr.adoc @@ -1364,11 +1364,12 @@ Des variables sont remplacées dans l'expression, en utilisant le format ${varia 20. 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 : + hdata[liste].var1.var2... : démarrer avec un hdata en utilisant une liste/pointeur/nom de pointeur, par exemple : ${buffer[gui_buffers].full_name} : nom complet du premier tampon dans la liste chaînée des tampons ${plugin[weechat_plugins].name} : nom de la première extension dans la liste chaînée des extensions hdata[pointeur].var1.var2... : démarrer avec un hdata en utilisant un pointeur, par exemple : ${buffer[0x1234abcd].full_name} : nom complet du tampon avec ce pointeur (peut être utilisé dans les triggers) + ${buffer[my_pointer].full_name} : nom complet du tampon avec ce nom de pointeur (peut être utilisé dans les triggers) Pour le nom du hdata et des variables, voir la "Référence API extension", fonction "weechat_hdata_get". Exemples (chaînes simples) : diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index d9a670c4e..a95f4c1e5 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -2246,7 +2246,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, 2.9 et 3.1._ +2.0, 2.2, 2.3, 2.7, 2.9, 3.1 et 3.2._ É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 @@ -2800,11 +2800,19 @@ première étendue à la dernière) : `+${nick}+` | `+FlashCode+` +| `+${pointeur}+` | + Variable `pointeur` de la table de hachage _pointers_. | + `+${mon_pointeur}+` | + `+0x1234abcd+` + | `+${hdata.var1.var2...}+` + `+${hdata[list].var1.var2...}+` | Valeur d'un hdata (les pointeurs `window` et `buffer` sont définis par défaut - avec la fenêtre et tampon courants). | + avec la fenêtre et tampon courants), `list` peut être le nom d'une liste + (exemple : "gui_buffers"), un pointeur (exemple : "0x1234abcd") ou un nom + de pointeur (exemple : "mon_pointeur"). | `+${buffer[gui_buffers].full_name}+` + + `+${buffer[mon_pointeur_buffer].full_name}+` + `+${window.buffer.number}+` | `+core.weechat+` + `+1+` diff --git a/doc/it/includes/autogen_user_commands.it.adoc b/doc/it/includes/autogen_user_commands.it.adoc index 3edfb8f9d..c75beaaec 100644 --- a/doc/it/includes/autogen_user_commands.it.adoc +++ b/doc/it/includes/autogen_user_commands.it.adoc @@ -1364,11 +1364,12 @@ Some variables are replaced in expression, using the format ${variable}, variabl 20. 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: + hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, 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) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (can be used in triggers) For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples (simple strings): diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index ddffdc528..b6a1ed419 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2306,7 +2306,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, 2.9 and 3.1._ +2.2, 2.3, 2.7, 2.9, 3.1 and 3.2._ // TRANSLATION MISSING Evaluate an expression and return result as a string. @@ -2869,11 +2869,18 @@ expanded to last): `+${nick}+` | `+FlashCode+` +| `+${pointer}+` | + Variable `pointer` from hashtable _pointers_. | + `+${my_pointer}+` | + `+0x1234abcd+` + | `+${hdata.var1.var2...}+` + `+${hdata[list].var1.var2...}+` | Hdata value (pointers `window` and `buffer` are set by default with current - window/buffer). | + window/buffer), `list` can be a list name (example: "gui_buffers"), a pointer + (example: "0x1234abcd") or a pointer name (example: "my_pointer"). | `+${buffer[gui_buffers].full_name}+` + + `+${buffer[my_buffer_pointer].full_name}+` + `+${window.buffer.number}+` | `+core.weechat+` + `+1+` diff --git a/doc/ja/includes/autogen_user_commands.ja.adoc b/doc/ja/includes/autogen_user_commands.ja.adoc index 8840a3daf..0ace26e69 100644 --- a/doc/ja/includes/autogen_user_commands.ja.adoc +++ b/doc/ja/includes/autogen_user_commands.ja.adoc @@ -1364,11 +1364,12 @@ Some variables are replaced in expression, using the format ${variable}, variabl 20. 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: + hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, 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) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (can be used in triggers) For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples (simple strings): diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index f1cab0fa6..26aaabae6 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -2226,7 +2226,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, 2.9 and 3.1._ +2.2, 2.3, 2.7, 2.9, 3.1 and 3.2._ 式を評価して文字列として返す。`+${variable}+` という書式で書かれた特殊変数は展開されます (以下の表を参照)。 @@ -2789,11 +2789,20 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio `+${nick}+` | `+FlashCode+` +| `+${pointer}+` | + _pointers_ の変数 `pointer` の値に展開 | + `+${my_pointer}+` | + `+0x1234abcd+` + +// TRANSLATION MISSING | `+${hdata.var1.var2...}+` + `+${hdata[list].var1.var2...}+` | hdata の値 (`window` と `buffer` - ポインタはデフォルトで現在のウィンドウ/バッファに設定されます) | + ポインタはデフォルトで現在のウィンドウ/バッファに設定されます), + `list` can be a list name (example: "gui_buffers"), a pointer + (example: "0x1234abcd") or a pointer name (example: "my_pointer"). | `+${buffer[gui_buffers].full_name}+` + + `+${buffer[my_buffer_pointer].full_name}+` + `+${window.buffer.number}+` | `+core.weechat+` + `+1+` diff --git a/doc/pl/includes/autogen_user_commands.pl.adoc b/doc/pl/includes/autogen_user_commands.pl.adoc index 54e76cdc5..537c7c70e 100644 --- a/doc/pl/includes/autogen_user_commands.pl.adoc +++ b/doc/pl/includes/autogen_user_commands.pl.adoc @@ -1303,80 +1303,81 @@ infolists: wyświetla informacje o infolistach /eval [-n|-s] [-d] <wyrażenie> [-n] [-d [-d]] -c <wyrażenie1> <operator> <wyrażenie2> - -n: wyświetla wynik bez wysyłania go do buforu (tryb debugowania) - -s: podziel wyrażenie przed przetworzeniem go (wiele komend może być oddzielonych średnikami) - -d: wyświetl wyjście debugowe po ewaluacji - -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: - && logiczne „i” - || logiczne „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, rozróżnia wielkość znaków (dzika karta „*” dozwolona) - !!* NIE pasuje do maski, rozróżnia wielkość znaków (dzika karta „*” dozwolona) - =* pasuje do maski, nie rozróżnia wielkość znaków (dzika karta „*” dozwolona) - !* NIE pasuje do maski, nie rozróżnia wielkość znaków (dzika karta „*” dozwolona) - ==- jest zawarte, rozróżnia wielkość znaków - !!- NIE jest zawarte,rozróżnia wielkość znaków - =- jest zawarte, nie rozróżnia wielkość znaków - !- NIE jest zawarte, nie rozróżnia wielkość znaków - -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 jednym z następujących formatów: - - liczby całkowite (przykłady: 5, -7) - - liczby zmiennoprzecinkowe (przykłady: 5.2, -7.5, 2.83e-2) - - liczby szesnastkowe (przykłady: 0xA3, -0xA3) -W celu wymuszenia porównywania ciągów, należy umieścić każde wyrażenie w cudzysłowie, na przykład: + -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 (with two -d: more verbose debug) + -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 + +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. nieprzetworzony ciąg (format: "raw:xxx") - 2. przetworzony ciąg (format: "eval:xxx") - 3. przetworzony warunek (format: "eval_cond:xxx") - 4. ciąg z wyescapowanymi znakami (format: "esc:xxx" lub "\xxx") - 5. ciąg ze znakami do ukrycia (format: "hide:char,string") - 6. 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") - 7. odwrócony ciąg (format: "rev:xxx") - 8. powtórzony ciąg (format: "repeat:ilość,ciąg") - 9. długość ciągu (format: "length:xxx" or "lengthscr:xxx") - 10. kolor (format "color:xxx", zobacz „Opis API wtyczek”, funkcja "color") - 11. modyfikator (format: "modifier:name,data,string") - 12. informacja (format: "info:nazwa,argumenty", argumenty są opcjonalne) - 13. ciąg zakodowany/zdekodowany z base 16/32/64 (format: "base_encode:base,xxx" lub "base_decode:base,xxx") - 14. obecna data/czas (format: "date" lub "date:format") - 15. zmienna środowiskowa (format: "env:XXX") - 16. wyrażenie warunkowe (format: "if:condition?value_if_true:value_if_false") - 17. wynik wyrażenia z nawiasami i operatorami + - * / // % ** (format: "calc:xxx") - 18. opcja (format: plik.sekcja.opcja) - 19. zmienna lokalna w buforze - 20. 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”, funkcja "weechat_hdata_get". - -Przykłady (proste ciągi): +Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: + 1. the string itself without evaluation (format: "raw:xxx") + 2. an evaluated sub-string (format: "eval:xxx") + 3. an evaluated condition (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 displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string") + 7. a reversed string (format: "rev:xxx" or "revscr:xxx") + 8. a repeated string (format: "repeat:count,string") + 9. length of a string (format: "length:xxx" or "lengthscr:xxx") + 10. a color (format: "color:xxx", see "Plugin API reference", function "color") + 11. a modifier (format: "modifier:name,data,string") + 12. an info (format: "info:name,arguments", arguments are optional) + 13. 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:format") + 15. an environment variable (format: "env:XXX") + 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 18. an option (format: "file.section.option") + 19. a local variable in buffer + 20. 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/pointer/pointer name, 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) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (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 ${raw:${info:version}} ==> ${info:version} /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} ==> secret + /eval -n ${sec.data.freenode_password} ==> secret /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 /eval -n ${window.buffer.full_name} ==> core.weechat @@ -1394,7 +1395,7 @@ Przykłady (proste ciągi): /eval -n ${base_encode:64,test} ==> dGVzdA== /eval -n ${base_decode:64,dGVzdA==} ==> test -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 |