mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
@@ -131,7 +131,6 @@ func (l *absurllexer) posAfterURL(q []byte) int {
|
||||
return bytes.IndexFunc(l.content[l.pos:], func(r rune) bool {
|
||||
return r == '>' || unicode.IsSpace(r)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// handle URLs in srcset.
|
||||
@@ -188,7 +187,6 @@ func checkCandidateSrcset(l *absurllexer) {
|
||||
|
||||
l.pos += len(section)
|
||||
l.start = l.pos
|
||||
|
||||
}
|
||||
|
||||
// main loop
|
||||
@@ -231,12 +229,12 @@ func (l *absurllexer) replace() {
|
||||
}
|
||||
|
||||
func doReplace(path string, ct transform.FromTo, quotes [][]byte) {
|
||||
|
||||
lexer := &absurllexer{
|
||||
content: ct.From().Bytes(),
|
||||
w: ct.To(),
|
||||
path: []byte(path),
|
||||
quotes: quotes}
|
||||
quotes: quotes,
|
||||
}
|
||||
|
||||
lexer.replace()
|
||||
}
|
||||
@@ -249,7 +247,8 @@ type absURLReplacer struct {
|
||||
func newAbsURLReplacer() *absURLReplacer {
|
||||
return &absURLReplacer{
|
||||
htmlQuotes: [][]byte{[]byte("\""), []byte("'")},
|
||||
xmlQuotes: [][]byte{[]byte("""), []byte("'")}}
|
||||
xmlQuotes: [][]byte{[]byte("""), []byte("'")},
|
||||
}
|
||||
}
|
||||
|
||||
func (au *absURLReplacer) replaceInHTML(path string, ct transform.FromTo) {
|
||||
|
@@ -116,7 +116,8 @@ var (
|
||||
srcsetXMLTests = []test{
|
||||
{srcsetXMLBasic, srcsetXMLBasicCorrect},
|
||||
{srcsetXMLSingleQuote, srcsetXMLSingleQuoteCorrect},
|
||||
{srcsetXMLVariations, srcsetXMLVariationsCorrect}}
|
||||
{srcsetXMLVariations, srcsetXMLVariationsCorrect},
|
||||
}
|
||||
|
||||
relurlTests = []test{{relPathVariations, relPathVariationsCorrect}}
|
||||
)
|
||||
@@ -152,7 +153,6 @@ func TestAbsURL(t *testing.T) {
|
||||
tr := transform.New(NewAbsURLTransformer(testBaseURL))
|
||||
|
||||
apply(t.Errorf, tr, absURLTests)
|
||||
|
||||
}
|
||||
|
||||
func TestAbsURLUnqoted(t *testing.T) {
|
||||
@@ -174,7 +174,6 @@ func TestRelativeURL(t *testing.T) {
|
||||
tr := transform.New(NewAbsURLTransformer(helpers.GetDottedRelativePath(filepath.FromSlash("/post/sub/"))))
|
||||
|
||||
applyWithPath(t.Errorf, tr, relurlTests)
|
||||
|
||||
}
|
||||
|
||||
func TestAbsURLSrcSet(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user