-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore unknown HTML tags to prevent noisy warnings
blackfriday v2 introduced "HTMLSpan" as a node-type, causing go-md2man to produce warnings as it didn't have specific handling for these nodes. This patch makes go-md2man ignore these node types (e.g. <span> elements, or <svg>), and skip the element themselves (only rendering their content, if any), to prevent go-md2man printing noisy warnings during generation: WARNING: go-md2man does not handle node type HTMLSpan WARNING: go-md2man does not handle node type HTMLSpan WARNING: go-md2man does not handle node type HTMLSpan WARNING: go-md2man does not handle node type HTMLSpan WARNING: go-md2man does not handle node type HTMLSpan ... Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,6 +287,40 @@ func TestEscapeCharacters(t *testing.T) { | |
doTestsInline(t, tests) | ||
} | ||
|
||
func TestSpan(t *testing.T) { | ||
var tests = []string{ | ||
"Text containing a <span>html span</span> element\n", | ||
".nh\n\n.PP\nText containing a html span element\n", | ||
|
||
`Text containing an inline <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><image href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="200" width="200"/></svg>SVG image`, | ||
".nh\n\n.PP\nText containing an inline SVG image\n", | ||
|
||
"Text containing a <span id=\"e-123\" class=\"foo\">html span</span> element\n", | ||
".nh\n\n.PP\nText containing a html span element\n", | ||
} | ||
doTestsInline(t, tests) | ||
} | ||
|
||
func TestEmails(t *testing.T) { | ||
var tests = []string{ | ||
`April 2014, Originally compiled by William Henry (whenry at redhat dot com) | ||
based on docker.com source material and internal work. | ||
June 2014, updated by Sven Dowideit <[email protected]> | ||
July 2014, updated by Sven Dowideit ([email protected]) | ||
`, | ||
`.nh | ||
.PP | ||
April 2014, Originally compiled by William Henry (whenry at redhat dot com) | ||
based on docker.com source material and internal work. | ||
June 2014, updated by Sven Dowideit [email protected] | ||
\[la]mailto:[email protected]\[ra] | ||
July 2014, updated by Sven Dowideit ([email protected]) | ||
`, | ||
} | ||
doTestsInline(t, tests) | ||
} | ||
|
||
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 | ||
|