mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-01 14:39:09 -05:00
fixing double slash during absurlify
This commit is contained in:
parent
b69694a3ae
commit
90a902c843
1 changed files with 8 additions and 5 deletions
|
@ -1,9 +1,10 @@
|
||||||
package transform
|
package transform
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
htmltran "code.google.com/p/go-html-transform/html/transform"
|
htmltran "code.google.com/p/go-html-transform/html/transform"
|
||||||
"net/url"
|
"net/url"
|
||||||
"bytes"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AbsURL(absURL string) (trs []link, err error) {
|
func AbsURL(absURL string) (trs []link, err error) {
|
||||||
|
@ -13,11 +14,13 @@ func AbsURL(absURL string) (trs []link, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base := strings.TrimRight(baseURL.String(), "/")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
srcdq = []byte(" src=\""+baseURL.String()+"/")
|
srcdq = []byte(" src=\"" + base + "/")
|
||||||
hrefdq = []byte(" href=\""+baseURL.String()+"/")
|
hrefdq = []byte(" href=\"" + base + "/")
|
||||||
srcsq = []byte(" src='"+baseURL.String()+"/")
|
srcsq = []byte(" src='" + base + "/")
|
||||||
hrefsq = []byte(" href='"+baseURL.String()+"/")
|
hrefsq = []byte(" href='" + base + "/")
|
||||||
)
|
)
|
||||||
trs = append(trs, func(content []byte) []byte {
|
trs = append(trs, func(content []byte) []byte {
|
||||||
content = bytes.Replace(content, []byte(" src=\"/"), srcdq, -1)
|
content = bytes.Replace(content, []byte(" src=\"/"), srcdq, -1)
|
||||||
|
|
Loading…
Reference in a new issue