Warn about text sanitization
This commit is contained in:
parent
8b746ee3c0
commit
379bd3ad00
@ -57,6 +57,8 @@ func (EmptyElement) isHtml() {}
|
|||||||
|
|
||||||
// WriteTo writes the HTML markup represented by e to w, returning the number
|
// WriteTo writes the HTML markup represented by e to w, returning the number
|
||||||
// of bytes written and any error encountered.
|
// of bytes written and any error encountered.
|
||||||
|
//
|
||||||
|
// See the warning about sanitization in the (Attrib).WriteTo documentation.
|
||||||
func (e EmptyElement) WriteTo(w io.Writer) (n int64, err error) {
|
func (e EmptyElement) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
err = writeStringsTo(w, &n, "<", e.TagName)
|
err = writeStringsTo(w, &n, "<", e.TagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -91,6 +93,8 @@ func (e ParentElement) isHtml() {}
|
|||||||
|
|
||||||
// WriteTo writes the HTML markup represented by e to w, returning the number
|
// WriteTo writes the HTML markup represented by e to w, returning the number
|
||||||
// of bytes written and any error encountered.
|
// of bytes written and any error encountered.
|
||||||
|
//
|
||||||
|
// See the warning about sanitization in the (Attrib).WriteTo documentation.
|
||||||
func (e ParentElement) WriteTo(w io.Writer) (n int64, err error) {
|
func (e ParentElement) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
n, err = e.EmptyElement.WriteTo(w)
|
n, err = e.EmptyElement.WriteTo(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -116,7 +120,8 @@ type Text string
|
|||||||
func (Text) isHtml() {}
|
func (Text) isHtml() {}
|
||||||
|
|
||||||
// WriteTo writes the contents of t to w, returning the number of bytes written
|
// WriteTo writes the contents of t to w, returning the number of bytes written
|
||||||
// and any error encountered.
|
// and any error encountered. It does not replace special characters with HTML
|
||||||
|
// entities; use html.EscapeString for this purpose.
|
||||||
func (t Text) WriteTo(w io.Writer) (n int64, err error) {
|
func (t Text) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
err = writeStringsTo(w, &n, string(t))
|
err = writeStringsTo(w, &n, string(t))
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user