internal/web: stop double-escaping of code in non-playground examples

CL 317655 introduced an issue causing non-playground code examples
to be double-escaped, causing HTML escape sequences and elements
to appear in the code, such as the examples in crypto/rsa,
as reported in golang/go#46839. This change treats the code as
template.HTML rather than string after running through (*Page).Node
(which formats the code as HTML) and doing some basic transformations,
preventing this double-escaping from occurring.

Fixes golang/go#46839

Change-Id: Id226147eb51219bd5e2db61e959519258e39a298
GitHub-Last-Rev: 81f8dc5e878cd283f7d5865e73d214135838549b
GitHub-Pull-Request: golang/website#73
Reviewed-on: https://go-review.googlesource.com/c/website/+/332889
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
diff --git a/cmd/golangorg/testdata/web.txt b/cmd/golangorg/testdata/web.txt
index addbf91..8173793 100644
--- a/cmd/golangorg/testdata/web.txt
+++ b/cmd/golangorg/testdata/web.txt
@@ -191,3 +191,9 @@
 code == 200
 body contains <meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">
 body !contains UA-
+
+GET https://golang.org/pkg/crypto/rsa/?m=old
+body contains []byte(&#34;orders&#34;)
+body !contains []byte(&amp;#34;orders&amp;#34;)
+body contains <span class="comment">
+body !contains &lt;span class=&#34;comment&#34;&gt;
diff --git a/internal/web/examplefuncs.go b/internal/web/examplefuncs.go
index ce98d9d..a47dc27 100644
--- a/internal/web/examplefuncs.go
+++ b/internal/web/examplefuncs.go
@@ -74,9 +74,10 @@
 
 		newPage := *p
 		newPage.Data = struct {
-			Name, Doc, Code, Play, Output string
+			Name, Doc, Play, Output string
+			Code                    template.HTML
 		}{
-			eg.Name, eg.Doc, code, play, out,
+			eg.Name, eg.Doc, play, out, template.HTML(code),
 		}
 		err := t.Execute(&buf, &newPage)
 		if err != nil {