aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-04-11 17:11:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-04-11 17:11:13 +0000
commit0fde2fa390d9a4194f8a09e5c0f5d921d8755109 (patch)
tree08324b073d43d72772f99a603423e81140da0263 /mdoc_term.c
parentaa23a004eb502cf67af388be4976d369784961db (diff)
downloadmandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.tar.gz
mandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.tar.zst
mandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.zip
preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 4a163b62..cf3e7ef3 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc_term.c,v 1.366 2018/04/05 09:17:26 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.367 2018/04/11 17:11:13 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -283,7 +283,9 @@ terminal_mdoc(void *arg, const struct roff_man *mdoc)
p->defindent = 5;
term_begin(p, print_mdoc_head, print_mdoc_foot,
&mdoc->meta);
- while (n != NULL && n->flags & NODE_NOPRT)
+ while (n != NULL &&
+ (n->type == ROFFT_COMMENT ||
+ n->flags & NODE_NOPRT))
n = n->next;
if (n != NULL) {
if (n->tok != MDOC_Sh)
@@ -312,7 +314,7 @@ print_mdoc_node(DECL_ARGS)
struct termpair npair;
size_t offset, rmargin;
- if (n->flags & NODE_NOPRT)
+ if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
return;
chld = 1;
@@ -567,7 +569,9 @@ print_bvspace(struct termp *p,
/* Do not vspace directly after Ss/Sh. */
nn = n;
- while (nn->prev != NULL && nn->prev->flags & NODE_NOPRT)
+ while (nn->prev != NULL &&
+ (nn->prev->type == ROFFT_COMMENT ||
+ nn->prev->flags & NODE_NOPRT))
nn = nn->prev;
while (nn->prev == NULL) {
do {
@@ -1550,7 +1554,8 @@ termp_ss_pre(DECL_ARGS)
case ROFFT_BLOCK:
term_newln(p);
for (nn = n->prev; nn != NULL; nn = nn->prev)
- if ((nn->flags & NODE_NOPRT) == 0)
+ if (nn->type != ROFFT_COMMENT &&
+ (nn->flags & NODE_NOPRT) == 0)
break;
if (nn != NULL)
term_vspace(p);