diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-02-27 09:18:16 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-03-02 23:04:35 +0100 |
commit | d9a8edd8e9269aa1189d55c8d13caa05084435f5 (patch) | |
tree | 65ee1373e485902a82155f6b52ebee59403b91e7 /doc | |
parent | 8f8e22dbdd4f9e2ff1604e47e0fc78ff5912d633 (diff) | |
download | aerc-d9a8edd8e9269aa1189d55c8d13caa05084435f5.tar.gz |
templates: allow inline user styles
Allow custom user-defined styles in a styleset. The styles can take any
name, and must be under the [user] ini section. All attributes apply to
user defined styles.
Example:
[user]
red.fg=red
red.bold=true
Add a .Style function which accepts the name of a user-defined style and
applies it to the string.
{{.Style "red" "foo"}}
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/aerc-stylesets.7.scd | 12 | ||||
-rw-r--r-- | doc/aerc-templates.7.scd | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd index eaedb4cb..c633dcef 100644 --- a/doc/aerc-stylesets.7.scd +++ b/doc/aerc-stylesets.7.scd @@ -166,6 +166,18 @@ declared under a *[viewer]* section of the styleset file. | *quote_x* : Above fourth level quoted text. +User defined styles can be used to style arbitrary strings in go-templates (see +_.Style_ in *aerc-templates*(7)). User styles must be defined in the _[user]_ +ini section. Styles can be referenced by their name (e.g. _red.fg_ is named +"red"). + +Example: + +``` +[user] +red.fg=red +``` + ## FNMATCH STYLE WILDCARD MATCHING The styleset configuration can be made simpler by using the fnmatch diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd index 83b19ac9..f3f2a568 100644 --- a/doc/aerc-templates.7.scd +++ b/doc/aerc-templates.7.scd @@ -363,6 +363,13 @@ aerc provides the following additional functions: {{compactPath .Folder}} ``` +*.Style* + Apply a user-defined style (see *aerc-stylesets*(7)) to a string. + + ``` + {{.Style "red" .Account}} + ``` + *version* Returns the version of aerc, which can be useful for things like X-Mailer. |