Implement SkipStyle, add test Fix a bug in findHtmlTagPos introduced with e02c392d.
Vytautas Ĺ altenis vytas@rtfb.lt
Tue, 05 Apr 2016 12:13:37 +0300
2 files changed,
13 insertions(+),
1 deletions(-)
M
html.go
→
html.go
@@ -884,7 +884,7 @@ return false, -1
} rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>') - if rightAngle > i { + if rightAngle >= i { return true, rightAngle }@@ -1133,6 +1133,9 @@ } else {
r.out(w, tag("/del", nil, false)) } case HTMLSpan: + if r.flags&SkipStyle != 0 && isHtmlTag(node.Literal, "style") { + break + } //if options.safe { // out(w, "<!-- raw HTML omitted -->") //} else {
M
inline_test.go
→
inline_test.go
@@ -1139,6 +1139,15 @@ HTMLFlags: SkipImages,
}) } +func TestSkipStyle(t *testing.T) { + doTestsInlineParam(t, []string{ + "foo\n\n<style>color: #f00</style> bar", + "<p>foo</p>\n\n<p>color: #f00 bar</p>\n", + }, TestParams{ + HTMLFlags: SkipStyle, + }) +} + func TestUseXHTML(t *testing.T) { doTestsParam(t, []string{ "---",