summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-10-25 01:21:31 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-10-25 01:21:31 +0000
commit2309c9662ccbaa4ff76b6feb12b0c48de825418a (patch)
tree3fc8070f02d4a92f1bd17b0c3c3fdc886553e7fa /usr.bin/mandoc/html.c
parent24076ed67cfdc8085635b68311cecb70bad8e78d (diff)
Implement the \f(CW and \f(CR (constant width font) escape sequences
for HTML output. Somewhat relevant because pod2man(1) relies on this. Missing feature reported by Pali dot Rohar at gmail dot com. Note that constant width font was already correctly selected before this when required by semantic markup. Only attempting physical markup with the low-level escape sequence was ineffective.
Diffstat (limited to 'usr.bin/mandoc/html.c')
-rw-r--r--usr.bin/mandoc/html.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 6c92488d912..948d43da915 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.111 2018/10/02 14:56:36 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.112 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -226,6 +226,9 @@ print_metaf(struct html *h, enum mandoc_esc deco)
case ESCAPE_FONTBI:
font = HTMLFONT_BI;
break;
+ case ESCAPE_FONTCW:
+ font = HTMLFONT_CW;
+ break;
case ESCAPE_FONT:
case ESCAPE_FONTROMAN:
font = HTMLFONT_NONE;
@@ -253,6 +256,9 @@ print_metaf(struct html *h, enum mandoc_esc deco)
h->metaf = print_otag(h, TAG_B, "");
print_otag(h, TAG_I, "");
break;
+ case HTMLFONT_CW:
+ h->metaf = print_otag(h, TAG_SPAN, "c", "Li");
+ break;
default:
break;
}
@@ -406,6 +412,7 @@ print_encode(struct html *h, const char *p, const char *pend, int norecurse)
case ESCAPE_FONTBOLD:
case ESCAPE_FONTITALIC:
case ESCAPE_FONTBI:
+ case ESCAPE_FONTCW:
case ESCAPE_FONTROMAN:
if (0 == norecurse)
print_metaf(h, esc);
@@ -736,6 +743,9 @@ print_text(struct html *h, const char *word)
h->metaf = print_otag(h, TAG_B, "");
print_otag(h, TAG_I, "");
break;
+ case HTMLFONT_CW:
+ h->metaf = print_otag(h, TAG_SPAN, "c", "Li");
+ break;
default:
print_indent(h);
break;