From 5b3929b321a88fdb3402d69324a24ae0828bd2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 6 Sep 2021 13:32:04 +0200 Subject: api: add split of string and shell arguments in evaluation of expressions Split of string: ${split:number,separators,flags,xxx} Split of shell arguments: ${split_shell:number,xxx} --- doc/de/includes/autogen_user_commands.de.adoc | 286 +++++++++++---------- doc/en/includes/autogen_user_commands.en.adoc | 36 ++- doc/en/weechat_plugin_api.en.adoc | 50 ++++ doc/fr/includes/autogen_user_commands.fr.adoc | 36 ++- doc/fr/weechat_plugin_api.fr.adoc | 50 ++++ doc/it/includes/autogen_user_commands.it.adoc | 36 ++- doc/it/weechat_plugin_api.it.adoc | 50 ++++ doc/ja/includes/autogen_user_commands.ja.adoc | 36 ++- doc/ja/weechat_plugin_api.ja.adoc | 52 ++++ doc/pl/includes/autogen_user_commands.pl.adoc | 36 ++- .../includes/autogen_api_infos_hashtable.sr.adoc | 2 +- doc/sr/includes/autogen_user_commands.sr.adoc | 246 +++++++++--------- doc/sr/includes/autogen_user_options.sr.adoc | 18 +- doc/sr/weechat_plugin_api.sr.adoc | 52 ++++ 14 files changed, 655 insertions(+), 331 deletions(-) (limited to 'doc') diff --git a/doc/de/includes/autogen_user_commands.de.adoc b/doc/de/includes/autogen_user_commands.de.adoc index dfc396e08..17c1ee283 100644 --- a/doc/de/includes/autogen_user_commands.de.adoc +++ b/doc/de/includes/autogen_user_commands.de.adoc @@ -1337,83 +1337,85 @@ infolists: zeigt Information über die Infolists an /eval [-n|-s] [-d] [-n] [-d [-d]] -c - -n: gibt das Ergebnis aus, ohne dass dieses in den Buffer gesendet wird (debug Modus) - -s: teilt Ausdrücke, bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden) - -d: eine Debug-Ausgabe nach Auswertung anzeigen (Nutzung von zwei -d: ausführliche Debug-Ausgabe) - -c: Auswertung als Bedingung: nutzt Operatoren und runde Klammern, Rückgabewert als Boolean-Wert ("0" oder "1") -expression: Ausdruck welcher verarbeitet werden soll. Variablen im Format ${variable} werden ersetzt (siehe unten); mehrere Befehle werden durch ein Semikolon voneinander getrennt - operator: ein logischer oder vergleichender Operand: - - logische Operanden: - && boolean "und" - || boolean "oder" - - vergleichende Operanden: - == gleich - != ungleich - <= kleiner oder gleich - < kleiner - >= größer oder gleich - > größer - =~ stimmt mit regulärem POSIX Ausdruck überein - !~ stimmt NICHT mit regulärem POSIX Ausdruck überein - ==* stimmt mit Maske überein (Platzhalter "*" ist erlaubt) - !!* stimmt mit Maske NICHT überein (Platzhalter "*" ist erlaubt) - =* stimmt mit Maske überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt) - !* stimmt mit Maske NICHT überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt) - ==- ist enthalten, Groß- und Kleinschreibung wird beachtet - !!- ist NICHT enthalten, Groß- und Kleinschreibung wird beachtet - =- ist enthalten, Groß- und Kleinschreibung wird nicht beachtet - !- ist NICHT enthalten, Groß- und Kleinschreibung wird nicht beachtet - -Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, nicht leer und von "0" abweichend ist. -Für einen Vergleich werden Fließkommazahlen genutzt, insofern es sich bei beiden Ausdrücken um gültige Zahlen handelt, folgende Formate werden unterstützt: - - Integer (Beispiele: 5, -7) - - Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2) - - hexadezimale Zahl (Beispiele: 0xA3, -0xA3) -Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel: + -n: display result without sending it to buffer (debug mode) + -s: split expression before evaluating it (many commands can be separated by semicolons) + -d: display debug output after evaluation (with two -d: more verbose debug) + -c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1") +expression: expression to evaluate, variables with format ${variable} are replaced (see below); many commands can be separated by semicolons + operator: a logical or comparison operator: + - logical operators: + && boolean "and" + || boolean "or" + - comparison operators: + == equal + != not equal + <= less or equal + < less + >= greater or equal + > greater + =~ is matching POSIX extended regex + !~ is NOT matching POSIX extended regex + ==* is matching mask, case sensitive (wildcard "*" is allowed) + !!* is NOT matching mask, case sensitive (wildcard "*" is allowed) + =* is matching mask, case insensitive (wildcard "*" is allowed) + !* is NOT matching mask, case insensitive (wildcard "*" is allowed) + ==- is included, case sensitive + !!- is NOT included, case sensitive + =- is included, case insensitive + !- is NOT included, case insensitive + +An expression is considered as "true" if it is not NULL, not empty, and different from "0". +The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats: + - integer (examples: 5, -7) + - floating point number (examples: 5.2, -7.5, 2.83e-2) + - hexadecimal number (examples: 0xA3, -0xA3) +To force a string comparison, you can add double quotes around each expression, for example: 50 > 100 ==> 0 "50" > "100" ==> 1 -Einige Variablen werden im Ausdruck mittels der Formatierung ${variable} ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität: - 1. die Zeichenfolge selbst ohne Auswertung (Format: "raw:xxx")\n - 2. eine evaluierte Teilzeichenkette (Format: "eval:xxx") - 3. eine evaluierte Bedingung (Format: "eval_cond:xxx") - 4. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx") - 5. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette") - 6. eine Zeichenkette mit einer maximalen Anzahl an Zeichen (Format: "cut:max,suffix,string" oder "cut:+max,suffix,string") - oder maximale Anzahl an Zeichen die auf dem Bildschirm angezeigt werden sollen (Format: "cutscr:Max,Suffix,Zeichenkette oder "cutscr:+Max,Suffix,Zeichenkette") - 7. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx") - 8. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette") - 9. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx") - 10. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color") - 11. zum modifizieren (Format: "modifier:name,data,string") - 12. eine Info (Format: "Info:Name,Argumente", Argumente sind optional) - 13. eine Basis 16/32/64 kodierte / dekodierte Zeichenfolge (Format: "base_encode:base,xxx" oder "base_decode:base,xxx") - 14. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format") - 15. eine Umgebungsvariable (Format: "env:XXX") - 16. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr") - 17. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx") - 19. eine übersetzte Zeichenkette (Format: "translate:xxx") - 18. eine zufällige ganze Zahl (Format: "random:min,max") - 20. eine Option (Format: "file.section.option") - 21. eine lokale Variable eines Buffers - 22. ein(e) hdata - Name/Variable (der Wert wird automatisch in eine Zeichenkette konvertiert), standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet. -Das Format für hdata kann wie folgt aufgebaut sein: - hdata.var1.var2...: startet mit hdata (der Pointer muss bekannt sein) und fragt eine Variable nach der anderen ab (weitere hdata können folgen) - hdata[list].var1.var2...: startet hdata mittels einer Liste, zum Beispiel: - ${buffer[gui_buffers].full_name}: der vollständige Name des ersten Buffers, in der verknüpften Liste aller Buffer - ${plugin[weechat_plugins].name}: Name der ersten Erweiterung, in der verknüpften Liste aller Erweiterungen - hdata[pointer].var1.var2...: startet hdata mittels einem Pointer, zum Beispiel: - ${buffer[0x1234abcd].full_name}: vollständiger Name eines Buffers und des dazugehörigen Pointers (kann in triggern benutzt werden) - ${buffer[my_pointer].full_name}: vollständiger Name des Buffers mit dem entsprechenden Pointernamen (kann in Triggern verwendet werden) -Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben - -Beispiele (einfache Zeichenketten): +Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: + 1. the string itself without evaluation (format: "raw:xxx") + 2. an evaluated sub-string (format: "eval:xxx") + 3. an evaluated condition (format: "eval_cond:xxx") + 4. a string with escaped chars (format: "esc:xxx" or "\xxx") + 5. a string with chars to hide (format: "hide:char,string") + 6. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string") + or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string") + 7. a reversed string (format: "rev:xxx" or "revscr:xxx") + 8. a repeated string (format: "repeat:count,string") + 9. length of a string (format: "length:xxx" or "lengthscr:xxx") + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. +Format for hdata can be one of following: + hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) + hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: + ${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers + ${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins + hdata[pointer].var1.var2...: start with a hdata using a pointer, for example: + ${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers) + ${buffer[my_pointer].full_name}: full name of the buffer with this pointer name (can be used in triggers) +For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". + +Examples (simple strings): /eval -n ${raw:${info:version}} ==> ${info:version} /eval -n ${eval_cond:${window.win_width}>100} ==> 1 /eval -n ${info:version} ==> 0.4.3 /eval -n ${env:HOME} ==> /home/user /eval -n ${weechat.look.scroll_amount} ==> 3 - /eval -n ${sec.data.password} ==> geheim + /eval -n ${sec.data.password} ==> secret /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 /eval -n ${window.buffer.full_name} ==> core.weechat @@ -1427,23 +1429,31 @@ Beispiele (einfache Zeichenketten): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== /eval -n ${base_decode:64,dGVzdA==} ==> test - /eval -n ${translate:Plugin} ==> Erweiterung + /eval -n ${translate:Plugin} ==> Extension -Beispiele (Bedingungen): - /eval -n -c ${window.buffer.number} > 2 ==> 0 - /eval -n -c ${window.win_width} > 100 ==> 1 - /eval -n -c (8 > 12) || (5 > 2) ==> 1 - /eval -n -c (8 > 12) && (5 > 2) ==> 0 - /eval -n -c abcd =~ ^ABC ==> 1 - /eval -n -c abcd =~ (?-i)^ABC ==> 0 - /eval -n -c abcd =~ (?-i)^abc ==> 1 - /eval -n -c abcd !~ abc ==> 0 - /eval -n -c abcd =* a*d ==> 1 - /eval -n -c abcd =- bc ==> 1 +Examples (conditions): + /eval -n -c ${window.buffer.number} > 2 ==> 0 + /eval -n -c ${window.win_width} > 100 ==> 1 + /eval -n -c (8 > 12) || (5 > 2) ==> 1 + /eval -n -c (8 > 12) && (5 > 2) ==> 0 + /eval -n -c abcd =~ ^ABC ==> 1 + /eval -n -c abcd =~ (?-i)^ABC ==> 0 + /eval -n -c abcd =~ (?-i)^abc ==> 1 + /eval -n -c abcd !~ abc ==> 0 + /eval -n -c abcd =* a*d ==> 1 + /eval -n -c abcd =- bc ==> 1 ---- [[command_weechat_filter]] @@ -1545,63 +1555,63 @@ value: Anzahl der gewünschten Einträgen im Befehlsverlauf anzeigen ---- /input [] -list of actions: - return: simulate key "enter" - complete_next: complete word with next completion - complete_previous: complete word with previous completion - search_text_here: search text in buffer at current position - search_text: search text in buffer - search_switch_case: switch exact case for search - search_switch_regex: switch search type: string/regular expression - search_switch_where: switch search in messages/prefixes - search_previous: search previous line - search_next: search next line - search_stop_here: stop search at current position - search_stop: stop search - delete_previous_char: delete previous char - delete_next_char: delete next char - delete_previous_word: delete previous word - delete_next_word: delete next word - delete_beginning_of_line: delete from beginning of line until cursor - delete_end_of_line: delete from cursor until end of line - delete_line: delete entire line - clipboard_paste: paste from the internal clipboard - transpose_chars: transpose two chars - undo: undo last command line action - redo: redo last command line action - move_beginning_of_line: move cursor to beginning of line - move_end_of_line: move cursor to end of line - move_previous_char: move cursor to previous char - move_next_char: move cursor to next char - move_previous_word: move cursor to previous word - move_next_word: move cursor to next word - history_previous: recall previous command in current buffer history - history_next: recall next command in current buffer history - history_global_previous: recall previous command in global history - history_global_next: recall next command in global history - jump_smart: jump to next buffer with activity - jump_last_buffer_displayed: jump to last buffer displayed (before last jump to a buffer) - jump_previously_visited_buffer: jump to previously visited buffer - jump_next_visited_buffer: jump to next visited buffer - hotlist_clear: clear hotlist (optional argument: "lowest" to clear only lowest level in hotlist, "highest" to clear only highest level in hotlist, or level mask: integer which is a combination of 1=join/part, 2=message, 4=private, 8=highlight) - hotlist_remove_buffer: remove current buffer from hotlist - hotlist_restore_buffer: restore latest hotlist removed in the current buffer - hotlist_restore_all: restore latest hotlist removed in all buffers - grab_key: grab a key (optional argument: delay for end of grab, default is 500 milliseconds) - grab_key_command: grab a key with its associated command (optional argument: delay for end of grab, default is 500 milliseconds) - grab_mouse: grab mouse event code - grab_mouse_area: grab mouse event code with area - set_unread: set unread marker for all buffers - set_unread_current_buffer: set unread marker for current buffer - switch_active_buffer: switch to next merged buffer - switch_active_buffer_previous: switch to previous merged buffer - zoom_merged_buffer: zoom on merged buffer - insert: insert text in command line (escaped chars are allowed, see /help print) - send: send text to the buffer - paste_start: start paste (bracketed paste mode) - paste_stop: stop paste (bracketed paste mode) - -This command is used by key bindings or plugins. +Auflistung der möglichen Aktionen: + return: simuliert die "enter" Taste + complete_next: vervollständigt Wort mit nächster Komplettierung + complete_previous: vervollständigt Word mit vorheriger Komplettierung + search_text_here: Textsuche ab aktueller Position + search_text: Textsuche im Buffer + search_switch_case: schaltet Groß-/Kleinschreibung ein und aus + search_switch_regex: Wechsel des Suchmodus: einfache Textsuche/reguläre Ausdrücke + search_switch_where: wechselt Suche in Nachricht/Präfix + search_previous: sucht vorheriger Zeile + search_next: sucht nächste Zeile + search_stop_here: beendet Suche ab aktueller Position + search_stop: suche beenden + delete_previous_char: entfernt vorheriges Zeichen + delete_next_char: entfernt nächstes Zeichen + delete_previous_word: entfernt vorheriges Wort + delete_next_word: entfernt nächstes Wort + delete_beginning_of_line: entfernt alle Zeichen ab Zeilenanfang bis zum Cursor + delete_end_of_line: entfernt alle Zeichen ab Cursor bis zum Ende der Zeile + delete_line: löscht die komplette Eingabezeile + clipboard_paste: fügt Zeichenkette aus der internen Zwischenablage ein + transpose_chars: Zeichen austauschen + undo: letzten Befehl in der Eingabezeile rückgängig machen + redo: letzten Befehl in der Eingabezeile wiederherstellen + move_beginning_of_line: springt an den Anfang der Eingabezeile + move_end_of_line: springt ans Ende der Eingabezeile + move_previous_char: setzt den Cursor eine Position nach links + move_next_char: setzt den Cursor eine Position nach rechts + move_previous_word: springt zum Anfang des vorherigen Wortes, in der Eingabezeile + move_next_word: springt zum Anfang des nächsten Wortes, in der Eingabezeile + history_previous: ruft vorherigen Befehl oder Nachricht aus dem Befehlsspeicher auf (im Such-Modus: rückwärts suchen) + history_next: ruft nächsten Befehl oder Nachricht aus dem Befehlsspeicher auf (im Such-Modus: vorwärts suchen) + history_global_previous: ruft vorherigen Befehl/Nachricht aus dem globalen Befehlsspeicher auf (für alle Buffer) + history_global_next: ruft nächsten Befehl/Nachricht aus dem globalen Befehlsspeicher auf (für alle Buffer) + jump_smart: wechselt zum nächsten Buffer mit Aktivität (nach Priorität: highlight, Nachricht, …) + jump_last_buffer_displayed: wechselt zum jeweils zuletzt angezeigten Buffer + jump_previously_visited_buffer: springt zum letzten besuchten Buffer + jump_next_visited_buffer: springt zum nächsten besuchten Buffer + hotlist_clear: löscht Hotlist (Aktivitätsanzeige für die Buffer), (optionales Argument: "lowest" löscht den niedrigsten Eintrag der Hotlist, "highest" löscht den höchsten Eintrag der Hotlist, oder eine integer Maske: eine Kombination aus 1=join/part, 2=Nachricht,4=privat,8=highlight) + hotlist_remove_buffer: entferne aktuellen Buffer von der Hotlist + hotlist_restore_buffer: Wiederherstellen der neuesten Hotlist, die im aktuellen Buffer entfernt wurde + hotlist_restore_all: Wiederherstellen der neuesten Hotlist, die in allen Buffern entfernt wurde + grab_key: fängt eine Taste (optionales Argument: Verzögerung um eine Taste einzufangen. Standard sind 500 Millisekunden) + grab_key_command: zeigt den Tastencode (inklusive des eingebundenen Befehls) einer Tastenkombination an und fügt ihn in die Befehlszeile ein (optionales Argument: Verzögerung um eine Taste einzufangen. Standard sind 500 Millisekunden) + grab_mouse: fängt den Code einer Maus Aktivität + grab_mouse_area: fängt den Code einer Maus Aktivität mit entsprechendem Bereich + set_unread: setzt für alle Buffer die Markierung der ungelesen Nachrichten + set_unread_current_buffer: setzt nur für den aktuellen Buffer eine Markierung der ungelesen Nachrichten + switch_active_buffer: springt zum nächsten zusammengefügten Buffer + switch_active_buffer_previous: springt zum vorherigen zusammengefügten Buffer + zoom_merged_buffer: zoomt in zusammengefügte Buffer + insert: fügt einen Text in die Eingabezeile ein (Escapesequenzen sind möglich, siehe /help print) + send: schickt Text an einen Buffer + paste_start: Einfügen wird gestartet (bracketed paste mode) + paste_stop: Einfügen wird beendet (bracketed paste mode) + +Dieser Befehl wird sinnvollerweise mittels Tastenbelegungen oder Erweiterungen genutzt. ---- [[command_weechat_key]] diff --git a/doc/en/includes/autogen_user_commands.en.adoc b/doc/en/includes/autogen_user_commands.en.adoc index b89cb4631..775bfd760 100644 --- a/doc/en/includes/autogen_user_commands.en.adoc +++ b/doc/en/includes/autogen_user_commands.en.adoc @@ -1384,19 +1384,21 @@ Some variables are replaced in expression, using the format ${variable}, variabl 7. a reversed string (format: "rev:xxx" or "revscr:xxx") 8. a repeated string (format: "repeat:count,string") 9. length of a string (format: "length:xxx" or "lengthscr:xxx") - 10. a color (format: "color:xxx", see "Plugin API reference", function "color") - 11. a modifier (format: "modifier:name,data,string") - 12. an info (format: "info:name,arguments", arguments are optional) - 13. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 14. current date/time (format: "date" or "date:format") - 15. an environment variable (format: "env:XXX") - 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 18. a random integer number (format: "random:min,max") - 19. a translated string (format: "translate:xxx") - 20. an option (format: "file.section.option") - 21. a local variable in buffer - 22. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: @@ -1427,6 +1429,14 @@ Examples (simple strings): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 085e0c845..b155422d4 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -2682,6 +2682,56 @@ expanded to last): `+4+` + `+14+` +| `+${split:number,seps,flags,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split string, and return, according to `number`: + + - `count`: the number of items after split + + - `random`: a random item + + - integer ≥ 1: the item by index (1 = first item) + + - integer ≤ -1: the item by index from the end (-1 = last item, -2 = penultimate item, etc.), + + `seps` is a list of chars that are used as separators (if empty, a comma is used), + + `flags` is a list of flags separated by `+`: + + - `strip_left`: strip separators on the left (beginning of string) + + - `strip_right`: strip separators on the right (end of string) + + - `collapse_seps`: collapse multiple consecutive separators into a single one + + - `keep_eol`: keep end of line for each value + + - `strip_items=xyz`: strip chars `x`, `y` and `z` from beginning/end of items + + - `max_items=N`: return max N items | + `+${split:1,,,abc,def,ghi}+` + + `+${split:-1,,,abc,def,ghi}+` + + `+${split:count,,,abc,def,ghi}+` + + `+${split:random,,,abc,def,ghi}+` + + `+${split:3,,collapse_seps,abc,,,def,,,ghi}+` + + `+${split:3,,strip_items=-_,_-abc-_,_-def-_,_-ghi-_}+` + + `+${split:2, ,,this is a test}+` + + `+${split:2, ,strip_left+strip_right, this is a test }+` + + `+${split:2, ,keep_eol,this is a test}+` | + `+abc+` + + `+ghi+` + + `+3+` + + `+def+` + + `+ghi+` + + `+ghi+` + + `+is+` + + `+is+` + + `+is a test+` + +| `+${split_shell:number,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split shell arguments, and return, according to `number`: + + - `count`: the number of arguments after split + + - `random`: a random argument + + - integer ≥ 1: the argument by index (1 = first argument) + + - integer ≤ -1: the argument by index from the end (-1 = last argument, -2 = penultimate argument, etc.) | + `+${split_shell:1,"first arg" arg2}+` + + `+${split_shell:-1,"first arg" arg2}+` + + `+${split_shell:count,"first arg" arg2}+` + + `+${split_shell:random,"first arg" arg2}+` | + `+first arg+` + + `+arg2+` + + `+2+` + + `+arg2+` + | `+${re:xxx}+` + _(WeeChat ≥ 1.1)_ | Regex data: + diff --git a/doc/fr/includes/autogen_user_commands.fr.adoc b/doc/fr/includes/autogen_user_commands.fr.adoc index d862bd6d9..89280a6e0 100644 --- a/doc/fr/includes/autogen_user_commands.fr.adoc +++ b/doc/fr/includes/autogen_user_commands.fr.adoc @@ -1384,19 +1384,21 @@ Des variables sont remplacées dans l'expression, en utilisant le format ${varia 7. une chaîne inversée (format : "rev:xxx" ou "revscr:xxx") 8. une chaîne répétée (format : "repeat:nombre,chaîne") 9. longueur d'une chaîne (format : "length:xxx" ou "lengthscr:xxx") - 10. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color") - 11. un modificateur (format : "modifier:nom,données,chaîne") - 12. une info (format : "info:nom,paramètres", les paramètres sont optionnels) - 13. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "base_encode:base,xxx" ou "base_decode:base,xxx") - 14. la date/heure courante (format : "date" ou "date:format") - 15. une variable d'environnement (format : "env:XXX") - 16. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux") - 17. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx") - 18. un nombre entier aléatoire (format : "random:min,max") - 19. une chaîne traduite (format : "translate:xxx") - 20. une option (format : "fichier.section.option") - 21. une variable locale du tampon - 22. 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. + 10. découpage d'une chaîne (format : "split:nombre,séparateurs,flags,xxx") + 11. découpage de paramètres shell (format : "split_shell:nombre,xxx") + 12. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color") + 13. un modificateur (format : "modifier:nom,données,chaîne") + 14. une info (format : "info:nom,paramètres", les paramètres sont optionnels) + 15. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "base_encode:base,xxx" ou "base_decode:base,xxx") + 16. la date/heure courante (format : "date" ou "date:format") + 17. une variable d'environnement (format : "env:XXX") + 18. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux") + 19. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx") + 20. un nombre entier aléatoire (format : "random:min,max") + 21. une chaîne traduite (format : "translate:xxx") + 22. une option (format : "fichier.section.option") + 23. une variable locale du tampon + 24. 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/pointeur/nom de pointeur, par exemple : @@ -1427,6 +1429,14 @@ Exemples (chaînes simples) : /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,\"arg 1\" arg2} ==> arg 1 + /eval -n ${split_shell:-1,\"arg 1\" arg2} ==> arg2 + /eval -n ${split_shell:count,\"arg 1\" arg2} ==> 2 + /eval -n ${split_shell:random,\"arg 1\" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index 220733d0a..48ff7cc11 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -2728,6 +2728,56 @@ première étendue à la dernière) : `+4+` + `+14+` +| `+${split:number,seps,flags,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Chaîne découpée, et retour, selon `number` : + + - `count` : nombre d'éléments après le découpage + + - `random` : un élément au hasard + + - entier ≥ 1 : l'élément par son index (1 = premier élément) + + - entier ≤ -1 : l'élément par son index en partant de la fin (-1 = dernier élément, -2 = avant-dernier élément, etc.), + + `seps` est une liste de caractères qui sont utilisés comme séparateurs (si vide, une virgule est utilisé), + + `flags` est une liste de drapeaux séparés par `+`: + + - `strip_left` : supprimer les séparateurs sur la gauche (début de chaîne) + + - `strip_right` : supprimer les séparateurs sur la droite (fin de chaîne) + + - `collapse_seps` : regrouper de multiples séparateurs consécutifs en un seul + + - `keep_eol` : garder jusqu'à la fin de la ligne pour chaque valeur + + - `strip_items=xyz` : supprimer les caractères `x`, `y` et `z` au début/fin des éléments + + - `max_items=N` : retourner au plus N éléments | + `+${split:1,,,abc,def,ghi}+` + + `+${split:-1,,,abc,def,ghi}+` + + `+${split:count,,,abc,def,ghi}+` + + `+${split:random,,,abc,def,ghi}+` + + `+${split:3,,collapse_seps,abc,,,def,,,ghi}+` + + `+${split:3,,strip_items=-_,_-abc-_,_-def-_,_-ghi-_}+` + + `+${split:2, ,,this is a test}+` + + `+${split:2, ,strip_left+strip_right, this is a test }+` + + `+${split:2, ,keep_eol,this is a test}+` | + `+abc+` + + `+ghi+` + + `+3+` + + `+def+` + + `+ghi+` + + `+ghi+` + + `+is+` + + `+is+` + + `+is a test+` + +| `+${split_shell:number,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Paramètres shells découpés, et retour, selon `number` : + + - `count` : le nombre de paramètres après découpage + + - `random` : un paramètre au hasard + + - entier ≥ 1 : le paramètre par son index (1 = premier paramètre) + + - entier ≤ -1 : le paramètre par son index en partant de la fin (-1 = dernier paramètre, -2 = avant-dernier paramètre, etc.) | + `+${split_shell:1,"first arg" arg2}+` + + `+${split_shell:-1,"first arg" arg2}+` + + `+${split_shell:count,"first arg" arg2}+` + + `+${split_shell:random,"first arg" arg2}+` | + `+first arg+` + + `+arg2+` + + `+2+` + + `+arg2+` + | `+${re:xxx}+` + _(WeeChat ≥ 1.1)_ | Données sur l'expression régulière : + diff --git a/doc/it/includes/autogen_user_commands.it.adoc b/doc/it/includes/autogen_user_commands.it.adoc index 58c44a980..977ada7ac 100644 --- a/doc/it/includes/autogen_user_commands.it.adoc +++ b/doc/it/includes/autogen_user_commands.it.adoc @@ -1384,19 +1384,21 @@ Some variables are replaced in expression, using the format ${variable}, variabl 7. a reversed string (format: "rev:xxx" or "revscr:xxx") 8. a repeated string (format: "repeat:count,string") 9. length of a string (format: "length:xxx" or "lengthscr:xxx") - 10. a color (format: "color:xxx", see "Plugin API reference", function "color") - 11. a modifier (format: "modifier:name,data,string") - 12. an info (format: "info:name,arguments", arguments are optional) - 13. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 14. current date/time (format: "date" or "date:format") - 15. an environment variable (format: "env:XXX") - 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 18. a random integer number (format: "random:min,max") - 19. a translated string (format: "translate:xxx") - 20. an option (format: "file.section.option") - 21. a local variable in buffer - 22. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: @@ -1427,6 +1429,14 @@ Examples (simple strings): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 17d4f2336..1c35f0ed9 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2780,6 +2780,56 @@ expanded to last): `+4+` + `+14+` +| `+${split:number,seps,flags,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split string, and return, according to `number`: + + - `count`: the number of items after split + + - `random`: a random item + + - integer ≥ 1: the item by index (1 = first item) + + - integer ≤ -1: the item by index from the end (-1 = last item, -2 = penultimate item, etc.), + + `seps` is a list of chars that are used as separators (if empty, a comma is used), + + `flags` is a list of flags separated by `+`: + + - `strip_left`: strip separators on the left (beginning of string) + + - `strip_right`: strip separators on the right (end of string) + + - `collapse_seps`: collapse multiple consecutive separators into a single one + + - `keep_eol`: keep end of line for each value + + - `strip_items=xyz`: strip chars `x`, `y` and `z` from beginning/end of items + + - `max_items=N`: return max N items | + `+${split:1,,,abc,def,ghi}+` + + `+${split:-1,,,abc,def,ghi}+` + + `+${split:count,,,abc,def,ghi}+` + + `+${split:random,,,abc,def,ghi}+` + + `+${split:3,,collapse_seps,abc,,,def,,,ghi}+` + + `+${split:3,,strip_items=-_,_-abc-_,_-def-_,_-ghi-_}+` + + `+${split:2, ,,this is a test}+` + + `+${split:2, ,strip_left+strip_right, this is a test }+` + + `+${split:2, ,keep_eol,this is a test}+` | + `+abc+` + + `+ghi+` + + `+3+` + + `+def+` + + `+ghi+` + + `+ghi+` + + `+is+` + + `+is+` + + `+is a test+` + +| `+${split_shell:number,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split shell arguments, and return, according to `number`: + + - `count`: the number of arguments after split + + - `random`: a random argument + + - integer ≥ 1: the argument by index (1 = first argument) + + - integer ≤ -1: the argument by index from the end (-1 = last argument, -2 = penultimate argument, etc.) | + `+${split_shell:1,"first arg" arg2}+` + + `+${split_shell:-1,"first arg" arg2}+` + + `+${split_shell:count,"first arg" arg2}+` + + `+${split_shell:random,"first arg" arg2}+` | + `+first arg+` + + `+arg2+` + + `+2+` + + `+arg2+` + | `+${re:xxx}+` + _(WeeChat ≥ 1.1)_ | Regex data: + diff --git a/doc/ja/includes/autogen_user_commands.ja.adoc b/doc/ja/includes/autogen_user_commands.ja.adoc index 89083ac72..9a100e389 100644 --- a/doc/ja/includes/autogen_user_commands.ja.adoc +++ b/doc/ja/includes/autogen_user_commands.ja.adoc @@ -1384,19 +1384,21 @@ Some variables are replaced in expression, using the format ${variable}, variabl 7. a reversed string (format: "rev:xxx" or "revscr:xxx") 8. a repeated string (format: "repeat:count,string") 9. length of a string (format: "length:xxx" or "lengthscr:xxx") - 10. a color (format: "color:xxx", see "Plugin API reference", function "color") - 11. a modifier (format: "modifier:name,data,string") - 12. an info (format: "info:name,arguments", arguments are optional) - 13. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 14. current date/time (format: "date" or "date:format") - 15. an environment variable (format: "env:XXX") - 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 18. a random integer number (format: "random:min,max") - 19. a translated string (format: "translate:xxx") - 20. an option (format: "file.section.option") - 21. a local variable in buffer - 22. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: @@ -1427,6 +1429,14 @@ Examples (simple strings): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index ef33a39e8..a6f1f1439 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -2717,6 +2717,58 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio `+4+` + `+14+` +// TRANSLATION MISSING +| `+${split:number,seps,flags,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split string, and return, according to `number`: + + - `count`: the number of items after split + + - `random`: a random item + + - integer ≥ 1: the item by index (1 = first item) + + - integer ≤ -1: the item by index from the end (-1 = last item, -2 = penultimate item, etc.), + + `seps` is a list of chars that are used as separators (if empty, a comma is used), + + `flags` is a list of flags separated by `+`: + + - `strip_left`: strip separators on the left (beginning of string) + + - `strip_right`: strip separators on the right (end of string) + + - `collapse_seps`: collapse multiple consecutive separators into a single one + + - `keep_eol`: keep end of line for each value + + - `strip_items=xyz`: strip chars `x`, `y` and `z` from beginning/end of items + + - `max_items=N`: return max N items | + `+${split:1,,,abc,def,ghi}+` + + `+${split:-1,,,abc,def,ghi}+` + + `+${split:count,,,abc,def,ghi}+` + + `+${split:random,,,abc,def,ghi}+` + + `+${split:3,,collapse_seps,abc,,,def,,,ghi}+` + + `+${split:3,,strip_items=-_,_-abc-_,_-def-_,_-ghi-_}+` + + `+${split:2, ,,this is a test}+` + + `+${split:2, ,strip_left+strip_right, this is a test }+` + + `+${split:2, ,keep_eol,this is a test}+` | + `+abc+` + + `+ghi+` + + `+3+` + + `+def+` + + `+ghi+` + + `+ghi+` + + `+is+` + + `+is+` + + `+is a test+` + +// TRANSLATION MISSING +| `+${split_shell:number,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split shell arguments, and return, according to `number`: + + - `count`: the number of arguments after split + + - `random`: a random argument + + - integer ≥ 1: the argument by index (1 = first argument) + + - integer ≤ -1: the argument by index from the end (-1 = last argument, -2 = penultimate argument, etc.) | + `+${split_shell:1,"first arg" arg2}+` + + `+${split_shell:-1,"first arg" arg2}+` + + `+${split_shell:count,"first arg" arg2}+` + + `+${split_shell:random,"first arg" arg2}+` | + `+first arg+` + + `+arg2+` + + `+2+` + + `+arg2+` + // TRANSLATION MISSING | `+${re:xxx}+` + _(WeeChat ≥ 1.1)_ | diff --git a/doc/pl/includes/autogen_user_commands.pl.adoc b/doc/pl/includes/autogen_user_commands.pl.adoc index 9fc92b0c1..28e644594 100644 --- a/doc/pl/includes/autogen_user_commands.pl.adoc +++ b/doc/pl/includes/autogen_user_commands.pl.adoc @@ -1383,19 +1383,21 @@ Some variables are replaced in expression, using the format ${variable}, variabl 7. a reversed string (format: "rev:xxx" or "revscr:xxx") 8. a repeated string (format: "repeat:count,string") 9. length of a string (format: "length:xxx" or "lengthscr:xxx") - 10. a color (format: "color:xxx", see "Plugin API reference", function "color") - 11. a modifier (format: "modifier:name,data,string") - 12. an info (format: "info:name,arguments", arguments are optional) - 13. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 14. current date/time (format: "date" or "date:format") - 15. an environment variable (format: "env:XXX") - 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 18. a random integer number (format: "random:min,max") - 19. a translated string (format: "translate:xxx") - 20. an option (format: "file.section.option") - 21. a local variable in buffer - 22. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: @@ -1426,6 +1428,14 @@ Examples (simple strings): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== diff --git a/doc/sr/includes/autogen_api_infos_hashtable.sr.adoc b/doc/sr/includes/autogen_api_infos_hashtable.sr.adoc index 43b8ed632..471239daa 100644 --- a/doc/sr/includes/autogen_api_infos_hashtable.sr.adoc +++ b/doc/sr/includes/autogen_api_infos_hashtable.sr.adoc @@ -8,7 +8,7 @@ |=== | Додатак | Име | Опис | Хеш табела (улаз) | Хеш табела (излаз) -| irc | irc_message_parse | парсирање IRC поруке | „message”: IRC порука, „server”: име сервера (није обавезно) | "tags": tags, "tag_xxx": unescaped value of tag "xxx" (one key per tag), "message_without_tags": message without the tags, "nick": nick, "user": user, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel), "text": text (for example user message), "pos_command": index of "command" message ("-1" if "command" was not found), "pos_arguments": index of "arguments" message ("-1" if "arguments" was not found), "pos_channel": index of "channel" message ("-1" if "channel" was not found), "pos_text": index of "text" message ("-1" if "text" was not found) +| irc | irc_message_parse | парсирање IRC поруке | „message”: IRC порука, „server”: име сервера (није обавезно) | „tags”: ознаке, „tag_xxx”: неозначена вредност ознаке „xxx” (један кључ по ознаци), „message_without_tags”: поруке без ознака, „nick”: надимак, „user”: корисник, „host”: хост, „command”: команда, „channel”: канал, „arguments”: аргументи (укључујући channel), „text”: текст (на пример, корисничка порука), „pos_command”: индекс „command” поруке („-1” ако „command” није пронађена), „pos_arguments”: индекс „arguments” поруке („-1” ако „arguments” није пронађена), „pos_channel”: индекс „channel” поруке („-1” ако „channel” није пронађена), „pos_text”: индекс „text” поруке („-1” ако „text” није пронађена) | irc | irc_message_split | подела IRC поруке (подразумевано тако да стане у 512 бајтова) | „message”: IRC порука, „server”: име сервера (није обавезно) | „msg1” ... „msgN”: поруке које се шаљу (без „\r\n” на крају), „args1” ... „argsN”: аргументи порука, „count”: број порука diff --git a/doc/sr/includes/autogen_user_commands.sr.adoc b/doc/sr/includes/autogen_user_commands.sr.adoc index b5cf31d62..e13e729fa 100644 --- a/doc/sr/includes/autogen_user_commands.sr.adoc +++ b/doc/sr/includes/autogen_user_commands.sr.adoc @@ -17,32 +17,32 @@ * `+allchan+`: извршавање команде на свим каналима свих повезаних сервера ---- -/allchan [-current] [-parted] [-exclude=[,...]] - [-current] [-parted] -include=[,...] - - -current: execute command for channels of current server only - -parted: execute on parted channels only - -exclude: exclude some channels (wildcard "*" is allowed) - -include: include only some channels (wildcard "*" is allowed) - command: command to execute (or text to send to buffer if command does not start with '/') - -Command and arguments are evaluated (see /help eval), the following variables are replaced: - $server server name - $channel channel name - $nick nick on server - ${irc_server.xxx} variable xxx in server - ${irc_channel.xxx} variable xxx in channel - -Examples: - execute '/me is testing' on all channels: +/allchan [-current] [-parted] [-exclude=<канал>[,<канал>...]] <команда> + [-current] [-parted] -include=<канал>[,<канал>...] <команда> + + -current: команда се извршава само за канале текућег сервера + -parted: команда се извршава само на напуштеним каналима + -exclude: неки канали се изузимају (дозвољен је џокер „*”) + -include: узимају се у обзир само неки канали (дозвољен је џокер „*”) + команда: команда која треба да се изврши (или текст који се шаље баферу ако команда не почиње са ’/’) + +Команде и аргументи се израчунавају (погледајте /help eval), замењују се следеће променљиве: + $server име сервера + $channel име канала + $nick надимак на серверу + ${irc_server.xxx} променљива xxx на серверу + ${irc_channel.xxx} променљива xxx на каналу + +Примери: + извршава ’/me is testing’ на свим каналима: /allchan /me is testing - say 'hello' everywhere but not on #weechat: - /allchan -exclude=#weechat hello - say 'hello' everywhere but not on #weechat and channels beginning with #linux: - /allchan -exclude=#weechat,#linux* hello - say 'hello' on all channels beginning with #linux: - /allchan -include=#linux* hello - close all buffers with parted channels: + каже ’здраво’ свуда осим на #weechat: + /allchan -exclude=#weechat здраво + каже ’здраво’ свуда осим на #weechat и каналима који почињу са #linux: + /allchan -exclude=#weechat,#linux* здраво + каже ’здраво’ на свим каналима који почињу на #linux: + /allchan -include=#linux* здраво + затвара све бафере са напуштеним каналима: /allchan -parted /close ---- @@ -104,23 +104,23 @@ Examples: ---- [[command_irc_auth]] -* `+auth+`: authenticate with SASL +* `+auth+`: аутентификација са SASL ---- -/auth [ ] +/auth [<кор_име> <лозинка>] -username: SASL username (content is evaluated, see /help eval; server options are evaluated with ${irc_server.xxx} and ${server} is replaced by the server name) -password: SASL password or path to file with private key (content is evaluated, see /help eval; server options are evaluated with ${irc_server.xxx} and ${server} is replaced by the server name) +кор_име: SASL корисничко име (садржај се израчунава, погледајте /help eval; опције сервера се израчунавају са ${irc_server.xxx} и ${server} се замењује са именом сервера) +лозинка: SASL лозинка или путања до фајла са приватним кључем (садржај се израчунава, погледајте /help eval; опције сервера се израчунавају са ${irc_server.xxx} и ${server} се замњеује именом сервера) -If username and password are not provided, the values from server options "sasl_username" and "sasl_password" (or "sasl_key") are used. +Ако се не наведу корисничко име и лозинка, користе се вредности из серверских опције „sasl_username” и „sasl_password” (или „sasl_key”). -Examples: - authenticate with username/password defined in the server: +Примери: + аутентификација са корисничким именом/лозинком дефинисаним на серверу: /auth - authenticate as a different user: - /auth user2 password2 - authenticate as a different user with mechanism ecdsa-nist256p-challenge: - /auth user2 ${weechat_config_dir}/ecdsa2.pem + аутентификација као други корисник: + /auth корисник2 лозинка2 + аутентификација као други корисник ecdsa-nist256p-challenge механизмом: + /auth корисник2 ${weechat_config_dir}/ecdsa2.pem ---- [[command_irc_ban]] @@ -1384,19 +1384,21 @@ Some variables are replaced in expression, using the format ${variable}, variabl 7. a reversed string (format: "rev:xxx" or "revscr:xxx") 8. a repeated string (format: "repeat:count,string") 9. length of a string (format: "length:xxx" or "lengthscr:xxx") - 10. a color (format: "color:xxx", see "Plugin API reference", function "color") - 11. a modifier (format: "modifier:name,data,string") - 12. an info (format: "info:name,arguments", arguments are optional) - 13. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 14. current date/time (format: "date" or "date:format") - 15. an environment variable (format: "env:XXX") - 16. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 17. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 18. a random integer number (format: "random:min,max") - 19. a translated string (format: "translate:xxx") - 20. an option (format: "file.section.option") - 21. a local variable in buffer - 22. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 10. split of a string (format: "split:number,separators,flags,xxx") + 11. split of shell argmuents (format: "split_shell:number,xxx") + 12. a color (format: "color:xxx", see "Plugin API reference", function "color") + 13. a modifier (format: "modifier:name,data,string") + 14. an info (format: "info:name,arguments", arguments are optional) + 15. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 16. current date/time (format: "date" or "date:format") + 17. an environment variable (format: "env:XXX") + 18. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 19. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 20. a random integer number (format: "random:min,max") + 21. a translated string (format: "translate:xxx") + 22. an option (format: "file.section.option") + 23. a local variable in buffer + 24. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list/pointer/pointer name, for example: @@ -1427,6 +1429,14 @@ Examples (simple strings): /eval -n ${rev:Hello} ==> olleH /eval -n ${repeat:5,-} ==> ----- /eval -n ${length:test} ==> 4 + /eval -n ${split:1,,,abc,def,ghi} ==> abc + /eval -n ${split:-1,,,abc,def,ghi} ==> ghi + /eval -n ${split:count,,,abc,def,ghi} ==> 3 + /eval -n ${split:random,,,abc,def,ghi} ==> def + /eval -n ${split_shell:1,"arg 1" arg2} ==> arg 1 + /eval -n ${split_shell:-1,"arg 1" arg2} ==> arg2 + /eval -n ${split_shell:count,"arg 1" arg2} ==> 2 + /eval -n ${split_shell:random,"arg 1" arg2} ==> arg2 /eval -n ${calc:(5+2)*3} ==> 21 /eval -n ${random:0,10} ==> 3 /eval -n ${base_encode:64,test} ==> dGVzdA== @@ -1545,63 +1555,63 @@ addreplace: додаје или замењује постојећи филтер ---- /input <акција> [<аргументи>] -list of actions: - return: simulate key "enter" - complete_next: complete word with next completion - complete_previous: complete word with previous completion - search_text_here: search text in buffer at current position - search_text: search text in buffer - search_switch_case: switch exact case for search - search_switch_regex: switch search type: string/regular expression - search_switch_where: switch search in messages/prefixes - search_previous: search previous line - search_next: search next line - search_stop_here: stop search at current position - search_stop: stop search - delete_previous_char: delete previous char - delete_next_char: delete next char - delete_previous_word: delete previous word - delete_next_word: delete next word - delete_beginning_of_line: delete from beginning of line until cursor - delete_end_of_line: delete from cursor until end of line - delete_line: delete entire line - clipboard_paste: paste from the internal clipboard - transpose_chars: transpose two chars - undo: undo last command line action - redo: redo last command line action - move_beginning_of_line: move cursor to beginning of line - move_end_of_line: move cursor to end of line - move_previous_char: move cursor to previous char - move_next_char: move cursor to next char - move_previous_word: move cursor to previous word - move_next_word: move cursor to next word - history_previous: recall previous command in current buffer history - history_next: recall next command in current buffer history - history_global_previous: recall previous command in global history - history_global_next: recall next command in global history - jump_smart: jump to next buffer with activity - jump_last_buffer_displayed: jump to last buffer displayed (before last jump to a buffer) - jump_previously_visited_buffer: jump to previously visited buffer - jump_next_visited_buffer: jump to next visited buffer - hotlist_clear: clear hotlist (optional argument: "lowest" to clear only lowest level in hotlist, "highest" to clear only highest level in hotlist, or level mask: integer which is a combination of 1=join/part, 2=message, 4=private, 8=highlight) - hotlist_remove_buffer: remove current buffer from hotlist - hotlist_restore_buffer: restore latest hotlist removed in the current buffer - hotlist_restore_all: restore latest hotlist removed in all buffers - grab_key: grab a key (optional argument: delay for end of grab, default is 500 milliseconds) - grab_key_command: grab a key with its associated command (optional argument: delay for end of grab, default is 500 milliseconds) - grab_mouse: grab mouse event code - grab_mouse_area: grab mouse event code with area - set_unread: set unread marker for all buffers - set_unread_current_buffer: set unread marker for current buffer - switch_active_buffer: switch to next merged buffer - switch_active_buffer_previous: switch to previous merged buffer - zoom_merged_buffer: zoom on merged buffer - insert: insert text in command line (escaped chars are allowed, see /help print) - send: send text to the buffer - paste_start: start paste (bracketed paste mode) - paste_stop: stop paste (bracketed paste mode) - -This command is used by key bindings or plugins. +листа акција: + return: симулира притисак на тастер „ентер” + complete_next: довршава реч са наредним довршавањем + complete_previous: довршава реч са претходним довршавањем + search_text_here: претражује текст у баферу почевши од текуће позиције + search_text: претражује текст у баферу + search_switch_case: укључује употребу тачне величине слова код претраге + search_switch_regex: мења тип претраге: стринг/регуларни израз + search_switch_where: укључује претрагу у порукама/префиксима + search_previous: претрага у претходној линији + search_next: претрага у наредној линији + search_stop_here: зауставља претрагу на текућој позицији + search_stop: зауставља претрагу + delete_previous_char: брише претходни карактер + delete_next_char: брише наредни карактер + delete_previous_word: брише претходну реч + delete_next_word: брише наредну реч + delete_beginning_of_line: брише од почетка линије до позиције курсора + delete_end_of_line: брише од позиције курсора до краја линије + delete_line: брише комплетну линију + clipboard_paste: налепљује из интерног клипборда + transpose_chars: транспонује два карактера (замењују места) + undo: поништава последњу акцију командне линије + redo: обнавља последње поништену акцију команде линије + move_beginning_of_line: помера курсор на почетак линије + move_end_of_line: помера курсор на крај линије + move_previous_char: помера курсор на претходни карактер + move_next_char: помера курсор на наредни карактер + move_previous_word: помера курсор на претходну реч + move_next_word: помера курсор на наредну реч + history_previous: позива претходну команду из историје команди текућег бафера + history_next: позива наредну команду из историје команди текућег бафера + history_global_previous: позива претходну команду из глобалне историје команди + history_global_next: позива наредну команду из глобалне историје команди + jump_smart: скаче на наредни бафер у коме постоји активност + jump_last_buffer_displayed: скаче на последњи приказани бафер (пре последњег скока на бафер) + jump_previously_visited_buffer: скаче на претходно посећени бафер + jump_next_visited_buffer: скаче на наредни посећени бафер + hotlist_clear: брише врућу листу (необавезни аргументи: „lowest” за брисање само најнижег нивоа у врућој листи, „highest” за брисање само највишег нивоа у врућој листи, или маска нивоа: целобројна вредност која представља комбинацију 1=join/part, 2=порука, 4=приватно, 8=истицање) + hotlist_remove_buffer: уклања текући бафер из вруће листе + hotlist_restore_buffer: враћа последњу уклоњену врућу листу у текући бафер + hotlist_restore_all: враћа последњу уклоњену врућу листу у све бафере + grab_key: преузима тастер (необавезни аргумент: кашњење за крај преузимања, подразумевано је 500 милисекунди) + grab_key_command: преузима тастер са својом придруженом командом (необавезни аргумент: кашњење за крај преузимања, подразумевано је 500 милисекунди) + grab_mouse: преузима кôд догађаја миша + grab_mouse_area: преузима кôд догађаја миша заједно са површином + set_unread: поставља маркер непрочитан за све бафере + set_unread_current_buffer: поставља маркер непрочитан за текући бафер + switch_active_buffer: прелази на наредни спојени бафер + switch_active_buffer_previous: прелази на претходни спојени бафер + zoom_merged_buffer: зумира на спојени бафер + insert: умеће текст у командну линију (дозвољени су означени карактери, погледајте /help print) + send: шаље текст баферу + paste_start: започиње налепљивање (режим ограђеног налепљивања) + paste_stop: зауставља налепљивање (режим ограђеног налепљивања) + +Ову команду користе тастерске пречице или додаци. ---- [[command_weechat_key]] @@ -1669,21 +1679,21 @@ listdefault: исписује подразумеване тастере del [<име>] [buffers|windows] rename <име> <ново_име> - store: store current buffers/windows in a layout - apply: apply stored layout - leave: leave current layout (does not update any layout) - del: delete buffers and/or windows in a stored layout - (if neither "buffers" nor "windows" is given after the name, the layout is deleted) - rename: rename a layout - name: name for stored layout (default is "default") -buffers: store/apply only buffers (order of buffers) -windows: store/apply only windows (buffer displayed by each window) + store: чува текуће бафере/прозоре у распореду + apply: примењује сачувани распоред + leave: напушта текући распоред (не ажурира ниједан распоред) + del: брише бафере и/или прозоре из сачуваног распореда + (ако након имена није наведено ни „buffers” ни „windows”, онда се брише распоред) + rename: измена имена распореда + име: име распореда који се чува (подразумевано је „default”) +buffers: чува/обнавља само бафере (редослед бафера) +windows: чува/обнавља само прозоре (бафер који приказује сваки прозор) -Without argument, this command displays stored layouts. +Без аргумента, ова команда приказује сачуване распореде. -The current layout can be saved on /quit command with the option "weechat.look.save_layout_on_exit". +Текући распоред може да се сачува приликом /quit команде опцијом „weechat.look.save_layout_on_exit”. -Note: the layout only remembers windows split and buffers numbers. It does not open buffers. That means for example you must still auto-join IRC channels to open the buffers, the saved layout only applies once the buffers are opened. +Напомена: распоред памти само поделе прозора и бројеве бафера. Он не отвара бафере. То значи да још увек морате аутоматски да приступите IRC каналима да бисте отворили бафере, сачувани распоред се примењује тек онда када се отворе бафери. ---- [[command_weechat_mouse]] diff --git a/doc/sr/includes/autogen_user_options.sr.adoc b/doc/sr/includes/autogen_user_options.sr.adoc index 3f8a2d298..714410e5f 100644 --- a/doc/sr/includes/autogen_user_options.sr.adoc +++ b/doc/sr/includes/autogen_user_options.sr.adoc @@ -1847,43 +1847,43 @@ // tag::typing_options[] * [[option_typing.look.delay_purge_paused]] *typing.look.delay_purge_paused* -** опис: pass:none[number of seconds after paused status has been set: if reached, the typing status is removed] +** опис: pass:none[број секунди након постављања статуса паузирано: ако се достигне, статус статус куцања се уклања] ** тип: целобројна ** вредности: 1 .. 2147483647 ** подразумевана вредност: `+30+` * [[option_typing.look.delay_purge_typing]] *typing.look.delay_purge_typing* -** опис: pass:none[number of seconds after typing status has been set: if reached, the typing status is removed] +** опис: pass:none[број секунди након постављања статуса куцања: ако се достигне, статус куцања се уклања] ** тип: целобројна ** вредности: 1 .. 2147483647 ** подразумевана вредност: `+6+` * [[option_typing.look.delay_set_paused]] *typing.look.delay_set_paused* -** опис: pass:none[number of seconds after typing last char: if reached, the typing status becomes "paused" and no more typing signals are sent] +** опис: pass:none[број секунди након уношења последњег карактера: ако се достигне, статус куцања постаје „паузирано” и не шаље се више ниједан сигнал куцања] ** тип: целобројна ** вредности: 1 .. 2147483647 ** подразумевана вредност: `+10+` * [[option_typing.look.enabled_nicks]] *typing.look.enabled_nicks* -** опис: pass:none[typing enabled for other nicks (display typing info for nicks typing in the current buffer)] +** опис: pass:none[куцање је укључено за остале надимке (приказује инфо о куцању за надимке из текућег бафера)] ** тип: логичка ** вредности: on, off ** подразумевана вредност: `+off+` * [[option_typing.look.enabled_self]] *typing.look.enabled_self* -** опис: pass:none[typing enabled for self messages (send typing info to other users)] +** опис: pass:none[куцање је укључено за сопствене поруке (осталим корисницима се шаље инфо о куцању] ** тип: логичка ** вредности: on, off ** подразумевана вредност: `+off+` * [[option_typing.look.input_min_chars]] *typing.look.input_min_chars* -** опис: pass:none[min number of chars in message to trigger send of typing signals] +** опис: pass:none[мин број карактера у поруци који окида слање сигнала о куцању] ** тип: целобројна ** вредности: 1 .. 2147483647 ** подразумевана вредност: `+4+` * [[option_typing.look.item_max_length]] *typing.look.item_max_length* -** опис: pass:none[max number of chars displayed in the bar item "typing" (0 = do not truncate content)] +** опис: pass:none[макс број карактера који се приказује у ставци траке "typing" (0 = садржај се не одсеца)] ** тип: целобројна ** вредности: 0 .. 2147483647 ** подразумевана вредност: `+0+` @@ -2565,13 +2565,13 @@ ** подразумевана вредност: `+off+` * [[option_irc.look.typing_status_nicks]] *irc.look.typing_status_nicks* -** опис: pass:none[display nicks typing on the channel in bar item "typing" (option typing.look.enabled_nicks must be enabled and capability "message-tags" must be enabled on the server)] +** опис: pass:none[приказивање надимака који куцају у ставци траке „typing” (опција typing.look.enabled_nicks мора бити укључена и на серверу мора бити укључена опција „message-tags”)] ** тип: логичка ** вредности: on, off ** подразумевана вредност: `+off+` * [[option_irc.look.typing_status_self]] *irc.look.typing_status_self* -** опис: pass:none[send self typing status to channels so that other users see when you are typing a message (option typing.look.enabled_self must be enabled and capability "message-tags" must be enabled on the server)] +** опис: pass:none[слање сопственог статуса куцања каналима тако да остали корисници виде када куцате поруку (опција typing.look.enabled_self мора бити укључена и на серверу мора бити укључена опција „message-tags”)] ** тип: логичка ** вредности: on, off ** подразумевана вредност: `+off+` diff --git a/doc/sr/weechat_plugin_api.sr.adoc b/doc/sr/weechat_plugin_api.sr.adoc index bafcf922c..1146dbaa2 100644 --- a/doc/sr/weechat_plugin_api.sr.adoc +++ b/doc/sr/weechat_plugin_api.sr.adoc @@ -2565,6 +2565,58 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio `+4+` + `+14+` +// TRANSLATION MISSING +| `+${split:number,seps,flags,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split string, and return, according to `number`: + + - `count`: the number of items after split + + - `random`: a random item + + - integer ≥ 1: the item by index (1 = first item) + + - integer ≤ -1: the item by index from the end (-1 = last item, -2 = penultimate item, etc.), + + `seps` is a list of chars that are used as separators (if empty, a comma is used), + + `flags` is a list of flags separated by `+`: + + - `strip_left`: strip separators on the left (beginning of string) + + - `strip_right`: strip separators on the right (end of string) + + - `collapse_seps`: collapse multiple consecutive separators into a single one + + - `keep_eol`: keep end of line for each value + + - `strip_items=xyz`: strip chars `x`, `y` and `z` from beginning/end of items + + - `max_items=N`: return max N items | + `+${split:1,,,abc,def,ghi}+` + + `+${split:-1,,,abc,def,ghi}+` + + `+${split:count,,,abc,def,ghi}+` + + `+${split:random,,,abc,def,ghi}+` + + `+${split:3,,collapse_seps,abc,,,def,,,ghi}+` + + `+${split:3,,strip_items=-_,_-abc-_,_-def-_,_-ghi-_}+` + + `+${split:2, ,,this is a test}+` + + `+${split:2, ,strip_left+strip_right, this is a test }+` + + `+${split:2, ,keep_eol,this is a test}+` | + `+abc+` + + `+ghi+` + + `+3+` + + `+def+` + + `+ghi+` + + `+ghi+` + + `+is+` + + `+is+` + + `+is a test+` + +// TRANSLATION MISSING +| `+${split_shell:number,xxx}+` + + _(WeeChat ≥ 3.3)_ | + Split shell arguments, and return, according to `number`: + + - `count`: the number of arguments after split + + - `random`: a random argument + + - integer ≥ 1: the argument by index (1 = first argument) + + - integer ≤ -1: the argument by index from the end (-1 = last argument, -2 = penultimate argument, etc.) | + `+${split_shell:1,"first arg" arg2}+` + + `+${split_shell:-1,"first arg" arg2}+` + + `+${split_shell:count,"first arg" arg2}+` + + `+${split_shell:random,"first arg" arg2}+` | + `+first arg+` + + `+arg2+` + + `+2+` + + `+arg2+` + | `+${re:xxx}+` + _(WeeChat ≥ 1.1)_ | Подаци регуларног израза: + -- cgit v1.2.3