]> Cypherpunks repositories - gostls13.git/commitdiff
exp/template: rename filter: url -> urlquery.
authorDavid Symonds <dsymonds@golang.org>
Sat, 13 Aug 2011 04:00:16 +0000 (14:00 +1000)
committerDavid Symonds <dsymonds@golang.org>
Sat, 13 Aug 2011 04:00:16 +0000 (14:00 +1000)
R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046

lib/godoc/codewalk.html
lib/godoc/codewalkdir.html
lib/godoc/dirlist.html
lib/godoc/godoc.html
lib/godoc/package.html
lib/godoc/search.html
src/pkg/exp/template/doc.go
src/pkg/exp/template/exec_test.go
src/pkg/exp/template/funcs.go

index 59a9efcf2d91deed641e78cdeb27014b0ac9ac46..2835c6e82c545663eefaf8347fc6131d2c549faf 100644 (file)
@@ -19,7 +19,7 @@
         </a>
         <select id="code-selector">
           {{range .File}}
-          <option value="/doc/codewalk/?fileprint=/{{url .}}">{{html .}}</option>
+          <option value="/doc/codewalk/?fileprint=/{{urlquery .}}">{{html .}}</option>
           {{end}}
         </select>
       </div>
@@ -37,7 +37,7 @@
     <div id="comment-area">
       {{range .Step}}
       <div class="comment first last">
-        <a class="comment-link" href="/doc/codewalk/?fileprint=/{{url .File}}&lo={{url .Lo}}&hi={{url .Hi}}#mark" target="code-display"></a>
+        <a class="comment-link" href="/doc/codewalk/?fileprint=/{{urlquery .File}}&lo={{urlquery .Lo}}&hi={{urlquery .Hi}}#mark" target="code-display"></a>
         <div class="comment-title">{{html .Title}}</div>
         <div class="comment-text">
        {{with .Err}}
index b174020e8e68a734290fa31dbffa5712f8ce36a5..6fe1a0565ae76831a6f4d9e49961ef52e88f0b7a 100644 (file)
@@ -7,7 +7,7 @@
 <table class="layout">
 {{range .}}
 <tr>
-    <td><a href="{{url .Name}}">{{html .Name}}</a></td>
+    <td><a href="{{html .Name}}">{{html .Name}}</a></td>
     <td width="25">&nbsp;</td>
     <td>{{html .Title}}</td>
 </tr>
index 5a3ddfaf396f95eafd07a4fa60d879e284f10dde..422397e522d9261b5eff2ec1d211cdec9b6f7b06 100644 (file)
@@ -18,7 +18,7 @@
 </tr>
 {{range .}}
 <tr>
-       <td align="left"><a href="{{.|fileInfoName|url}}">{{.|fileInfoName|html}}</a></td>
+       <td align="left"><a href="{{.|fileInfoName|html}}">{{.|fileInfoName|html}}</a></td>
        <td></td>
        <td align="right">{{html .Size}}</td>
        <td></td>
index e978b309c6e25940238b1548eed66aeb7509ddcc..91e521258d6a7206bd6c526c0d6bd3ff4dccaf8f 100644 (file)
@@ -25,7 +25,7 @@
         <form method="GET" action="/search">
         {{with .PkgRoots}}
         {{range .PkgRoots}}
-        <a href="/pkg/{{url .}}">{{html .}}</a> <span class="sep">|</span>
+        <a href="/pkg/{{html .}}">{{html .}}</a> <span class="sep">|</span>
         {{end}}
         {{else}}
         References:
index 265e5d53b5109a4c65e25caa210fc96f1e4db929..0bc017379c639f36989cf745d8887a1c99401cbd 100644 (file)
@@ -87,7 +87,7 @@
        <p>
        {{/* PList entries are strings - no need for FSet */}}
        {{range .}}
-       <a href="?p={{url .}}">{{html .}}</a><br />
+       <a href="?p={{urlquery .}}">{{html .}}</a><br />
        {{end}}
        </p>
 {{end}}
index 39eec9b4983594a5d61c5e53b9a03dddcd9c4709..946160cf53189b71c19993f235283ace70051eff 100644 (file)
@@ -12,7 +12,7 @@
        <p>
        <span class="alert" style="font-size:120%">Did you mean: </span>
        {{range .Alts}}
-               <a href="search?q={{url .}}" style="font-size:120%">{{html .}}</a>
+               <a href="search?q={{urlquery .}}" style="font-size:120%">{{html .}}</a>
        {{end}}
        </p>
 {{end}}
                <h2 id="Global">Package-level declarations</h2>
                {{range .}}
                        {{$pkg := pkgLink .Pak.Path}}
-                       <h3 id="Global_{{html $pkg}}">package <a href="/{{url $pkg}}">{{html .Pak.Name}}</a></h3>
+                       <h3 id="Global_{{html $pkg}}">package <a href="/{{$pkg}}">{{html .Pak.Name}}</a></h3>
                        {{range .Files}}
                                {{$src := srcLink .File.Path}}
                                {{range .Groups}}
                                        {{range .Infos}}
-                                               <a href="/{{url $src}}?h={{url $.Query}}#L{{infoLine .}}">{{html $src}}:{{infoLine .}}</a>
+                                               <a href="/{{$src}}?h={{urlquery $.Query}}#L{{infoLine .}}">{{html $src}}:{{infoLine .}}</a>
                                                {{infoSnippet_html .}}
                                        {{end}}
                                {{end}}
                <h2 id="Local">Local declarations and uses</h2>
                {{range .}}
                        {{$pkg := pkgLink .Pak.Path}}
-                       <h3 id="Local_{{html $pkg}}">package <a href="/{{url $pkg}}">{{html .Pak.Name}}</a></h3>
+                       <h3 id="Local_{{html $pkg}}">package <a href="/{{$pkg}}">{{html .Pak.Name}}</a></h3>
                        {{range .Files}}
                                {{$src := srcLink .File.Path}}
-                               <a href="/{{url $src}}?h={{url $.Query}}">{{html $src}}</a>
+                               <a href="/{{$src}}?h={{urlquery $.Query}}">{{html $src}}</a>
                                <table class="layout">
                                {{range .Groups}}
                                        <tr>
@@ -49,7 +49,7 @@
                                        <td align="left" width="4"></td>
                                        <td>
                                        {{range .Infos}}
-                                               <a href="/{{url $src}}?h={{url $.Query}}#L{{infoLine .}}">{{infoLine .}}</a>
+                                               <a href="/{{$src}}?h={{urlquery $.Query}}#L{{infoLine .}}">{{infoLine .}}</a>
                                        {{end}}
                                        </td>
                                        </tr>
                {{$src := srcLink .Filename}}
                <tr>
                <td align="left" valign="top">
-               <a href="/{{url $src}}?h={{url $.Query}}">{{html $src}}</a>:
+               <a href="/{{$src}}?h={{urlquery $.Query}}">{{html $src}}</a>:
                </td>
                <td align="left" width="4"></td>
                <th align="left" valign="top">{{len .Lines}}</th>
                <td align="left" width="4"></td>
                <td align="left">
                {{range .Lines}}
-                       <a href="/{{url $src}}?h={{url $.Query}}#L{{url .}}">{{html .}}</a>
+                       <a href="/{{$src}}?h={{urlquery $.Query}}#L{{.}}">{{html .}}</a>
                {{end}}
                {{if not $.Complete}}
                        ...
index ed0172ac8e6b64e3d1cadd5169a92fd43d6b6e97..46a38040e3b1c6e7ce258ec78395b12c9112d257 100644 (file)
@@ -247,9 +247,9 @@ Predefined global functions are named as follows.
                An alias for fmt.Sprintf
        println
                An alias for fmt.Sprintln
-       url
+       urlquery
                Returns the escaped value of the textual representation of
-               its arguments in a form suitable for embedding in a URL.
+               its arguments in a form suitable for embedding in a URL query.
 
 The boolean functions take any zero value to be false and a non-zero value to
 be true.
index 58e95263036d1f7d627ac44b6357eaf7b95a1bb4..a8ef64d2e0f63aeafbee1d57b0380dfc83877702 100644 (file)
@@ -313,8 +313,8 @@ var execTests = []execTest{
        // JavaScript.
        {"js", `{{js .}}`, `It\'d be nice.`, `It'd be nice.`, true},
 
-       // URL.
-       {"url", `{{"http://www.example.org/"|url}}`, "http%3A%2F%2Fwww.example.org%2F", nil, true},
+       // URL query.
+       {"urlquery", `{{"http://www.example.org/"|urlquery}}`, "http%3A%2F%2Fwww.example.org%2F", nil, true},
 
        // Booleans
        {"not", "{{not true}} {{not false}}", "false true", nil, true},
index b2878a161b3de2b1555e755449e2fd1c57fed737..6de46aa451a4ebef620fe8391bbbb6d3db5e0489 100644 (file)
@@ -23,17 +23,17 @@ import (
 type FuncMap map[string]interface{}
 
 var builtins = FuncMap{
-       "and":     and,
-       "html":    HTMLEscaper,
-       "index":   index,
-       "js":      JSEscaper,
-       "len":     length,
-       "not":     not,
-       "or":      or,
-       "print":   fmt.Sprint,
-       "printf":  fmt.Sprintf,
-       "println": fmt.Sprintln,
-       "url":     URLEscaper,
+       "and":      and,
+       "html":     HTMLEscaper,
+       "index":    index,
+       "js":       JSEscaper,
+       "len":      length,
+       "not":      not,
+       "or":       or,
+       "print":    fmt.Sprint,
+       "printf":   fmt.Sprintf,
+       "println":  fmt.Sprintln,
+       "urlquery": URLQueryEscaper,
 }
 
 var builtinFuncs = createValueFuncs(builtins)
@@ -354,9 +354,9 @@ func JSEscaper(args ...interface{}) string {
        return JSEscapeString(s)
 }
 
-// URLEscaper returns the escaped value of the textual representation of its
-// arguments in a form suitable for embedding in a URL.
-func URLEscaper(args ...interface{}) string {
+// URLQueryEscaper returns the escaped value of the textual representation of
+// its arguments in a form suitable for embedding in a URL query.
+func URLQueryEscaper(args ...interface{}) string {
        s, ok := "", false
        if len(args) == 1 {
                s, ok = args[0].(string)