From e2293e7f480f1ba0e6632cbd4a307d32ff3007bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 25 Sep 2023 19:37:39 +0200 Subject: [PATCH] Don't warn on top-level comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comment test cases Signed-off-by: Miloslav Trmač --- md2man/roff.go | 5 +++++ md2man/roff_test.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/md2man/roff.go b/md2man/roff.go index f60948e..c238a78 100644 --- a/md2man/roff.go +++ b/md2man/roff.go @@ -167,6 +167,11 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering r.handleTableCell(w, node, entering) case blackfriday.HTMLSpan: // ignore other HTML tags + case blackfriday.HTMLBlock: + if bytes.HasPrefix(node.Literal, []byte("\n\nSecond paragraph\n", + ".nh\n\n.PP\nFirst paragraph\n\n.PP\nSecond paragraph\n", + } + doTestsParam(t, blockTests, TestParams{}) + + inlineTests := []string{ + "Text with a comment in the middle\n", + ".nh\n\n.PP\nText with a comment in the middle\n", + } + doTestsInlineParam(t, inlineTests, TestParams{}) +} + func execRecoverableTestSuite(t *testing.T, tests []string, params TestParams, suite func(candidate *string)) { // Catch and report panics. This is useful when running 'go test -v' on // the integration server. When developing, though, crash dump is often