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_validate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'man_validate.c') diff --git a/man_validate.c b/man_validate.c index b3356ccb..d6c51af5 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,7 +1,7 @@ /* $OpenBSD$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012-2017 Ingo Schwarze + * Copyright (c) 2010, 2012-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 @@ -120,6 +120,7 @@ man_node_validate(struct roff_man *man) case ROFFT_ROOT: check_root(man, n); break; + case ROFFT_COMMENT: case ROFFT_EQN: case ROFFT_TBL: break; @@ -149,10 +150,9 @@ man_node_validate(struct roff_man *man) static void check_root(CHKARGS) { - assert((man->flags & (MAN_BLINE | MAN_ELINE)) == 0); - if (NULL == man->first->child) + if (n->last == NULL || n->last->type == ROFFT_COMMENT) mandoc_msg(MANDOCERR_DOC_EMPTY, man->parse, n->line, n->pos, NULL); else -- cgit v1.2.3-56-ge451