Unescape sanitized HTML

This commit is contained in:
Christian Muehlhaeuser
2019-11-25 07:28:58 +01:00
parent 66d599db99
commit ef9ee10b74
+4 -3
View File
@@ -3,6 +3,7 @@ package gold
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"html"
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
@@ -246,7 +247,7 @@ func NewElement(node *bf.Node) Element {
Pre: "", Pre: "",
Post: "", Post: "",
Fragments: []Fragment{{ Fragments: []Fragment{{
Token: stripper.Sanitize(string(node.Literal)), Token: html.UnescapeString(stripper.Sanitize(string(node.Literal))),
Style: Text, Style: Text,
}}, }},
} }
@@ -255,7 +256,7 @@ func NewElement(node *bf.Node) Element {
Pre: "", Pre: "",
Post: "", Post: "",
Fragments: []Fragment{{ Fragments: []Fragment{{
Token: strings.TrimSpace(stripper.Sanitize(string(node.Literal))) + "\n", Token: html.UnescapeString(strings.TrimSpace(stripper.Sanitize(string(node.Literal)))) + "\n",
Style: HTMLBlock, Style: HTMLBlock,
}}, }},
} }
@@ -300,7 +301,7 @@ func NewElement(node *bf.Node) Element {
Pre: "", Pre: "",
Post: "", Post: "",
Fragments: []Fragment{{ Fragments: []Fragment{{
Token: strings.TrimSpace(stripper.Sanitize(string(node.Literal))) + "\n", Token: html.UnescapeString(strings.TrimSpace(stripper.Sanitize(string(node.Literal)))) + "\n",
Style: HTMLSpan, Style: HTMLSpan,
}}, }},
} }