summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-17 16:47:48 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-17 16:47:48 +0000
commite480ff62446a168d7089e1c658d50d312188af05 (patch)
tree4ac2e9dfb0c0d4d2adfd736df51f647434114461
parentb22a929d117e71834f587cea03908a8196c8c4d0 (diff)
downloadmandoc-e480ff62446a168d7089e1c658d50d312188af05.tar.gz
if .in is used inside the .TP head, it's always relative
-rw-r--r--man_macro.c2
-rw-r--r--man_validate.c21
-rw-r--r--regress/man/TP/Makefile2
-rw-r--r--regress/man/TP/indent.in14
-rw-r--r--regress/man/TP/indent.out_ascii20
5 files changed, 55 insertions, 4 deletions
diff --git a/man_macro.c b/man_macro.c
index 4f00ff0a..372db79b 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -69,7 +69,7 @@ const struct man_macro __man_macros[MAN_MAX - MAN_TH] = {
{ in_line_eoln, 0 }, /* UC */
{ in_line_eoln, MAN_NSCOPED }, /* PD */
{ in_line_eoln, 0 }, /* AT */
- { in_line_eoln, 0 }, /* in */
+ { in_line_eoln, MAN_NSCOPED }, /* in */
{ in_line_eoln, 0 }, /* OP */
{ in_line_eoln, MAN_BSCOPE }, /* EX */
{ in_line_eoln, MAN_BSCOPE }, /* EE */
diff --git a/man_validate.c b/man_validate.c
index 64f54a4f..759c42ac 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -47,11 +47,12 @@ static void check_text(CHKARGS);
static void post_AT(CHKARGS);
static void post_IP(CHKARGS);
-static void post_vs(CHKARGS);
static void post_OP(CHKARGS);
static void post_TH(CHKARGS);
static void post_UC(CHKARGS);
static void post_UR(CHKARGS);
+static void post_in(CHKARGS);
+static void post_vs(CHKARGS);
static const v_check __man_valids[MAN_MAX - MAN_TH] = {
post_TH, /* TH */
@@ -82,7 +83,7 @@ static const v_check __man_valids[MAN_MAX - MAN_TH] = {
post_UC, /* UC */
NULL, /* PD */
post_AT, /* AT */
- NULL, /* in */
+ post_in, /* in */
post_OP, /* OP */
NULL, /* EX */
NULL, /* EE */
@@ -435,6 +436,22 @@ post_AT(CHKARGS)
}
static void
+post_in(CHKARGS)
+{
+ char *s;
+
+ if (n->parent->tok != MAN_TP ||
+ n->parent->type != ROFFT_HEAD ||
+ n->child == NULL ||
+ *n->child->string == '+' ||
+ *n->child->string == '-')
+ return;
+ mandoc_asprintf(&s, "+%s", n->child->string);
+ free(n->child->string);
+ n->child->string = s;
+}
+
+static void
post_vs(CHKARGS)
{
diff --git a/regress/man/TP/Makefile b/regress/man/TP/Makefile
index 8d81e954..b1763652 100644
--- a/regress/man/TP/Makefile
+++ b/regress/man/TP/Makefile
@@ -1,6 +1,6 @@
# $OpenBSD: Makefile,v 1.12 2015/09/21 13:24:32 schwarze Exp $
-REGRESS_TARGETS = badarg broken double eof fill literal longhead
+REGRESS_TARGETS = badarg broken double eof fill indent literal longhead
REGRESS_TARGETS += macrotag manyargs sameline spacing width
LINT_TARGETS = broken double eof
diff --git a/regress/man/TP/indent.in b/regress/man/TP/indent.in
new file mode 100644
index 00000000..5480da67
--- /dev/null
+++ b/regress/man/TP/indent.in
@@ -0,0 +1,14 @@
+.TH TP-INDENT 1 "June 17, 2017" OpenBSD
+.SH NAME
+TP-indent \- indent request inside TP head
+.SH DESCRIPTION
+initial text
+.TP 2n
+tag
+indented
+.TP 8n
+.in 3n
+tag
+indented
+.PP
+final text
diff --git a/regress/man/TP/indent.out_ascii b/regress/man/TP/indent.out_ascii
new file mode 100644
index 00000000..9e015b21
--- /dev/null
+++ b/regress/man/TP/indent.out_ascii
@@ -0,0 +1,20 @@
+TP-INDENT(1) General Commands Manual TP-INDENT(1)
+
+
+
+NNAAMMEE
+ TP-indent - indent request inside TP head
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+
+ tag
+ indented
+
+ tag indented
+
+ final text
+
+
+
+OpenBSD June 17, 2017 TP-INDENT(1)