Commit 5e48e648 authored by David Symonds's avatar David Symonds

exp/template: rename filter: url -> urlquery.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046
parent c71b6767
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</a> </a>
<select id="code-selector"> <select id="code-selector">
{{range .File}} {{range .File}}
<option value="/doc/codewalk/?fileprint=/{{url .}}">{{html .}}</option> <option value="/doc/codewalk/?fileprint=/{{urlquery .}}">{{html .}}</option>
{{end}} {{end}}
</select> </select>
</div> </div>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<div id="comment-area"> <div id="comment-area">
{{range .Step}} {{range .Step}}
<div class="comment first last"> <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-title">{{html .Title}}</div>
<div class="comment-text"> <div class="comment-text">
{{with .Err}} {{with .Err}}
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<table class="layout"> <table class="layout">
{{range .}} {{range .}}
<tr> <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 width="25">&nbsp;</td>
<td>{{html .Title}}</td> <td>{{html .Title}}</td>
</tr> </tr>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</tr> </tr>
{{range .}} {{range .}}
<tr> <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></td>
<td align="right">{{html .Size}}</td> <td align="right">{{html .Size}}</td>
<td></td> <td></td>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<form method="GET" action="/search"> <form method="GET" action="/search">
{{with .PkgRoots}} {{with .PkgRoots}}
{{range .PkgRoots}} {{range .PkgRoots}}
<a href="/pkg/{{url .}}">{{html .}}</a> <span class="sep">|</span> <a href="/pkg/{{html .}}">{{html .}}</a> <span class="sep">|</span>
{{end}} {{end}}
{{else}} {{else}}
References: References:
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<p> <p>
{{/* PList entries are strings - no need for FSet */}} {{/* PList entries are strings - no need for FSet */}}
{{range .}} {{range .}}
<a href="?p={{url .}}">{{html .}}</a><br /> <a href="?p={{urlquery .}}">{{html .}}</a><br />
{{end}} {{end}}
</p> </p>
{{end}} {{end}}
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<p> <p>
<span class="alert" style="font-size:120%">Did you mean: </span> <span class="alert" style="font-size:120%">Did you mean: </span>
{{range .Alts}} {{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}} {{end}}
</p> </p>
{{end}} {{end}}
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
<h2 id="Global">Package-level declarations</h2> <h2 id="Global">Package-level declarations</h2>
{{range .}} {{range .}}
{{$pkg := pkgLink .Pak.Path}} {{$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}} {{range .Files}}
{{$src := srcLink .File.Path}} {{$src := srcLink .File.Path}}
{{range .Groups}} {{range .Groups}}
{{range .Infos}} {{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 .}} {{infoSnippet_html .}}
{{end}} {{end}}
{{end}} {{end}}
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
<h2 id="Local">Local declarations and uses</h2> <h2 id="Local">Local declarations and uses</h2>
{{range .}} {{range .}}
{{$pkg := pkgLink .Pak.Path}} {{$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}} {{range .Files}}
{{$src := srcLink .File.Path}} {{$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"> <table class="layout">
{{range .Groups}} {{range .Groups}}
<tr> <tr>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<td align="left" width="4"></td> <td align="left" width="4"></td>
<td> <td>
{{range .Infos}} {{range .Infos}}
<a href="/{{url $src}}?h={{url $.Query}}#L{{infoLine .}}">{{infoLine .}}</a> <a href="/{{$src}}?h={{urlquery $.Query}}#L{{infoLine .}}">{{infoLine .}}</a>
{{end}} {{end}}
</td> </td>
</tr> </tr>
...@@ -74,14 +74,14 @@ ...@@ -74,14 +74,14 @@
{{$src := srcLink .Filename}} {{$src := srcLink .Filename}}
<tr> <tr>
<td align="left" valign="top"> <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>
<td align="left" width="4"></td> <td align="left" width="4"></td>
<th align="left" valign="top">{{len .Lines}}</th> <th align="left" valign="top">{{len .Lines}}</th>
<td align="left" width="4"></td> <td align="left" width="4"></td>
<td align="left"> <td align="left">
{{range .Lines}} {{range .Lines}}
<a href="/{{url $src}}?h={{url $.Query}}#L{{url .}}">{{html .}}</a> <a href="/{{$src}}?h={{urlquery $.Query}}#L{{.}}">{{html .}}</a>
{{end}} {{end}}
{{if not $.Complete}} {{if not $.Complete}}
... ...
......
...@@ -247,9 +247,9 @@ Predefined global functions are named as follows. ...@@ -247,9 +247,9 @@ Predefined global functions are named as follows.
An alias for fmt.Sprintf An alias for fmt.Sprintf
println println
An alias for fmt.Sprintln An alias for fmt.Sprintln
url urlquery
Returns the escaped value of the textual representation of 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 The boolean functions take any zero value to be false and a non-zero value to
be true. be true.
......
...@@ -313,8 +313,8 @@ var execTests = []execTest{ ...@@ -313,8 +313,8 @@ var execTests = []execTest{
// JavaScript. // JavaScript.
{"js", `{{js .}}`, `It\'d be nice.`, `It'd be nice.`, true}, {"js", `{{js .}}`, `It\'d be nice.`, `It'd be nice.`, true},
// URL. // URL query.
{"url", `{{"http://www.example.org/"|url}}`, "http%3A%2F%2Fwww.example.org%2F", nil, true}, {"urlquery", `{{"http://www.example.org/"|urlquery}}`, "http%3A%2F%2Fwww.example.org%2F", nil, true},
// Booleans // Booleans
{"not", "{{not true}} {{not false}}", "false true", nil, true}, {"not", "{{not true}} {{not false}}", "false true", nil, true},
......
...@@ -23,17 +23,17 @@ import ( ...@@ -23,17 +23,17 @@ import (
type FuncMap map[string]interface{} type FuncMap map[string]interface{}
var builtins = FuncMap{ var builtins = FuncMap{
"and": and, "and": and,
"html": HTMLEscaper, "html": HTMLEscaper,
"index": index, "index": index,
"js": JSEscaper, "js": JSEscaper,
"len": length, "len": length,
"not": not, "not": not,
"or": or, "or": or,
"print": fmt.Sprint, "print": fmt.Sprint,
"printf": fmt.Sprintf, "printf": fmt.Sprintf,
"println": fmt.Sprintln, "println": fmt.Sprintln,
"url": URLEscaper, "urlquery": URLQueryEscaper,
} }
var builtinFuncs = createValueFuncs(builtins) var builtinFuncs = createValueFuncs(builtins)
...@@ -354,9 +354,9 @@ func JSEscaper(args ...interface{}) string { ...@@ -354,9 +354,9 @@ func JSEscaper(args ...interface{}) string {
return JSEscapeString(s) return JSEscapeString(s)
} }
// URLEscaper returns the escaped value of the textual representation of its // URLQueryEscaper returns the escaped value of the textual representation of
// arguments in a form suitable for embedding in a URL. // its arguments in a form suitable for embedding in a URL query.
func URLEscaper(args ...interface{}) string { func URLQueryEscaper(args ...interface{}) string {
s, ok := "", false s, ok := "", false
if len(args) == 1 { if len(args) == 1 {
s, ok = args[0].(string) s, ok = args[0].(string)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment