summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-10-25 01:21:30 +0000
committerschwarze <schwarze@openbsd.org>2018-10-25 01:21:30 +0000
commit1b5bfe784954a47720b93244ac9046e9d0dc5787 (patch)
treeb5327699eb84493caa2950241bb527aae0a9c5d9
parentstart both the sc_ka_send and sc_ka_hold timeout when (diff)
downloadwireguard-openbsd-1b5bfe784954a47720b93244ac9046e9d0dc5787.tar.xz
wireguard-openbsd-1b5bfe784954a47720b93244ac9046e9d0dc5787.zip
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.
-rw-r--r--usr.bin/mandoc/html.c12
-rw-r--r--usr.bin/mandoc/html.h3
-rw-r--r--usr.bin/mandoc/mandoc.c9
-rw-r--r--usr.bin/mandoc/mandoc.h3
-rw-r--r--usr.bin/mandoc/mdoc_markdown.c3
-rw-r--r--usr.bin/mandoc/roff.c3
-rw-r--r--usr.bin/mandoc/term.c3
7 files changed, 28 insertions, 8 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;
diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h
index daf646917d0..5604507e118 100644
--- a/usr.bin/mandoc/html.h
+++ b/usr.bin/mandoc/html.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.h,v 1.56 2018/10/02 14:56:36 schwarze Exp $ */
+/* $OpenBSD: html.h,v 1.57 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -72,6 +72,7 @@ enum htmlfont {
HTMLFONT_BOLD,
HTMLFONT_ITALIC,
HTMLFONT_BI,
+ HTMLFONT_CW,
HTMLFONT_MAX
};
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index ae9c3938a55..7a0812f813f 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.c,v 1.75 2018/08/20 18:06:42 schwarze Exp $ */
+/* $OpenBSD: mandoc.c,v 1.76 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>
@@ -302,8 +302,13 @@ mandoc_escape(const char **end, const char **start, int *sz)
case ESCAPE_FONT:
if (*sz == 2) {
if (**start == 'C') {
+ if ((*start)[1] == 'W' ||
+ (*start)[1] == 'R') {
+ gly = ESCAPE_FONTCW;
+ break;
+ }
/*
- * Treat constant-width font modes
+ * Treat other constant-width font modes
* just like regular font modes.
*/
(*start)++;
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 4a46bd89d13..0277b955432 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.h,v 1.195 2018/08/25 16:43:52 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.196 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -438,6 +438,7 @@ enum mandoc_esc {
ESCAPE_FONTITALIC, /* italic font mode */
ESCAPE_FONTBI, /* bold italic font mode */
ESCAPE_FONTROMAN, /* roman font mode */
+ ESCAPE_FONTCW, /* constant width font mode */
ESCAPE_FONTPREV, /* previous font mode */
ESCAPE_NUMBERED, /* a numbered glyph */
ESCAPE_UNICODE, /* a unicode codepoint */
diff --git a/usr.bin/mandoc/mdoc_markdown.c b/usr.bin/mandoc/mdoc_markdown.c
index b647a98de33..f5150312d02 100644
--- a/usr.bin/mandoc/mdoc_markdown.c
+++ b/usr.bin/mandoc/mdoc_markdown.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_markdown.c,v 1.26 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: mdoc_markdown.c,v 1.27 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -600,6 +600,7 @@ md_word(const char *s)
nextfont = "***";
break;
case ESCAPE_FONT:
+ case ESCAPE_FONTCW:
case ESCAPE_FONTROMAN:
nextfont = "";
break;
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index d6fc50bb27f..aa3a3f53493 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.213 2018/08/25 16:43:52 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.214 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -3359,6 +3359,7 @@ roff_char(ROFF_ARGS)
case ESCAPE_FONTITALIC:
case ESCAPE_FONTBOLD:
case ESCAPE_FONTBI:
+ case ESCAPE_FONTCW:
case ESCAPE_FONTPREV:
font++;
break;
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 317302e6d73..e21c2622927 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.135 2018/08/16 13:49:40 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.136 2018/10/25 01:21:30 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -508,6 +508,7 @@ term_word(struct termp *p, const char *word)
term_fontrepl(p, TERMFONT_BI);
continue;
case ESCAPE_FONT:
+ case ESCAPE_FONTCW:
case ESCAPE_FONTROMAN:
term_fontrepl(p, TERMFONT_NONE);
continue;