| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
According to RFC 1123:
"... a host domain name is now allowed to begin with a digit and could
legally be entirely numeric ..."
Link: https://datatracker.ietf.org/doc/html/rfc1123#section-2
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Printing an ID in the OSC8 terminator can cause issues in some pagers
and/or terminals. The "spec" doesn't allow for an ID in the terminator,
but most applications and terminals will ignore it if it's there.
Prevent printing it in the first place for better compatibility.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reuse the URL parsing algorithm from foot. Basically, it involves
recording the opening [, (, < and take into account their closing
counterparts. If a closing character is encountered with no matching
opening one, assume the URL ends. This allows handling markdown link
syntax such as:
[http://foobaz.org/xxx](http://foobaz.org/xxx)
Avoid coloring bare URL protocols such as http:// or https://
Update test vector to handle more corner cases.
Link: https://codeberg.org/dnkl/foot/src/tag/1.13.1/url-mode.c#L331-L471
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Kirill Chibisov <contact@kchibisov.com>
|
|
|
|
|
|
|
|
|
|
| |
Mark URLs with OSC 8 escape sequence to help terminal emulators with
opening multi-line URLs with the mouse and attach the hyperlink to
email addresses, so the users could open them.
Link: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
| |
Do not use int for true/false values.
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
In order to allow multiple sections in a styleset, colorize must stop
parsing the theme when it encounters a new section.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Restore the default theme from the previous colorize awk script. It is
more colorful and may be more appealing to new users out of the box.
Since colorize is now configurable via stylesets, power users can do
whatever they like.
Requested-by: Andrea Pappacoda <andrea@pappacoda.it>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Agreed-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous URL regex was too lax, allowing all "[:graph:]" characters
after the protocol:// part. This caused the script to mark as part of an
URL also things like ">", which is commonly used as a URL delimiter in
plain text and Markdown; the url() function tried to account for this
with some heuristic to remove trailing characters, but it didn't always
work (see the screenshots below).
As RFC 3986 specifies the list of allowed characters in URLs, we can
simply make our regex stricter and only mark characters as part of an
URL if they match the allowed set. As the number of allowed characters
has been reduced, the aforementioned heuristic has been slightly
simplified.
I've also removed the backslash escapes from the bracket expressions,
as POSIX regular expressions do not require them; the only characters
that need special handling are ']' and '-', which need to be placed at
the start and at the end of the expression, respectively.
Signed-off-by: Andrea Pappacoda <andrea@pappacoda.it>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
Since its introduction, we had multiple issues with the colorize awk
script with regard to non-GNU awk compatibility.
Also, this script is standalone and the color theme must be hard coded
into it. Reading from an external configuration file (aerc's styleset)
from a non-GNU awk is close to impossible (and even far from trivial
with GNU awk).
Rewrite the builtin colorize filter in C to allow getting the color
theme from aerc's active styleset. The theme is configured using the
existing styleset syntax and attributes under a separate [viewer]
section (see examples and man page).
Export the active styleset file path to AERC_STYLESET env var when
invoking the filter command so that colorize can access it and use it.
I have tested compilation (with clang-analyzer and gcc -fanalyzer) and
basic operation on FreeBSD, Fedora (glibc) and Alpine (muslibc). More
tests would probably be required on MacOSX and older Linux distros.
I also added test vectors to give some confidence that this works as
expected. The execution with these vectors passed valgrind
--leak-check=full without errors.
NB: the default theme has changed to be more minimal. Sample stylesets
have more colorful examples. The awk -v theme=xxx option is no longer
supported.
usage: colorize [-h] [-s FILE] [-f FILE]
options:
-h show this help message
-s FILE use styleset file (default $AERC_STYLESET)
-f FILE read from filename (default stdin)
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|