summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2010-11-29 00:12:02 +0000
committerschwarze <schwarze@openbsd.org>2010-11-29 00:12:02 +0000
commitb1e9670a1c5ab8c24995c3ac0de4d25742179db2 (patch)
tree21da3bab85fa08b2c31af42e10349d3ae12d5c40 /usr.bin/mandoc/man_html.c
parentdouble the default message buffer size. again. (diff)
downloadwireguard-openbsd-b1e9670a1c5ab8c24995c3ac0de4d25742179db2.tar.xz
wireguard-openbsd-b1e9670a1c5ab8c24995c3ac0de4d25742179db2.zip
Implement the roff .ft (change font) request for man(7).
Of course, we don't want to encourage low-level physical markup, but pod2man(1) writes such requests, so Perl manuals contain them, and some Xenocara and lots and lots of ports manuals use them as well. In base and Xenocara, this will reduce mandoc -Tlint ERROR noise; in ports, it will improve rendering of many manuals.
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r--usr.bin/mandoc/man_html.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index c2852273b81..22d544b6231 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,6 +1,7 @@
-/* $Id: man_html.c,v 1.19 2010/10/15 20:45:03 schwarze Exp $ */
+/* $Id: man_html.c,v 1.20 2010/11/29 00:12:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -60,6 +61,7 @@ static int a2width(const struct man_node *,
static int man_alt_pre(MAN_ARGS);
static int man_br_pre(MAN_ARGS);
static int man_ign_pre(MAN_ARGS);
+static int man_ft_pre(MAN_ARGS);
static int man_in_pre(MAN_ARGS);
static int man_literal_pre(MAN_ARGS);
static void man_root_post(MAN_ARGS);
@@ -115,6 +117,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_in_pre, NULL }, /* in */
{ NULL, NULL }, /* TS */
{ NULL, NULL }, /* TE */
+ { man_ft_pre, NULL }, /* ft */
};
@@ -731,6 +734,48 @@ man_I_pre(MAN_ARGS)
/* ARGSUSED */
static int
+man_ft_pre(MAN_ARGS)
+{
+ const char *cp;
+
+ if (NULL == n->child) {
+ print_ofont(h, h->metal);
+ return(0);
+ }
+
+ cp = n->child->string;
+ switch (*cp) {
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('B'):
+ print_ofont(h, HTMLFONT_BOLD);
+ break;
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('I'):
+ print_ofont(h, HTMLFONT_ITALIC);
+ break;
+ case ('P'):
+ print_ofont(h, h->metal);
+ break;
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('C'):
+ /* FALLTHROUGH */
+ case ('R'):
+ print_ofont(h, HTMLFONT_NONE);
+ break;
+ default:
+ break;
+ }
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
man_literal_pre(MAN_ARGS)
{