You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I posted this to go-nuts before realizing that this is probably a better place for this.
I apologize for the duplication.
Using code.google.com/p/go.net/html to parse and then re-render a chunk of HTML I
believe results in improper escaping of single quotes within double quotes. Here is a
simple test program that parses and re-renders a bit of HTML:
package main
import (
"bytes"
"fmt"
"log"
"strings"
"testing"
"code.google.com/p/go.net/html"
)
func main() {
data := `<div style="width:450px; font-family: 'Georgia', 'Times', 'Times New Roman', 'serif';" contenteditable="false">`
doc, err := html.Parse(strings.NewReader(data))
if err != nil {
log.Printf("html.Parse returned %s", err)
return
}
var b bytes.Buffer
err = Render(&b, doc)
if err != nil {
log.Printf("html.Render returned %s", err)
return
}
fmt.Printf("%s\n", b.String())
}
The single quotes are improperly escaped in the re-rendered code.
I believe the original HTML is valid. I've attached a small patch that fixes the
problem.
Thanks,
Mark
In the cold light of morning, after a late night of chasing other bugs, I was wrong. The
extra escaping doesn't in fact result in invalid HTML, just HTML that's a little more
ugly. Apologies for the bug report.
by markf@wingedpig.com:
Attachments:
The text was updated successfully, but these errors were encountered: