| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attach a file from templates. Add a split template function.
{{- .Attach "LICENSE" -}}
or
{{range (exec "find ./doc -type f -name *.scd" "" | split "\n") -}}
{{with . }}
{{- $.Attach . -}}
{{- end}}
{{- end}}
Fixes: https://todo.sr.ht/~rjarry/aerc/109
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the behavior of `names`, `firstnames` and `initials` functions in
templates so they better process names formatted like this:
"Last Name, First Name"
Basically, if the name contains one (and only one) comma, its parts are
flipped so the first name always goes first.
This helps to do "Hello Name" in templates regardless of the name format
in email address. Also if the template uses a full name it will make it
"Hello FirstName LastName" instead of "Hello LastName, FirstName".
Add tests to cover more complex names in the future.
Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Similar to switch and .StyleSwitch, add map and .StyleMap to work on
lists. An extra "exclude" item is available to filter elements out of
the list.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Inwit <inwit@sindominio.net>
|
|
|
|
|
|
|
| |
This allows much shorter templates.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a match function that returns true if a string matches the provided
regular expression. The compiled regular expressions are cached in
a sync.Map to avoid repetitive compilations of the same expressions.
Caveat: if the user mixes the arguments order, it may cause the cache to
consume a lot of memory filled with garbage regular expression objects.
Ideally, we would need to limit the size of this cache and/or use a LRU
cache implementation. Maybe someday?
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
| |
This will be used in the dirtree-format replacement by templates.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
| |
This allows to get the current local time.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
| |
These can be handy for tab-title-composer.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
|
|
|
| |
mboxes currently returns the same value that emails. The SplitN API is
misleading, to actually split something, the N value must be greater
than 1...
Fixes: d758441fe0c4 ("templates: add more fields and functions")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Require that all aerc template data objects implement the same
TemplateData interface.
Implement that interface in two different places:
1) state.TemplateData (renamed/moved from templates.TemplateData).
This structure (along with all its methods) needs to be decoupled
from the templates package to break the import cycle with the config
package. This allows much simpler construction of this object and
ensure that values are calculated only when requested.
2) config.dummyData (extracted from templates).
This is only used in the config package to validate user templates.
Putting it here allows also to break an import cycle.
Use state.TemplateData everywhere (including for account tabs title
rendering).
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
|
|
|
| |
When listing all addresses with names, in for example the To field, one
might end up with a very long string. Add the initials function, which
extracts the names from addresses and then shortens each of them to the
initials of the name.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Some contacts, especially corporate, include a wall of text in their
signatures. To not clutter the reply chain, this commit introduces a new
function to the templating engine that removes the signature from
a message.
Link: https://learn.microsoft.com/en-us/microsoft-365/admin/setup/create-signatures-and-disclaimers
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Add functions and fields in preparation for more than only message
templates. The idea is to reuse the same symbols for the message list
format and other parts of the UI.
Update the man page accordingly.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
This makes room in preparation for more code in here.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|