1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
package html
import (
"bytes"
"testing"
)
func TestEscapeHTMLCallouts(t *testing.T) {
buf := &bytes.Buffer{}
code := []byte(`println("hello")
more code //<<4>>
bliep bliep
`)
out := `println("hello")
more code <span class="callout">4</span>
bliep bliep
`
opts := RendererOptions{}
opts.Comments = [][]byte{[]byte("//")}
r := NewRenderer(opts)
r.EscapeHTMLCallouts(buf, code)
if buf.String() != out {
t.Error("callout code block not correctly parsed")
}
}
|