From 0fde2fa390d9a4194f8a09e5c0f5d921d8755109 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 11 Apr 2018 17:11:13 +0000 Subject: preserve comments before .Dd when converting mdoc(7) to man(7) with mandoc -Tman; suggested by Thomas Klausner --- man_term.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'man_term.c') diff --git a/man_term.c b/man_term.c index 8946a050..1404602b 100644 --- a/man_term.c +++ b/man_term.c @@ -1,7 +1,7 @@ -/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */ +/* $Id: man_term.c,v 1.210 2018/04/11 17:11:13 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2015, 2017 Ingo Schwarze + * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -675,7 +675,8 @@ pre_SS(DECL_ARGS) n = n->prev; } while (n != NULL && n->tok >= MAN_TH && termacts[n->tok].flags & MAN_NOTEXT); - if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL)) + if (n == NULL || n->type == ROFFT_COMMENT || + (n->tok == MAN_SS && n->body->child == NULL)) break; for (i = 0; i < mt->pardist; i++) @@ -737,7 +738,8 @@ pre_SH(DECL_ARGS) n = n->prev; } while (n != NULL && n->tok >= MAN_TH && termacts[n->tok].flags & MAN_NOTEXT); - if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL)) + if (n == NULL || n->type == ROFFT_COMMENT || + (n->tok == MAN_SH && n->body->child == NULL)) break; for (i = 0; i < mt->pardist; i++) @@ -885,7 +887,8 @@ print_man_node(DECL_ARGS) term_word(p, n->string); goto out; - + case ROFFT_COMMENT: + return; case ROFFT_EQN: if ( ! (n->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; -- cgit v1.2.3-56-ge451