mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Removing dependency on go-html-transform (fixing the build).
This commit is contained in:
parent
7e692544f0
commit
c8904756f0
1 changed files with 0 additions and 30 deletions
|
@ -2,7 +2,6 @@ package transform
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
htmltran "code.google.com/p/go-html-transform/html/transform"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
@ -38,32 +37,3 @@ func guardReplace(content, guard, match, replace []byte) []byte {
|
|||
}
|
||||
return content
|
||||
}
|
||||
|
||||
type elattr struct {
|
||||
tag, attr string
|
||||
}
|
||||
|
||||
func absUrlify(baseURL *url.URL, selectors ...elattr) (trs []*htmltran.Transform, err error) {
|
||||
var inURL *url.URL
|
||||
|
||||
replace := func(in string) string {
|
||||
if inURL, err = url.Parse(in); err != nil {
|
||||
return in + "?"
|
||||
}
|
||||
if fragmentOnly(inURL) {
|
||||
return in
|
||||
}
|
||||
return baseURL.ResolveReference(inURL).String()
|
||||
}
|
||||
|
||||
for _, el := range selectors {
|
||||
mt := htmltran.MustTrans(htmltran.TransformAttrib(el.attr, replace), el.tag)
|
||||
trs = append(trs, mt)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func fragmentOnly(u *url.URL) bool {
|
||||
return u.Fragment != "" && u.Scheme == "" && u.Opaque == "" && u.User == nil && u.Host == "" && u.Path == "" && u.Path == "" && u.RawQuery == ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue