by allowing the preprocessor to pass it through to the formatters.
Used for example by the groff_char(7) manual page.
-# $OpenBSD: Makefile,v 1.8 2018/04/09 02:31:37 schwarze Exp $
+# $OpenBSD: Makefile,v 1.9 2018/08/16 13:49:40 schwarze Exp $
-REGRESS_TARGETS = escape infinite name std undef zerolength
+REGRESS_TARGETS = dotT escape infinite name std undef zerolength
LINT_TARGETS = name std undef
+UTF8_TARGETS = dotT
+HTML_TARGETS = dotT
+SKIP_MARKDOWN = escape infinite name std undef zerolength
# The infinite test fails badly with groff-1.20.1:
# It fails to print the following text.
--- /dev/null
+.\" $OpenBSD: dotT.in,v 1.1 2018/08/16 13:49:40 schwarze Exp $
+.Dd $Mdocdate: August 16 2018 $
+.Dt STRING-DOTT 1
+.Os
+.Sh NAME
+.Nm string-dotT
+.Nd interpolating the device name
+.Sh DESCRIPTION
+initial text
+.Pp
+BEGINTEST
+.Pp
+We are using the \*(.T device.
+.Pp
+.ds .T name
+The device \*(.T can be overridden.
+.Pp
+ENDTEST
+.Pp
+final text
--- /dev/null
+STRING-DOTT(1) General Commands Manual STRING-DOTT(1)
+
+N\bNA\bAM\bME\bE
+ s\bst\btr\bri\bin\bng\bg-\b-d\bdo\bot\btT\bT - interpolating the device name
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ initial text
+
+ BEGINTEST
+
+ We are using the ascii device.
+
+ The device name can be overridden.
+
+ ENDTEST
+
+ final text
+
+OpenBSD August 16, 2018 OpenBSD
--- /dev/null
+BEGINTEST
+<div class="Pp"></div>
+We are using the html device.
+<div class="Pp"></div>
+The device name can be overridden.
+<div class="Pp"></div>
+ENDTEST
--- /dev/null
+STRING-DOTT(1) - General Commands Manual
+
+# NAME
+
+**string-dotT** - interpolating the device name
+
+# DESCRIPTION
+
+initial text
+
+BEGINTEST
+
+We are using the markdown device.
+
+The device name can be overridden.
+
+ENDTEST
+
+final text
+
+OpenBSD - August 16, 2018
--- /dev/null
+STRING-DOTT(1) General Commands Manual STRING-DOTT(1)
+
+N\bNA\bAM\bME\bE
+ s\bst\btr\bri\bin\bng\bg-\b-d\bdo\bot\btT\bT – interpolating the device name
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ initial text
+
+ BEGINTEST
+
+ We are using the utf8 device.
+
+ The device name can be overridden.
+
+ ENDTEST
+
+ final text
+
+OpenBSD August 16, 2018 OpenBSD
-/* $OpenBSD: html.c,v 1.108 2018/06/25 16:54:55 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.109 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
if (c <= 0)
continue;
break;
+ case ESCAPE_DEVICE:
+ print_word(h, "html");
+ continue;
case ESCAPE_BREAK:
breakline = 1;
continue;
-/* $OpenBSD: mandoc.c,v 1.73 2018/08/10 22:12:40 schwarze Exp $ */
+/* $OpenBSD: mandoc.c,v 1.74 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
break;
}
break;
+ case '*':
+ if (strncmp(*start, "(.T", 3) != 0)
+ abort();
+ gly = ESCAPE_DEVICE;
+ *start = ++*end;
+ *sz = 2;
+ break;
/*
* These escapes are of the form \X'Y', where 'X' is the trigger
-/* $OpenBSD: mandoc.h,v 1.190 2018/07/28 18:32:30 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.191 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
ESCAPE_FONTPREV, /* previous font mode */
ESCAPE_NUMBERED, /* a numbered glyph */
ESCAPE_UNICODE, /* a unicode codepoint */
+ ESCAPE_DEVICE, /* print the output device name */
ESCAPE_BREAK, /* break the output line */
ESCAPE_NOSPACE, /* suppress space if the last on a line */
ESCAPE_HORIZ, /* horizontal movement */
-/* $OpenBSD: mdoc_markdown.c,v 1.24 2018/04/11 17:10:35 schwarze Exp $ */
+/* $OpenBSD: mdoc_markdown.c,v 1.25 2018/08/16 13:49:40 schwarze Exp $ */
/*
- * Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2017, 2018 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
case ESCAPE_SPECIAL:
uc = mchars_spec2cp(seq, sz);
break;
+ case ESCAPE_DEVICE:
+ md_rawword("markdown");
+ continue;
case ESCAPE_FONTBOLD:
nextfont = "**";
break;
-/* $OpenBSD: roff.c,v 1.202 2018/08/10 04:41:21 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.203 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
if (arg_complete) {
deftype = ROFFDEF_USER | ROFFDEF_PRE;
res = roff_getstrn(r, stnam, naml, &deftype);
+
+ /*
+ * If not overriden, let \*(.T
+ * through to the formatters.
+ */
+
+ if (res == NULL && naml == 2 &&
+ stnam[0] == '.' && stnam[1] == 'T') {
+ roff_setstrn(&r->strtab,
+ ".T", 2, NULL, 0, 0);
+ stesc--;
+ continue;
+ }
}
break;
case 'B':
-/* $OpenBSD: term.c,v 1.134 2017/07/28 14:24:17 florian Exp $ */
+/* $OpenBSD: term.c,v 1.135 2018/08/16 13:49:40 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2018 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
else if (*word == '\0')
p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
continue;
+ case ESCAPE_DEVICE:
+ if (p->type == TERMTYPE_PDF)
+ encode(p, "pdf", 3);
+ else if (p->type == TERMTYPE_PS)
+ encode(p, "ps", 2);
+ else if (p->enc == TERMENC_ASCII)
+ encode(p, "ascii", 5);
+ else
+ encode(p, "utf8", 4);
+ continue;
case ESCAPE_HORIZ:
if (*seq == '|') {
seq++;
sz += cond_width(p, uc, &skip);
}
continue;
+ case ESCAPE_DEVICE:
+ if (p->type == TERMTYPE_PDF) {
+ rhs = "pdf";
+ rsz = 3;
+ } else if (p->type == TERMTYPE_PS) {
+ rhs = "ps";
+ rsz = 2;
+ } else if (p->enc == TERMENC_ASCII) {
+ rhs = "ascii";
+ rsz = 5;
+ } else {
+ rhs = "utf8";
+ rsz = 4;
+ }
+ break;
case ESCAPE_SKIPCHAR:
skip = 1;
continue;