core: add repeat of string in evaluation of expressions with "repeat:count,string" (closes #958)

v2.8-utf8proc
Sébastien Helleu 2018-10-09 21:12:02 +02:00
parent 82697714e1
commit 8da3458f4c
30 changed files with 515 additions and 337 deletions

View File

@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add repeat of string in evaluation of expressions with "repeat:count,string" (issue #958)
* core: allow specifying buffer number/name for /buffer localvar (issue #1259)
* core: allow multiple arguments in command /buffer close
* core: allow multiple options "-r" ("--run-command") in command line arguments (issue #1248)

View File

@ -261,64 +261,65 @@ 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, nicht leer und von "0" abweichend ist.
Für einen Vergleich werden Fließkommazahlen genutzt sofern es sich bei beiden Ausdrücken um gültige Nummer handelt, die folgendes Format haben müssen:
- Integer (Beispiele: 5, -7)
- Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2)
- hexadezimale Zahl (Beispiele: 0xA3, -0xA3)
Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel:
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
- integer (examples: 5, -7)
- floating point number (examples: 5.2, -7.5, 2.83e-2)
- hexadecimal number (examples: 0xA3, -0xA3)
To force a string comparison, you can add double quotes around each expression, for example:
50 > 100 ==> 0
"50" > "100" ==> 1
Einige Variablen werden im Ausdruck, mittels der Formatierung ${Variable}, ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität:
1. eine evaluierte Teilzeichenkette (Format: "eval:xxx")
2. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx")
3. Zeichen 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. Ende einer Zeichenkette nutzen (Format: "rev:xxx")
6. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")
7. eine Info (Format: "info:Name,Argumente", Argumente sind optional)
8. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
9. eine Umgebungsvariable (Format: "env:XXX")
10. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
11. eine Option (Format: "file.section.option")
12. der Name einer lokalen Variablen eines Buffer
13. 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 reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
7. a color (format: "color:xxx", see "Plugin API reference", function "color")
8. an info (format: "info:name,arguments", arguments are optional)
9. current date/time (format: "date" or "date:format")
10. an environment variable (format: "env:XXX")
11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
12. an option (format: "file.section.option")
13. a local variable in buffer
14. 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
/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
@ -329,17 +330,19 @@ Beispiele (einfache Zeichenketten):
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
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
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
----
[[command_weechat_filter]]

View File

@ -297,14 +297,15 @@ Some variables are replaced in expression, using the format ${variable}, variabl
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 reversed string (format: "rev:xxx")
6. a color (format: "color:xxx", see "Plugin API reference", function "color")
7. an info (format: "info:name,arguments", arguments are optional)
8. current date/time (format: "date" or "date:format")
9. an environment variable (format: "env:XXX")
10. a ternary operator (format: "if:condition?value_if_true:value_if_false")
11. an option (format: "file.section.option")
12. a local variable in buffer
13. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a repeated string (format: "repeat:count,string")
7. a color (format: "color:xxx", see "Plugin API reference", function "color")
8. an info (format: "info:name,arguments", arguments are optional)
9. current date/time (format: "date" or "date:format")
10. an environment variable (format: "env:XXX")
11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
12. an option (format: "file.section.option")
13. a local variable in buffer
14. 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:
@ -329,6 +330,8 @@ Examples (simple strings):
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2294,6 +2294,12 @@ expanded to last):
`+${rev:Hello, world!}+` |
`+!dlrow ,olleH+`
| `+${repeat:count,string}+` +
(_WeeChat ≥ 2.3_) |
Repeated string. |
`+${repeat:5,-}+` |
`+-----+`
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Regex captured group: `0` = whole string matching, `1` to `99` = group

View File

@ -297,14 +297,15 @@ Des variables sont remplacées dans l'expression, en utilisant le format ${varia
4. une chaîne avec un maximum de caractères (format : "cut:max,suffixe,chaîne" ou "cut:+max,suffixe,chaîne")
ou un maximum de caractères affichés à l'écran (format : "cutscr:max,suffixe,chaîne" ou "cutscr:+max,suffixe,chaîne")
5. une chaîne inversée (format : "rev:xxx")
6. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
7. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
8. la date/heure courante (format : "date" ou "date:format")
9. une variable d'environnement (format : "env:XXX")
10. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
11. une option (format : "fichier.section.option")
12. une variable locale du tampon
13. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants.
6. une chaîne répétée (format : "repeat:nombre,chaîne")
7. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
8. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
9. la date/heure courante (format : "date" ou "date:format")
10. une variable d'environnement (format : "env:XXX")
11. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
12. une option (format : "fichier.section.option")
13. une variable locale du tampon
14. 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 :
@ -329,6 +330,8 @@ Exemples (chaînes simples) :
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
Exemples (conditions) :
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2337,6 +2337,12 @@ première étendue à la dernière) :
`+${rev:Bonjour !}+` |
`+! ruojnoB+`
| `+${repeat:nombre,chaîne}+` +
(_WeeChat ≥ 2.3_) |
Chaîne répétée. |
`+${repeat:5,-}+` |
`+-----+`
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Groupe regex capturé : `0` = toute la chaîne correspondante,

View File

@ -297,14 +297,15 @@ Some variables are replaced in expression, using the format ${variable}, variabl
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 reversed string (format: "rev:xxx")
6. a color (format: "color:xxx", see "Plugin API reference", function "color")
7. an info (format: "info:name,arguments", arguments are optional)
8. current date/time (format: "date" or "date:format")
9. an environment variable (format: "env:XXX")
10. a ternary operator (format: "if:condition?value_if_true:value_if_false")
11. an option (format: "file.section.option")
12. a local variable in buffer
13. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
6. a repeated string (format: "repeat:count,string")
7. a color (format: "color:xxx", see "Plugin API reference", function "color")
8. an info (format: "info:name,arguments", arguments are optional)
9. current date/time (format: "date" or "date:format")
10. an environment variable (format: "env:XXX")
11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
12. an option (format: "file.section.option")
13. a local variable in buffer
14. 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:
@ -329,6 +330,8 @@ Examples (simple strings):
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2387,6 +2387,12 @@ expanded to last):
`+${rev:Hello, world!}+` |
`+!dlrow ,olleH+`
| `+${repeat:count,string}+` +
(_WeeChat ≥ 2.3_) |
Repeated string. |
`+${repeat:5,-}+` |
`+-----+`
| `+${re:N}+` +
(_WeeChat ≥ 1.1_) |
Regex captured group: `0` = whole string matching, `1` to `99` = group

View File

@ -261,60 +261,61 @@ 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" でない場合、式は "真" と評価されます。
浮動小数点数として比較される数値表現の書式は以下です:
- 整数 (例: 5、-7)
- 浮動小数点数 (例: 5.2、-7.5、2.83e-2)
- 16 進数 (例: 0xA3、-0xA3)
数値表現を二重引用符で括ることで、文字列として比較されます。例:
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. 文字順を反転させた文字列 (書式: "rev:xxx")
6. 色 (書式: "color:xxx"、"プラグイン API リファレンス" の "color" 関数を参照してください)
7. 情報 (書式: "info:name,arguments"、arguments は任意)
8. 現在の日付/時刻 (書式: "date" または "date:format")
9. 環境変数 (書式: "env:XXX")
10. 三項演算子 (書式: "if:condition?value_if_true:value_if_false")
11. オプション (書式: "file.section.option")
12. バッファのローカル変数
13. 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 reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
7. a color (format: "color:xxx", see "Plugin API reference", function "color")
8. an info (format: "info:name,arguments", arguments are optional)
9. current date/time (format: "date" or "date:format")
10. an environment variable (format: "env:XXX")
11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
12. an option (format: "file.section.option")
13. a local variable in buffer
14. 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
@ -329,8 +330,10 @@ hdata と変数の名前については、"プラグイン API リファレン
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
例 (条件):
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

@ -2298,6 +2298,13 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
`+${rev:Hello, world!}+` |
`+!dlrow ,olleH+`
// TRANSLATION MISSING
| `+${repeat:count,string}+` +
(_WeeChat ≥ 2.3_) |
Repeated string. |
`+${repeat:5,-}+` |
`+-----+`
| `+${re:N}+` +
(_WeeChat バージョン 1.1 以上で利用可_) |
正規表現のキャプチャグループ: `0` = マッチするすべての文字列、`1` から `99` =

View File

@ -261,64 +261,65 @@ 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 wyraż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 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:
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. odwrócony ciąg (format: "rev:xxx")
6. kolor (format "color:xxx", zobacz „Opis API wtyczek”, funkcja "color")
7. informacja (format: "info:nazwa,argumenty", argumenty są opcjonalne)
8. obecna data/czas (format: "date" lub "date:format")
9. zmienna środowiskowa (format: "env:XXX")
10. wyrażenie warunkowe (format: "if:condition?value_if_true:value_if_false")
11. opcja (format: plik.sekcja.opcja)
12. zmienna lokalna w buforze
13. 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".
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 reversed string (format: "rev:xxx")
6. a repeated string (format: "repeat:count,string")
7. a color (format: "color:xxx", see "Plugin API reference", function "color")
8. an info (format: "info:name,arguments", arguments are optional)
9. current date/time (format: "date" or "date:format")
10. an environment variable (format: "env:XXX")
11. a ternary operator (format: "if:condition?value_if_true:value_if_false")
12. an option (format: "file.section.option")
13. a local variable in buffer
14. 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
/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
@ -329,8 +330,10 @@ Przykłady (proste ciągi):
/eval -n ${cut:+3,+,test} ==> te+
/eval -n ${date:%H:%M:%S} ==> 07:46:40
/eval -n ${if:${info:term_width}>80?big:small} ==> big
/eval -n ${rev:Hello} ==> olleH
/eval -n ${repeat:5,-} ==> -----
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,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1538,16 +1538,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1580,6 +1581,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-10-08 21:04+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1612,6 +1612,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 "
@ -1658,16 +1659,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1700,6 +1702,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1569,16 +1569,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1611,6 +1612,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"PO-Revision-Date: 2018-10-06 07:11+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-10-09 19:30+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -1626,16 +1626,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1668,6 +1669,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"
@ -1731,17 +1734,18 @@ msgstr ""
" ou un maximum de caractères affichés à l'écran (format : \"cutscr:max,"
"suffixe,chaîne\" ou \"cutscr:+max,suffixe,chaîne\")\n"
" 5. une chaîne inversée (format : \"rev:xxx\")\n"
" 6. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
" 6. une chaîne répétée (format : \"repeat:nombre,chaîne\")\n"
" 7. une couleur (format : \"color:xxx\", voir la \"Référence API extension"
"\", fonction \"color\")\n"
" 7. une info (format : \"info:nom,paramètres\", les paramètres sont "
" 8. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
" 8. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 9. une variable d'environnement (format : \"env:XXX\")\n"
" 10. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
" 9. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 10. une variable d'environnement (format : \"env:XXX\")\n"
" 11. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
"valeur_si_faux\")\n"
" 11. une option (format : \"fichier.section.option\")\n"
" 12. une variable locale du tampon\n"
" 13. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
" 12. une option (format : \"fichier.section.option\")\n"
" 13. une variable locale du tampon\n"
" 14. 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"
@ -1776,6 +1780,8 @@ msgstr ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Exemples (conditions) :\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1457,16 +1457,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1499,6 +1500,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1552,16 +1552,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1594,6 +1595,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-09-30 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -1550,6 +1550,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 "
@ -1596,16 +1597,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1638,6 +1640,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-09-09 10:05+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <soltys1@gmail.com>\n"
@ -1580,6 +1580,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 "
@ -1626,16 +1627,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1668,6 +1670,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -1609,16 +1609,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1651,6 +1652,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\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: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:37+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1614,16 +1614,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1656,6 +1657,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\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: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+0200\n"
"PO-Revision-Date: 2018-03-31 15:37+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1479,16 +1479,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1521,6 +1522,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+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"
@ -1312,16 +1312,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1354,6 +1355,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\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: 2018-10-06 07:10+0200\n"
"POT-Creation-Date: 2018-10-09 19:28+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"
@ -1314,16 +1314,17 @@ msgid ""
" or max chars displayed on screen (format: \"cutscr:max,suffix,string\" "
"or \"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API reference\", function "
"\"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 8. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted to "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted to "
"string), by default \"window\" and \"buffer\" point to current window/"
"buffer.\n"
"Format for hdata can be one of following:\n"
@ -1356,6 +1357,8 @@ msgid ""
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -7404,17 +7404,18 @@ command_init ()
"(format: \"cutscr:max,suffix,string\" or "
"\"cutscr:+max,suffix,string\")\n"
" 5. a reversed string (format: \"rev:xxx\")\n"
" 6. a color (format: \"color:xxx\", see \"Plugin API "
" 6. a repeated string (format: \"repeat:count,string\")\n"
" 7. a color (format: \"color:xxx\", see \"Plugin API "
"reference\", function \"color\")\n"
" 7. an info (format: \"info:name,arguments\", arguments are "
" 8. an info (format: \"info:name,arguments\", arguments are "
"optional)\n"
" 8. current date/time (format: \"date\" or \"date:format\")\n"
" 9. an environment variable (format: \"env:XXX\")\n"
" 10. a ternary operator (format: "
" 9. current date/time (format: \"date\" or \"date:format\")\n"
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: "
"\"if:condition?value_if_true:value_if_false\")\n"
" 11. an option (format: \"file.section.option\")\n"
" 12. a local variable in buffer\n"
" 13. a hdata name/variable (the value is automatically converted "
" 12. an option (format: \"file.section.option\")\n"
" 13. a local variable in buffer\n"
" 14. a hdata name/variable (the value is automatically converted "
"to string), by default \"window\" and \"buffer\" point to current "
"window/buffer.\n"
"Format for hdata can be one of following:\n"
@ -7448,6 +7449,8 @@ command_init ()
" /eval -n ${cut:+3,+,test} ==> te+\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -294,15 +294,16 @@ end:
* cut:+max,suffix,string) or max chars on screen
* (format: cutscr:max,suffix,string or cutscr:+max,suffix,string)
* 6. a reversed string (format: rev:xxx)
* 7. a regex group captured (format: re:N (0.99) or re:+)
* 8. a color (format: color:xxx)
* 9. an info (format: info:name,arguments)
* 10. current date/time (format: date or date:xxx)
* 11. an environment variable (format: env:XXX)
* 12. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 13. an option (format: file.section.option)
* 14. a buffer local variable
* 15. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* 7. a repeated string (format: repeat:count,string)
* 8. a regex group captured (format: re:N (0.99) or re:+)
* 9. a color (format: color:xxx)
* 10. an info (format: info:name,arguments)
* 11. current date/time (format: date or date:xxx)
* 12. an environment variable (format: env:XXX)
* 13. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 14. an option (format: file.section.option)
* 15. a buffer local variable
* 16. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* or hdata[ptr].var1.var2)
*
* See /help in WeeChat for examples.
@ -456,7 +457,26 @@ eval_replace_vars_cb (void *data, const char *text)
return string_reverse (text + 4);
}
/* 7. regex group captured */
/* 7. repeated string */
if (strncmp (text, "repeat:", 7) == 0)
{
pos = strchr (text + 7, ',');
if (!pos)
return strdup ("");
tmp = strndup (text + 7, pos - text - 7);
if (!tmp)
return strdup ("");
number = strtol (tmp, &error, 10);
if (!error || error[0] || (number < 0))
{
free (tmp);
return strdup ("");
}
free (tmp);
return string_repeat (pos + 1, number);
}
/* 8. regex group captured */
if (strncmp (text, "re:", 3) == 0)
{
if (eval_context->regex && eval_context->regex->result)
@ -487,7 +507,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ("");
}
/* 8. color code */
/* 9. color code */
if (strncmp (text, "color:", 6) == 0)
{
ptr_value = gui_color_search_config (text + 6);
@ -497,7 +517,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ((ptr_value) ? ptr_value : "");
}
/* 9. info */
/* 10. info */
if (strncmp (text, "info:", 5) == 0)
{
ptr_value = NULL;
@ -517,7 +537,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ((ptr_value) ? ptr_value : "");
}
/* 10. current date/time */
/* 11. current date/time */
if ((strncmp (text, "date", 4) == 0) && (!text[4] || (text[4] == ':')))
{
date = time (NULL);
@ -530,7 +550,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup ((rc > 0) ? str_value : "");
}
/* 11. environment variable */
/* 12. environment variable */
if (strncmp (text, "env:", 4) == 0)
{
ptr_value = getenv (text + 4);
@ -538,7 +558,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 12: ternary operator: if:condition?value_if_true:value_if_false */
/* 13: ternary operator: if:condition?value_if_true:value_if_false */
if (strncmp (text, "if:", 3) == 0)
{
value = NULL;
@ -605,7 +625,7 @@ eval_replace_vars_cb (void *data, const char *text)
return (value) ? value : strdup ("");
}
/* 13. option: if found, return this value */
/* 14. option: if found, return this value */
if (strncmp (text, "sec.data.", 9) == 0)
{
ptr_value = hashtable_get (secure_hashtable_data, text + 9);
@ -638,7 +658,7 @@ eval_replace_vars_cb (void *data, const char *text)
}
}
/* 14. local variable in buffer */
/* 15. local variable in buffer */
ptr_buffer = hashtable_get (eval_context->pointers, "buffer");
if (ptr_buffer)
{
@ -647,7 +667,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 15. hdata */
/* 16. hdata */
value = NULL;
hdata_name = NULL;
list_name = NULL;

View File

@ -202,6 +202,45 @@ string_reverse (const char *string)
return result;
}
/*
* Repeats a string a given number of times.
*
* Note: result must be freed after use.
*/
char *
string_repeat (const char *string, int count)
{
int length_string, length_result, i;
char *result;
if (!string)
return NULL;
if (!string[0] || (count <= 0))
return strdup ("");
if (count == 1)
return strdup (string);
length_string = strlen (string);
length_result = (length_string * count) + 1;
result = malloc (length_result);
if (!result)
return NULL;
i = 0;
while (count > 0)
{
memcpy (result + i, string, length_string);
count--;
i += length_string;
}
result[length_result - 1] = '\0';
return result;
}
/*
* Converts string to lower case (locale independent).
*/

View File

@ -40,6 +40,7 @@ extern char *string_strndup (const char *string, int length);
extern char *string_cut (const char *string, int length, int count_suffix,
int screen, const char *cut_suffix);
extern char *string_reverse (const char *string);
extern char *string_repeat (const char *string, int count);
extern void string_tolower (char *string);
extern void string_toupper (char *string);
extern int string_strcasecmp (const char *string1, const char *string2);

View File

@ -351,6 +351,14 @@ TEST(CoreEval, EvalExpression)
WEE_CHECK_EVAL("!dlrow ,olleH", "${rev:Hello, world!}");
WEE_CHECK_EVAL("界世はちにんこ", "${rev:こんにちは世界}");
/* test repeat of string */
WEE_CHECK_EVAL("", "${repeat:-1,x}");
WEE_CHECK_EVAL("", "${repeat:0,x}");
WEE_CHECK_EVAL("x", "${repeat:1,x}");
WEE_CHECK_EVAL("xxxxx", "${repeat:5,x}");
WEE_CHECK_EVAL("cbacbacba", "${repeat:3,${rev:abc}}");
WEE_CHECK_EVAL("cbacba", "${repeat:${rev:20},${rev:abc}}");
/* test color */
WEE_CHECK_EVAL(gui_color_get_custom ("green"), "${color:green}");
WEE_CHECK_EVAL(gui_color_get_custom ("*214"), "${color:*214}");

View File

@ -292,6 +292,24 @@ TEST(CoreString, Reverse)
STRCMP_EQUAL("\xeblon", string_reverse ("no\xebl"));
}
/*
* Tests functions:
* string_repeat
*/
TEST(CoreString, Repeat)
{
POINTERS_EQUAL(NULL, string_repeat (NULL, 1));
STRCMP_EQUAL("", string_repeat ("", 1));
STRCMP_EQUAL("", string_repeat ("x", -1));
STRCMP_EQUAL("", string_repeat ("x", 0));
STRCMP_EQUAL("x", string_repeat ("x", 1));
STRCMP_EQUAL("xxx", string_repeat ("x", 3));
STRCMP_EQUAL("abcabc", string_repeat ("abc", 2));
STRCMP_EQUAL("noëlnoël", string_repeat ("noël", 2));
}
/*
* Tests functions:
* string_strcasecmp