From: Andrew Gerrand Date: Thu, 26 Apr 2012 18:34:54 +0000 (-0700) Subject: [release-branch.go1] doc: update wiki article to use html/template properly. X-Git-Tag: go1.0.1~6 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cbffaffa6d904df85c6e6e37179a603f57666053;p=gostls13.git [release-branch.go1] doc: update wiki article to use html/template properly. ««« CL 6116055 / d282c379aad7 doc: update wiki article to use html/template properly. Fixes #3569. R=golang-dev, r CC=golang-dev https://golang.org/cl/6116055 »»» R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6119055 --- diff --git a/doc/articles/wiki/edit.html b/doc/articles/wiki/edit.html index c14953b17b..044c3bedea 100644 --- a/doc/articles/wiki/edit.html +++ b/doc/articles/wiki/edit.html @@ -1,6 +1,6 @@ -

Editing {{.Title |html}}

+

Editing {{.Title}}

-
-
+ +
diff --git a/doc/articles/wiki/index.html b/doc/articles/wiki/index.html index 52bf7e798b..6c45d7178e 100644 --- a/doc/articles/wiki/index.html +++ b/doc/articles/wiki/index.html @@ -359,10 +359,10 @@ First, we must add html/template to the list of imports:
 import (
+	"html/template"
 	"http"
 	"io/ioutil"
 	"os"
-	"html/template"
 )
 
@@ -397,10 +397,11 @@ Template directives are enclosed in double curly braces. The printf "%s" .Body instruction is a function call that outputs .Body as a string instead of a stream of bytes, the same as a call to fmt.Printf. -The |html part of each directive pipes the value through the -html formatter before outputting it, which escapes HTML -characters (such as replacing > with >), -preventing user data from corrupting the form HTML. +The html/template package helps guarantee that only safe and +correct-looking HTML is generated by template actions. For instance, it +automatically escapes any greater than sign (>), replacing it +with >, to make sure user data does not corrupt the form +HTML.

diff --git a/doc/articles/wiki/view.html b/doc/articles/wiki/view.html index 0233915774..b1e87efe80 100644 --- a/doc/articles/wiki/view.html +++ b/doc/articles/wiki/view.html @@ -1,5 +1,5 @@ -

{{.Title |html}}

+

{{.Title}}

-

[edit]

+

[edit]

-
{{printf "%s" .Body |html}}
+
{{printf "%s" .Body}}