Skip to content

Commit

Permalink
Rename HTML_SKIP_SCRIPT to HTML_SANITIZE_OUTPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfb committed Jan 21, 2014
1 parent 55cd820 commit 2f50a53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions html.go
Expand Up @@ -29,7 +29,7 @@ const (
HTML_SKIP_STYLE // skip embedded <style> elements
HTML_SKIP_IMAGES // skip embedded images
HTML_SKIP_LINKS // skip all links
HTML_SKIP_SCRIPT // skip embedded <script> elements
HTML_SANITIZE_OUTPUT // strip output of everything that's not known to be safe
HTML_SAFELINK // only link to trusted protocols
HTML_TOC // generate a table of contents
HTML_OMIT_CONTENTS // skip the main contents (for a standalone table of contents)
Expand Down Expand Up @@ -536,9 +536,6 @@ func (options *Html) RawHtmlTag(out *bytes.Buffer, text []byte) {
if options.flags&HTML_SKIP_IMAGES != 0 && isHtmlTag(text, "img") {
return
}
if options.flags&HTML_SKIP_SCRIPT != 0 && isHtmlTag(text, "script") {
return
}
out.Write(text)
}

Expand Down
2 changes: 1 addition & 1 deletion inline_test.go
Expand Up @@ -202,7 +202,7 @@ func TestRawHtmlTag(t *testing.T) {
//"<iframe src=http://ha.ckers.org/scriptlet.html <",
//"",
}
doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE|HTML_SKIP_SCRIPT)
doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE|HTML_SANITIZE_OUTPUT)
}

func TestEmphasis(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions markdown.go
Expand Up @@ -233,7 +233,7 @@ func MarkdownCommon(input []byte) []byte {
htmlFlags |= HTML_USE_SMARTYPANTS
htmlFlags |= HTML_SMARTYPANTS_FRACTIONS
htmlFlags |= HTML_SMARTYPANTS_LATEX_DASHES
htmlFlags |= HTML_SKIP_SCRIPT
htmlFlags |= HTML_SANITIZE_OUTPUT
renderer := HtmlRenderer(htmlFlags, "", "")

// set up the parser
Expand Down Expand Up @@ -293,7 +293,7 @@ func Markdown(input []byte, renderer Renderer, extensions int) []byte {
first := firstPass(p, input)
second := secondPass(p, first)

if renderer.GetFlags()&HTML_SKIP_SCRIPT != 0 {
if renderer.GetFlags()&HTML_SANITIZE_OUTPUT != 0 {
second = sanitizeHtml(second)
}

Expand Down

0 comments on commit 2f50a53

Please sign in to comment.