all repos — grayfriday @ 7e9a57463ff1634bca3967415fb5c6e841eb8c3a

blackfriday fork with a few changes

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
commit

7e9a57463ff1634bca3967415fb5c6e841eb8c3a

parent

fecfec2059f4488cbe431b57be0bdca6b3c63e9b

2 files changed, 13 insertions(+), 1 deletions(-)

jump to
M html.gohtml.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.goinline_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{ "---",