diff options
author | spf13 <steve.francia@gmail.com> | 2014-11-17 18:21:31 -0500 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-11-17 18:21:31 -0500 |
commit | c8904756f02948c6f7bb900b05cd0aa6b259088e (patch) | |
tree | 151b4a3ba17157de4715c4ebb344f9fa51882121 /transform/absurl.go | |
parent | 7e692544f06887a22146320b76c71df25aea3663 (diff) |
Removing dependency on go-html-transform (fixing the build).
Diffstat (limited to 'transform/absurl.go')
-rw-r--r-- | transform/absurl.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/transform/absurl.go b/transform/absurl.go index 9838cbe51..6fb1cb4a1 100644 --- a/transform/absurl.go +++ b/transform/absurl.go @@ -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 == "" -} |