Source File
css.go
Belonging Package
html/template
package template
import (
)
return false
}
if != 0 {
, := utf8.DecodeLastRune([:])
return false
}
return 'a' <= && <= 'z' ||
'A' <= && <= 'Z' ||
'0' <= && <= '9' ||
== '-' ||
0x80 <= && <= 0xd7ff ||
0xe000 <= && <= 0xfffd ||
0x10000 <= && <= 0x10ffff
}
, = [:len()+], skipCSSSpace([:])
, := utf8.DecodeRune([1:])
, = append(, [1:1+]...), [1+:]
}
}
return
}
switch [0] {
case '\t', '\n', '\f', ' ':
return [1:]
if len() >= 2 && [1] == '\n' {
return [2:]
}
return [1:]
}
return
}
, = utf8.DecodeRuneInString([:])
var string
switch {
case int() < len(cssReplacementTable) && cssReplacementTable[] != "":
= cssReplacementTable[]
default:
continue
}
if == 0 {
.Grow(len())
}
.WriteString([:])
.WriteString()
= +
if != `\\` && ( == len() || isHex([]) || isCSSSpace([])) {
.WriteByte(' ')
}
}
if == 0 {
return
}
.WriteString([:])
return .String()
}
var cssReplacementTable = []string{
0: `\0`,
'\t': `\9`,
'\n': `\a`,
'\f': `\c`,
'"': `\22`,
'&': `\26`,
'\'': `\27`,
'(': `\28`,
')': `\29`,
'+': `\2b`,
'/': `\2f`,
':': `\3a`,
';': `\3b`,
'<': `\3c`,
'>': `\3e`,
'\\': `\\`,
'{': `\7b`,
'}': `\7d`,
}
var expressionBytes = []byte("expression")
var mozBindingBytes = []byte("mozbinding")
for , := range {
switch {
case 0, '"', '\'', '(', ')', '/', ';', '@', '[', '\\', ']', '`', '{', '}':
return filterFailsafe
if != 0 && [-1] == '-' {
return filterFailsafe
}
default:
if < utf8.RuneSelf && isCSSNmchar(rune()) {
= append(, )
}
}
}
= bytes.ToLower()
if bytes.Contains(, expressionBytes) || bytes.Contains(, mozBindingBytes) {
return filterFailsafe
}
return string()
![]() |
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. |