<p dir="auto">by <strong><a href="mailto:markf@wingedpig.com">markf@wingedpig.com</a></strong>:</p>
<pre class="notranslate">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 := `&lt;div style="width:450px; font-family: 'Georgia', 'Times', 'Times New Roman', 'serif';" contenteditable="false"&gt;`
    doc, err := html.Parse(strings.NewReader(data))
    if err != nil {
        log.Printf("html.Parse returned %s", err)
        return
    }
    var b bytes.Buffer
    err = Render(&amp;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</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/7753/0/render.patch" rel="nofollow">render.patch</a> (500 bytes)</li>
</ol>
<p dir="auto">by <strong>ranveerkunal</strong>:</p>
<pre class="notranslate">What steps will reproduce the problem?
I am trying to use:
<a href="https://github.com/nsf/termbox-go">https://github.com/nsf/termbox-go</a>

but when I do go build on the code I get link errors.

Little Details:
Code:
############################################
package main

import(
       "log"

       termbox "github.com/nsf/termbox-go"
)

func main() {
       err := termbox.Init()
       if err != nil {
               log.Fatalf("termbox.Init() failed: %v", err)
       }
       defer termbox.Shutdown()
       log.Printf("termbox.Init() success")
}

############################################

Error:
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(input.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(input.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): keys: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(term.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
/Users/ranveer/gocode/pkg/darwin_amd64/github.com/nsf/termbox-
go.a(termbox.o)(__TEXT/__text): funcs: not defined
too many errors

What is the expected output?
Should compile.

What do you see instead?
Linking errors

Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?
MacOsx

Which revision are you using?  (hg identify)
a45cc1950c26 tip

Please provide any additional information below.</pre>