diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2015-06-30 20:25:35 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2015-06-30 20:25:35 +0200 |
commit | 9bf40517d3fdc48befec9ea4030338e8e98b1852 (patch) | |
tree | 0142fb829326ce8305217899ca9dd5a725100792 /doc | |
parent | e92a63427f2f3d45646cf0ffc107cf3f0a279f84 (diff) | |
download | weechat-9bf40517d3fdc48befec9ea4030338e8e98b1852.zip |
api: add support of evaluated sub-strings and current date/time in function string_eval_expression() and command /eval
Diffstat (limited to 'doc')
-rw-r--r-- | doc/de/autogen/user/weechat_commands.asciidoc | 103 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.asciidoc | 19 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.asciidoc | 21 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.asciidoc | 19 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.asciidoc | 21 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.asciidoc | 19 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.asciidoc | 23 | ||||
-rw-r--r-- | doc/ja/autogen/user/weechat_commands.asciidoc | 19 | ||||
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.asciidoc | 24 | ||||
-rw-r--r-- | doc/pl/autogen/user/weechat_commands.asciidoc | 19 |
10 files changed, 189 insertions, 98 deletions
diff --git a/doc/de/autogen/user/weechat_commands.asciidoc b/doc/de/autogen/user/weechat_commands.asciidoc index de67f79cb..49fa3fc95 100644 --- a/doc/de/autogen/user/weechat_commands.asciidoc +++ b/doc/de/autogen/user/weechat_commands.asciidoc @@ -251,49 +251,51 @@ 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 - -Ein Ausdruck gilt als "wahr", sofern das Ergebnis nicht NULL, nicht 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: + -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 + +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: 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 Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx") - 2. Zeichen welche in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette") - 3. eine Farbe (Format: color:xxx) - 4. eine Info (Format: "info:name,arguments", Argumente sind optional) - 5. eine Umgebungsvariable (Format: "env:XXX") - 6. der Name einer Programmoption (Format: file.section.option) - 7. der Name einer lokalen Variablen eines Buffer - 8. ein hdata Name/Variable (der Wert wird automatisch als 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. 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 color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. 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 @@ -303,16 +305,17 @@ Beispiele (einfache Zeichenketten): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- - -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 ${date:%H:%M:%S} ==> 07:46:40 + +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 ---- [[command_weechat_filter]] diff --git a/doc/en/autogen/user/weechat_commands.asciidoc b/doc/en/autogen/user/weechat_commands.asciidoc index 9ff20bc01..aea0caa96 100644 --- a/doc/en/autogen/user/weechat_commands.asciidoc +++ b/doc/en/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: - 1. a string with escaped chars (format: "esc:xxx" or "\xxx") - 2. a string with chars to hide (format: "hide:char,string") - 3. a color (format: "color:xxx") - 4. an info (format: "info:name,arguments", arguments are optional) - 5. an environment variable (format: "env:XXX") - 6. an option (format: "file.section.option") - 7. a local variable in buffer - 8. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 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 color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. 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: @@ -303,6 +305,7 @@ Examples (simple strings): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Examples (conditions): /eval -n -c ${window.buffer.number} > 2 ==> 0 diff --git a/doc/en/weechat_plugin_api.en.asciidoc b/doc/en/weechat_plugin_api.en.asciidoc index cca10ff35..369d62782 100644 --- a/doc/en/weechat_plugin_api.en.asciidoc +++ b/doc/en/weechat_plugin_api.en.asciidoc @@ -1902,7 +1902,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" ==== string_eval_expression -_WeeChat ≥ 0.4.0, updated in 0.4.2 and 1.1._ +_WeeChat ≥ 0.4.0, updated in 0.4.2, 1.0, 1.1, 1.2 and 1.3._ Evaluate an expression and return result as a string. Special variables with format `${variable}` are expanded (see table below). @@ -1954,13 +1954,20 @@ Return value: List of variables expanded in expression (by order of priority, from first expanded to last): -[width="100%",cols="2,8,3,3",options="header"] +[width="100%",cols="2,8,4,4",options="header"] |=== | Format | Description | Examples | Results | `${name}` | Variable `name` from hashtable 'extra_vars' | `${name}` | `value` +| `${eval:xxx}` + + (_WeeChat ≥ 1.3_) | + String to evaluate | + `${eval:${date:${weechat.look.buffer_time_format}}}` | + `19:02:45` (with colors if there are color codes in the option + weechat.look.buffer_time_format) + | `${esc:xxx}` + `${\xxx}` | String with escaped chars | `${esc:prefix\tmessage}` + @@ -1996,6 +2003,16 @@ expanded to last): `1.0` + `lightblue` +| `${date}` + + `${date:xxx}` + + (_WeeChat ≥ 1.3_) | + Current date/time, with custom format (see `man strftime`), + default format is `%F %T` | + `${date}` + + `${date:%H:%M:%S}` | + `2015-06-30 19:02:45` + + `19:02:45` + | `${env:NAME}` + (_WeeChat ≥ 1.2_) | Value of the environment variable `NAME` | diff --git a/doc/fr/autogen/user/weechat_commands.asciidoc b/doc/fr/autogen/user/weechat_commands.asciidoc index 967e4b2ba..c5aca48ca 100644 --- a/doc/fr/autogen/user/weechat_commands.asciidoc +++ b/doc/fr/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque "50" > "100" ==> 1 Des variables sont remplacées dans l'expression, en utilisant le format ${variable}, la variable pouvant être, par ordre de priorité : - 1. une chaîne avec les caractères échappés (format : "esc:xxx" ou "\xxx") - 2. une chaîne avec des caractères à cacher (format : "hide:caractère,chaîne") - 3. une couleur (format : "color:xxx") - 4. une info (format : "info:nom,paramètres", les paramètres sont optionnels) - 5. une variable d'environnement (format : "env:XXX") - 6. une option (format : "fichier.section.option") - 7. une variable locale du tampon - 8. 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. + 1. une sous-chaîne évaluée (format : "eval:xxx") + 2. une chaîne avec les caractères échappés (format : "esc:xxx" ou "\xxx") + 3. une chaîne avec des caractères à cacher (format : "hide:caractère,chaîne") + 4. une couleur (format : "color:xxx") + 5. une info (format : "info:nom,paramètres", les paramètres sont optionnels) + 6. la date/heure courante (format : "date" ou "date:format") + 7. une variable d'environnement (format : "env:XXX") + 8. une option (format : "fichier.section.option") + 9. une variable locale du tampon + 10. 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 : @@ -303,6 +305,7 @@ Exemples (chaînes simples) : /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Exemples (conditions) : /eval -n -c ${window.buffer.number} > 2 ==> 0 diff --git a/doc/fr/weechat_plugin_api.fr.asciidoc b/doc/fr/weechat_plugin_api.fr.asciidoc index 026c1da74..8baf089d8 100644 --- a/doc/fr/weechat_plugin_api.fr.asciidoc +++ b/doc/fr/weechat_plugin_api.fr.asciidoc @@ -1935,7 +1935,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" ==== string_eval_expression -_WeeChat ≥ 0.4.0, mis à jour dans la 0.4.2 et 1.1._ +_WeeChat ≥ 0.4.0, mis à jour dans la 0.4.2, 1.0, 1.1, 1.2 et 1.3._ É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 @@ -1993,13 +1993,20 @@ Valeur de retour : Liste des variables étendues dans l'expression (par ordre de priorité, de la première étendue à la dernière) : -[width="100%",cols="2,8,3,3",options="header"] +[width="100%",cols="2,8,4,4",options="header"] |=== | Format | Description | Exemples | Résultats | `${nom}` | Variable `nom` de la table de hachage 'extra_vars' | `${nom}` | `valeur` +| `${eval:xxx}` + + (_WeeChat ≥ 1.3_) | + Chaîne à évaluer | + `${eval:${date:${weechat.look.buffer_time_format}}}` | + `19:02:45` (avec des couleurs s'il y a des codes couleur dans l'option + weechat.look.buffer_time_format) + | `${esc:xxx}` + `${\xxx}` | Chaîne avec caractères échappés | `${esc:préfixe\tmessage}` + @@ -2036,6 +2043,16 @@ première étendue à la dernière) : `1.0` + `lightblue` +| `${date}` + + `${date:xxx}` + + (_WeeChat ≥ 1.3_) | + La date/heure courante, avec un format personnalisé (voir `man strftime`), + le format par défaut est `%F %T` | + `${date}` + + `${date:%H:%M:%S}` | + `2015-06-30 19:02:45` + + `19:02:45` + | `${env:NOM}` + (_WeeChat ≥ 1.2_) | Valeur de la variable d'environnement `NOM` | diff --git a/doc/it/autogen/user/weechat_commands.asciidoc b/doc/it/autogen/user/weechat_commands.asciidoc index 6933ccffa..f416f591e 100644 --- a/doc/it/autogen/user/weechat_commands.asciidoc +++ b/doc/it/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: - 1. a string with escaped chars (format: "esc:xxx" or "\xxx") - 2. a string with chars to hide (format: "hide:char,string") - 3. a color (format: "color:xxx") - 4. an info (format: "info:name,arguments", arguments are optional) - 5. an environment variable (format: "env:XXX") - 6. an option (format: "file.section.option") - 7. a local variable in buffer - 8. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 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 color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. 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: @@ -303,6 +305,7 @@ Examples (simple strings): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Examples (conditions): /eval -n -c ${window.buffer.number} > 2 ==> 0 diff --git a/doc/it/weechat_plugin_api.it.asciidoc b/doc/it/weechat_plugin_api.it.asciidoc index 9cbac6eca..9f148893f 100644 --- a/doc/it/weechat_plugin_api.it.asciidoc +++ b/doc/it/weechat_plugin_api.it.asciidoc @@ -1967,7 +1967,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" ==== string_eval_expression // TRANSLATION MISSING -_WeeChat ≥ 0.4.0, updated in 0.4.2 and 1.1._ +_WeeChat ≥ 0.4.0, updated in 0.4.2, 1.0, 1.1, 1.2 and 1.3._ // TRANSLATION MISSING Evaluate an expression and return result as a string. @@ -2025,13 +2025,21 @@ List of variables expanded in expression (by order of priority, from first expanded to last): // TRANSLATION MISSING -[width="100%",cols="2,8,3,3",options="header"] +[width="100%",cols="2,8,4,4",options="header"] |=== | Format | Description | Examples | Results | `${name}` | Variable `name` from hashtable 'extra_vars' | `${name}` | `value` +// TRANSLATION MISSING +| `${eval:xxx}` + + (_WeeChat ≥ 1.3_) | + String to evaluate | + `${eval:${date:${weechat.look.buffer_time_format}}}` | + `19:02:45` (with colors if there are color codes in the option + weechat.look.buffer_time_format) + | `${esc:xxx}` + `${\xxx}` | String with escaped chars | `${esc:prefix\tmessage}` + @@ -2067,6 +2075,17 @@ expanded to last): `1.0` + `lightblue` +// TRANSLATION MISSING +| `${date}` + + `${date:xxx}` + + (_WeeChat ≥ 1.3_) | + Current date/time, with custom format (see `man strftime`), + default format is `%F %T` | + `${date}` + + `${date:%H:%M:%S}` | + `2015-06-30 19:02:45` + + `19:02:45` + | `${env:NAME}` + (_WeeChat ≥ 1.2_) | Value of the environment variable `NAME` | diff --git a/doc/ja/autogen/user/weechat_commands.asciidoc b/doc/ja/autogen/user/weechat_commands.asciidoc index b72545ef6..ab7ab3d0d 100644 --- a/doc/ja/autogen/user/weechat_commands.asciidoc +++ b/doc/ja/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: - 1. a string with escaped chars (format: "esc:xxx" or "\xxx") - 2. a string with chars to hide (format: "hide:char,string") - 3. a color (format: "color:xxx") - 4. an info (format: "info:name,arguments", arguments are optional) - 5. an environment variable (format: "env:XXX") - 6. an option (format: "file.section.option") - 7. a local variable in buffer - 8. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 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 color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. 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: @@ -303,6 +305,7 @@ Examples (simple strings): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Examples (conditions): /eval -n -c ${window.buffer.number} > 2 ==> 0 diff --git a/doc/ja/weechat_plugin_api.ja.asciidoc b/doc/ja/weechat_plugin_api.ja.asciidoc index 091018eba..66035ba09 100644 --- a/doc/ja/weechat_plugin_api.ja.asciidoc +++ b/doc/ja/weechat_plugin_api.ja.asciidoc @@ -1906,7 +1906,8 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" ==== string_eval_expression -_WeeChat バージョン 0.4.0 以上で利用可、バージョン 0.4.2 と 1.1 で更新。_ +// TRANSLATION MISSING +_WeeChat ≥ 0.4.0, updated in 0.4.2, 1.0, 1.1, 1.2 and 1.3._ 式を評価して文字列として返す。`${variable}` という書式で書かれた特殊変数は展開されます (以下の表を参照)。 @@ -1958,13 +1959,21 @@ char *weechat_string_eval_expression (const char *expr, 式中で展開される変数のリスト (優先度の高い順、展開順の早いものを上に遅いものを下に): -[width="100%",cols="2,8,3,3",options="header"] +[width="100%",cols="2,8,4,4",options="header"] |=== | フォーマット | 説明 | 例 | 結果 | `${name}` | 'extra_vars' の変数 `name` の値に展開 | `${name}` | `value` +// TRANSLATION MISSING +| `${eval:xxx}` + + (_WeeChat ≥ 1.3_) | + String to evaluate | + `${eval:${date:${weechat.look.buffer_time_format}}}` | + `19:02:45` (with colors if there are color codes in the option + weechat.look.buffer_time_format) + | `${esc:xxx}` + `${\xxx}` | エスケープ文字を含む文字列 | `${esc:prefix\tmessage}` + @@ -2000,6 +2009,17 @@ char *weechat_string_eval_expression (const char *expr, `1.0` + `lightblue` +// TRANSLATION MISSING +| `${date}` + + `${date:xxx}` + + (_WeeChat ≥ 1.3_) | + Current date/time, with custom format (see `man strftime`), + default format is `%F %T` | + `${date}` + + `${date:%H:%M:%S}` | + `2015-06-30 19:02:45` + + `19:02:45` + | `${env:NAME}` + (_WeeChat バージョン 1.2 以上で利用可_) | Value of the environment variable `NAME` | diff --git a/doc/pl/autogen/user/weechat_commands.asciidoc b/doc/pl/autogen/user/weechat_commands.asciidoc index 0d2c93511..65ee1af9b 100644 --- a/doc/pl/autogen/user/weechat_commands.asciidoc +++ b/doc/pl/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: - 1. a string with escaped chars (format: "esc:xxx" or "\xxx") - 2. a string with chars to hide (format: "hide:char,string") - 3. a color (format: "color:xxx") - 4. an info (format: "info:name,arguments", arguments are optional) - 5. an environment variable (format: "env:XXX") - 6. an option (format: "file.section.option") - 7. a local variable in buffer - 8. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 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 color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. 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: @@ -303,6 +305,7 @@ Examples (simple strings): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Examples (conditions): /eval -n -c ${window.buffer.number} > 2 ==> 0 |