diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-17 16:47:48 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-17 16:47:48 +0000 |
commit | fc10222b160be65e60f5afcce864bcc8a49b6b48 (patch) | |
tree | 661ae846db34c5ec18bd00ddb2a6f3c1de20329a | |
parent | 49598c9d922bda8ee429befd0845df1e70a49217 (diff) | |
download | mandoc-fc10222b160be65e60f5afcce864bcc8a49b6b48.tar.gz mandoc-fc10222b160be65e60f5afcce864bcc8a49b6b48.tar.zst mandoc-fc10222b160be65e60f5afcce864bcc8a49b6b48.zip |
if .in is used inside the .TP head, it's always relative
-rw-r--r-- | man_macro.c | 4 | ||||
-rw-r--r-- | man_validate.c | 21 | ||||
-rw-r--r-- | regress/man/TP/Makefile | 2 | ||||
-rw-r--r-- | regress/man/TP/indent.in | 14 | ||||
-rw-r--r-- | regress/man/TP/indent.out_ascii | 20 |
5 files changed, 56 insertions, 5 deletions
diff --git a/man_macro.c b/man_macro.c index 3b6fce81..6f04327f 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.121 2017/06/13 19:34:40 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.122 2017/06/17 16:47:48 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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) |