Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions md2man/roff.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("<!--")) {
break // ignore comments, no warning
}
fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
default:
fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
}
Expand Down
14 changes: 14 additions & 0 deletions md2man/roff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,20 @@ July 2014, updated by Sven Dowideit ([email protected])
doTestsInline(t, tests)
}

func TestComments(t *testing.T) {
blockTests := []string{
"First paragraph\n\n<!-- Comment, HTML should be separated by blank lines -->\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 com<!--...-->ment 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
Expand Down