From 83b4cb6062026552be18b31998adc933abb2c39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Tue, 5 Apr 2016 12:37:02 +0300 Subject: [PATCH] Implement SkipHTML, add test --- html.go | 6 ++++++ inline_test.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/html.go b/html.go index 754213e..a60cdd6 100644 --- a/html.go +++ b/html.go @@ -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&SkipHTML != 0 { + break + } if r.flags&SkipStyle != 0 && isHtmlTag(node.Literal, "style") { break } @@ -1237,6 +1240,9 @@ func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus { } break case HTMLBlock: + if r.flags&SkipHTML != 0 { + break + } r.cr(w) r.out(w, node.Literal) r.cr(w) diff --git a/inline_test.go b/inline_test.go index 0d10ff5..8a713a0 100644 --- a/inline_test.go +++ b/inline_test.go @@ -1158,3 +1158,13 @@ func TestUseXHTML(t *testing.T) { "
\n", }, TestParams{HTMLFlags: UseXHTML}) } + +func TestSkipHTML(t *testing.T) { + doTestsParam(t, []string{ + "
\n\ntext\n\n
the form
", + "

text

\n", + + "text inline html more text", + "

text inline html more text

\n", + }, TestParams{HTMLFlags: SkipHTML}) +}