Implement SkipHTML, add test
Vytautas Ĺ altenis vytas@rtfb.lt
Tue, 05 Apr 2016 12:37:02 +0300
2 files changed,
16 insertions(+),
0 deletions(-)
M
html.go
→
html.go
@@ -1133,6 +1133,9 @@ } else {
r.out(w, tag("/del", nil, false)) } case HTMLSpan: + if r.flags&SkipHTML != 0 { + break + } if r.flags&SkipStyle != 0 && isHtmlTag(node.Literal, "style") { break }@@ -1237,6 +1240,9 @@ r.cr(w)
} break case HTMLBlock: + if r.flags&SkipHTML != 0 { + break + } r.cr(w) r.out(w, node.Literal) r.cr(w)
M
inline_test.go
→
inline_test.go
@@ -1158,3 +1158,13 @@ "---",
"<hr />\n", }, TestParams{HTMLFlags: UseXHTML}) } + +func TestSkipHTML(t *testing.T) { + doTestsParam(t, []string{ + "<div class=\"foo\"></div>\n\ntext\n\n<form>the form</form>", + "<p>text</p>\n", + + "text <em>inline html</em> more text", + "<p>text inline html more text</p>\n", + }, TestParams{HTMLFlags: SkipHTML}) +}