Source File
url.go
Belonging Package
html/template
package template
import (
)
func ( ...interface{}) string {
, := stringify(...)
if == contentTypeURL {
return
}
if !isSafeURL() {
return "#" + filterFailsafe
}
return
}
func ( ...interface{}) string {
return urlProcessor(false, ...)
}
func ( ...interface{}) string {
return urlProcessor(true, ...)
}
func ( bool, ...interface{}) string {
, := stringify(...)
if == contentTypeURL {
= true
}
var bytes.Buffer
if processURLOnto(, , &) {
return .String()
}
return
}
for , := 0, len(); < ; ++ {
:= []
case '!', '#', '$', '&', '*', '+', ',', '/', ':', ';', '=', '?', '@', '[', ']':
if {
continue
case '-', '.', '_', '~':
continue
if 'a' <= && <= 'z' {
continue
}
if 'A' <= && <= 'Z' {
continue
}
if '0' <= && <= '9' {
continue
}
}
.WriteString([:])
fmt.Fprintf(, "%%%02x", )
= + 1
}
.WriteString([:])
return != 0
}
func ( ...interface{}) string {
, := stringify(...)
switch {
case contentTypeSrcset:
return
var bytes.Buffer
if processURLOnto(, true, &) {
= .String()
return strings.ReplaceAll(, ",", "%2c")
}
var bytes.Buffer
:= 0
for := 0; < len(); ++ {
if [] == ',' {
filterSrcsetElement(, , , &)
.WriteString(",")
= + 1
}
}
filterSrcsetElement(, , len(), &)
return .String()
}
const htmlSpaceAndASCIIAlnumBytes = "\x00\x36\x00\x00\x01\x00\xff\x03\xfe\xff\xff\x07\xfe\xff\xff\x07"
func ( byte) bool {
return ( <= 0x20) && 0 != (htmlSpaceAndASCIIAlnumBytes[>>3]&(1<<uint(&0x7)))
}
func ( byte) bool {
return ( < 0x80) && 0 != (htmlSpaceAndASCIIAlnumBytes[>>3]&(1<<uint(&0x7)))
}
func ( string, int, int, *bytes.Buffer) {
:=
for < && isHTMLSpace([]) {
++
}
:=
for := ; < ; ++ {
if isHTMLSpace([]) {
=
break
}
}
:= true
for := ; < ; ++ {
if !isHTMLSpaceOrASCIIAlnum([]) {
= false
break
}
}
if {
.WriteString([:])
processURLOnto(, true, )
.WriteString([:])
return
}
}
.WriteString("#")
.WriteString(filterFailsafe)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |