diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2020-11-14 09:28:46 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2020-11-14 09:28:46 +0100 |
commit | b626df72fb7cdc9d9f23a0e5a81209faace87c0f (patch) | |
tree | dd681ba32d35ffb8a5ad7abb58ddab0ced624c27 /doc/it | |
parent | eb90a73fe811e2de0e0646abf10242e639a7b1a1 (diff) | |
download | weechat-b626df72fb7cdc9d9f23a0e5a81209faace87c0f.zip |
core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (closes #1582)
Diffstat (limited to 'doc/it')
-rw-r--r-- | doc/it/includes/autogen_user_commands.it.adoc | 36 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 8 |
2 files changed, 26 insertions, 18 deletions
diff --git a/doc/it/includes/autogen_user_commands.it.adoc b/doc/it/includes/autogen_user_commands.it.adoc index 097a190f2..4a35cbbcb 100644 --- a/doc/it/includes/autogen_user_commands.it.adoc +++ b/doc/it/includes/autogen_user_commands.it.adoc @@ -1336,24 +1336,25 @@ To force a string comparison, you can add double quotes around each expression, 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") + 2. an evaluated condition (format: "eval_cond:xxx") + 3. a string with escaped chars (format: "esc:xxx" or "\xxx") + 4. a string with chars to hide (format: "hide:char,string") + 5. 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" or "revscr:xxx") - 6. a repeated string (format: "repeat:count,string") - 7. length of a string (format: "length:xxx" or "lengthscr:xxx") - 8. a color (format: "color:xxx", see "Plugin API reference", function "color") - 9. a modifier (format: "modifier:name,data,string") - 10. an info (format: "info:name,arguments", arguments are optional) - 11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") - 12. current date/time (format: "date" or "date:format") - 13. an environment variable (format: "env:XXX") - 14. a ternary operator (format: "if:condition?value_if_true:value_if_false") - 15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") - 16. an option (format: "file.section.option") - 17. a local variable in buffer - 18. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 6. a reversed string (format: "rev:xxx" or "revscr:xxx") + 7. a repeated string (format: "repeat:count,string") + 8. length of a string (format: "length:xxx" or "lengthscr:xxx") + 9. a color (format: "color:xxx", see "Plugin API reference", function "color") + 10. a modifier (format: "modifier:name,data,string") + 11. an info (format: "info:name,arguments", arguments are optional) + 12. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx") + 13. current date/time (format: "date" or "date:format") + 14. an environment variable (format: "env:XXX") + 15. a ternary operator (format: "if:condition?value_if_true:value_if_false") + 16. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx") + 17. an option (format: "file.section.option") + 18. a local variable in buffer + 19. 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: @@ -1364,6 +1365,7 @@ Format for hdata can be one of following: For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples (simple strings): + /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 diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index a7588feca..35f43922e 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2294,7 +2294,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" // TRANSLATION MISSING _WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0, -2.2, 2.3, 2.7 and 2.9._ +2.2, 2.3, 2.7, 2.9 and 3.1._ // TRANSLATION MISSING Evaluate an expression and return result as a string. @@ -2631,6 +2631,12 @@ expanded to last): `+19:02:45+` (with colors if there are color codes in the option weechat.look.buffer_time_format) +| `+${eval_cond:xxx}+` + + _(WeeChat ≥ 3.1)_ | + String to evaluate as condition. | + `+${eval_cond:${window.win_width} > 100}+` | + `+1+` + | `+${esc:xxx}+` + `+${\xxx}+` + _(WeeChat ≥ 1.0)_ | |