summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 16:44:22 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 16:44:22 +0000
commitb3a09b4f2e6de787535cd7659fd19f1c7f91eada (patch)
treef74d9a013373f43a1429659364ba769c792889c1
parentbd329dd8fae21fc03372e563b33ef77a421e7ea9 (diff)
downloadmandoc-b3a09b4f2e6de787535cd7659fd19f1c7f91eada.tar.gz
mandoc-b3a09b4f2e6de787535cd7659fd19f1c7f91eada.tar.zst
mandoc-b3a09b4f2e6de787535cd7659fd19f1c7f91eada.zip
Added simple font-escapes.
-rw-r--r--mandoc.113
-rw-r--r--terminal.c22
2 files changed, 33 insertions, 2 deletions
diff --git a/mandoc.1 b/mandoc.1
index 807d4045..27c663fc 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.10 2009/03/26 16:23:22 kristaps Exp $
+.\" $Id: mandoc.1,v 1.11 2009/03/26 16:44:22 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -160,6 +160,17 @@ format is
recommended;
.Xr man 7
should only be used for legacy manuals.
+.Pp
+The following escape sequences are recognised, although the per-format
+compiler may not allow certain sequences.
+.Bl -tag -width Ds -offset XXXX
+.It \efX
+sets the font mode to X (B, I, R or P, where P resets the font)
+.It \eX, \e(XX, \e[XN]
+queries the special-character table for a corresponding symbol
+.It \e*X, \e*(XX, \e*[XN]
+deprecated special-character format
+.El
.\" SUB-SECTION
.Ss Output Formats
The
diff --git a/terminal.c b/terminal.c
index 2c991534..484bb32f 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1,4 +1,4 @@
-/* $Id: terminal.c,v 1.10 2009/03/26 14:44:41 kristaps Exp $ */
+/* $Id: terminal.c,v 1.11 2009/03/26 16:44:22 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -454,6 +454,26 @@ term_pescape(struct termp *p, const char *word, int *i, int len)
term_nescape(p, &word[*i], 1);
return;
}
+
+ } else if ('f' == word[*i]) {
+ if (++(*i) >= len)
+ return;
+ switch (word[*i]) {
+ case ('B'):
+ p->flags |= TERMP_BOLD;
+ break;
+ case ('I'):
+ p->flags |= TERMP_UNDER;
+ break;
+ case ('P'):
+ /* FALLTHROUGH */
+ case ('R'):
+ p->flags &= ~TERMP_STYLE;
+ break;
+ default:
+ break;
+ }
+ return;
} else if ('[' != word[*i]) {
term_nescape(p, &word[*i], 1);