diff options
Diffstat (limited to 'doc/en')
-rw-r--r-- | doc/en/autogen/user/weechat_commands.asciidoc | 19 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.asciidoc | 21 |
2 files changed, 30 insertions, 10 deletions
diff --git a/doc/en/autogen/user/weechat_commands.asciidoc b/doc/en/autogen/user/weechat_commands.asciidoc index 9ff20bc01..aea0caa96 100644 --- a/doc/en/autogen/user/weechat_commands.asciidoc +++ b/doc/en/autogen/user/weechat_commands.asciidoc @@ -276,14 +276,16 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority: - 1. a string with escaped chars (format: "esc:xxx" or "\xxx") - 2. a string with chars to hide (format: "hide:char,string") - 3. a color (format: "color:xxx") - 4. an info (format: "info:name,arguments", arguments are optional) - 5. an environment variable (format: "env:XXX") - 6. an option (format: "file.section.option") - 7. a local variable in buffer - 8. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. an evaluated sub-string (format: "eval:xxx") + 2. a string with escaped chars (format: "esc:xxx" or "\xxx") + 3. a string with chars to hide (format: "hide:char,string") + 4. a color (format: "color:xxx") + 5. an info (format: "info:name,arguments", arguments are optional) + 6. current date/time (format: "date" or "date:format") + 7. an environment variable (format: "env:XXX") + 8. an option (format: "file.section.option") + 9. a local variable in buffer + 10. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list, for example: @@ -303,6 +305,7 @@ Examples (simple strings): /eval -n ${window.buffer.number} ==> 1 /eval -n ${\t} ==> <tab> /eval -n ${hide:-,${relay.network.password}} ==> -------- + /eval -n ${date:%H:%M:%S} ==> 07:46:40 Examples (conditions): /eval -n -c ${window.buffer.number} > 2 ==> 0 diff --git a/doc/en/weechat_plugin_api.en.asciidoc b/doc/en/weechat_plugin_api.en.asciidoc index cca10ff35..369d62782 100644 --- a/doc/en/weechat_plugin_api.en.asciidoc +++ b/doc/en/weechat_plugin_api.en.asciidoc @@ -1902,7 +1902,7 @@ str3 = weechat.string_input_for_buffer("//test") # "/test" ==== string_eval_expression -_WeeChat ≥ 0.4.0, updated in 0.4.2 and 1.1._ +_WeeChat ≥ 0.4.0, updated in 0.4.2, 1.0, 1.1, 1.2 and 1.3._ Evaluate an expression and return result as a string. Special variables with format `${variable}` are expanded (see table below). @@ -1954,13 +1954,20 @@ Return value: List of variables expanded in expression (by order of priority, from first expanded to last): -[width="100%",cols="2,8,3,3",options="header"] +[width="100%",cols="2,8,4,4",options="header"] |=== | Format | Description | Examples | Results | `${name}` | Variable `name` from hashtable 'extra_vars' | `${name}` | `value` +| `${eval:xxx}` + + (_WeeChat ≥ 1.3_) | + String to evaluate | + `${eval:${date:${weechat.look.buffer_time_format}}}` | + `19:02:45` (with colors if there are color codes in the option + weechat.look.buffer_time_format) + | `${esc:xxx}` + `${\xxx}` | String with escaped chars | `${esc:prefix\tmessage}` + @@ -1996,6 +2003,16 @@ expanded to last): `1.0` + `lightblue` +| `${date}` + + `${date:xxx}` + + (_WeeChat ≥ 1.3_) | + Current date/time, with custom format (see `man strftime`), + default format is `%F %T` | + `${date}` + + `${date:%H:%M:%S}` | + `2015-06-30 19:02:45` + + `19:02:45` + | `${env:NAME}` + (_WeeChat ≥ 1.2_) | Value of the environment variable `NAME` | |