commit 72ad29a760e315f6005a7cfee19affeb12d3be25
parent fa093e87fc8b3867ab3d8adf1da3808138c8af59
Author: hhvn <dev@hhvn.uk>
Date: Sun, 28 Nov 2021 18:56:18 +0000
hirc.1.header: document formats
Diffstat:
M | hirc.1.header | | | 63 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 63 insertions(+), 0 deletions(-)
diff --git a/hirc.1.header b/hirc.1.header
@@ -28,3 +28,66 @@ reads each line of
.Ar configfile
executing any that are begin with '/' as commands.
Any line beginning with a character other than '/' are ignored.
+.Ss Formats
+Variables beginning with format.* are used to customize the way that messages and ui elements are formatted.
+The parser is designed to never report any errors, and simply print verbatim if it cannot understand the format.
+The following styling may be used:
+.Bl -tag -compact -width "%{c:fg[,bg]} "
+.It %{b}
+Set/reset boldness.
+.It %{c:fg[,bg]}
+Set foreground/background colours.
+Background optional.
+.It %{i}
+Set/reset italics.
+.It %{o}
+Reset all stylistic formatting including colour.
+.It %{r}
+Reverse foreground/background.
+.It %{u}
+Set/reset underline.
+.El
+
+Certain variables may also be used in formats:
+.Bl -tag -compact -width "${channel}"
+.It ${cmd}
+The command of a message.
+.It ${nick}
+Nickname that sent the message.
+.It ${ident}
+Ident of the nick that sent the message.
+.It ${host}
+Host of the nick that sent the message.
+.It ${channel}
+Selected channel, or channel of the message.
+.It ${topic}
+Topic of the selected channel, or from the message.
+.It ${server}
+Selected server, or server the message was from.
+.It ${n}
+Where n is a non-zero positive integer.
+This selects a paramater of a message.
+.El
+
+For example, the message:
+.D1 :hhvn!Fanatic@hhvn.uk PRIVMSG #test :hello world
+becomes:
+.Bd -offset indent -compact
+.Bl -tag -compact -width "${ident}"
+.It ${nick}
+hhvn
+.It ${ident}
+Fanatic
+.It ${host}
+hhvn.uk
+.It ${cmd}
+PRIVMSG
+.It ${1}
+#test
+.It ${2}
+hello world
+.El
+.Ed
+
+If a variable does not exist, it will be printed verbatim.
+If a variable does exist, but is empty, nothing is printed.