mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
Implement SkipStyle, add test
Fix a bug in findHtmlTagPos introduced with e02c392d
.
This commit is contained in:
parent
fecfec2059
commit
7e9a57463f
5
html.go
5
html.go
|
@ -884,7 +884,7 @@ func findHtmlTagPos(tag []byte, tagname string) (bool, int) {
|
|||
}
|
||||
|
||||
rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>')
|
||||
if rightAngle > i {
|
||||
if rightAngle >= i {
|
||||
return true, rightAngle
|
||||
}
|
||||
|
||||
|
@ -1133,6 +1133,9 @@ func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus {
|
|||
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 {
|
||||
|
|
|
@ -1139,6 +1139,15 @@ func TestSkipImages(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
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{
|
||||
"---",
|
||||
|
|
Loading…
Reference in New Issue
Block a user