From e78c0105d316303330c2e040cc39f666461fa1ee Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Wed, 8 Apr 2015 18:45:31 +0200 Subject: [PATCH] Indicated by #191, why show doctype warning if omitted in output --- src/parser.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/parser.c b/src/parser.c index de88c27..706b1e2 100644 --- a/src/parser.c +++ b/src/parser.c @@ -4671,10 +4671,16 @@ void TY_(ParseDocument)(TidyDocImpl* doc) else html = node; - /* #72, avoid MISSING_DOCTYPE if show-body-only. */ - if (!TY_(FindDocType)(doc) && !showingBodyOnly(doc)) - TY_(ReportError)(doc, NULL, NULL, MISSING_DOCTYPE); - + /*\ + * #72, avoid MISSING_DOCTYPE if show-body-only. + * #191, also if --doctype omit, that is TidyDoctypeOmit + \*/ + if (!TY_(FindDocType)(doc) && !showingBodyOnly(doc)) + { + ulong dtmode = cfg( doc, TidyDoctypeMode ); + if (dtmode != TidyDoctypeOmit) + TY_(ReportError)(doc, NULL, NULL, MISSING_DOCTYPE); + } TY_(InsertNodeAtEnd)( &doc->root, html); TY_(ParseHTML)( doc, html, IgnoreWhitespace ); break;