Rename to Convert
Anirudh Oppiliappan x@icyphox.sh
Thu, 30 Sep 2021 11:31:48 +0530
2 files changed,
2 insertions(+),
2 deletions(-)
M
readme
→
readme
@@ -15,7 +15,7 @@ )
func main() { htmlRel := `<html><body><a href="#footnote-1">[1]</a></body></html>` - htmlAbs, err := rel2abs.Rel2Abs([]byte(htmlRel), "http://foo.com/bar") + htmlAbs, err := rel2abs.Convert([]byte(htmlRel), "http://foo.com/bar") fmt.Println(htmlAbs) // <html><body><a href="http://foo.com/bar#footnote-1">[1]</a></body></html>
M
rel2abs.go
→
rel2abs.go
@@ -30,7 +30,7 @@ }
// Converts all relative URLs in htmlContent to absolute URLs, // resolved against a base URL. -func Rel2Abs(htmlContent []byte, base string) ([]byte, error) { +func Convert(htmlContent []byte, base string) ([]byte, error) { doc, err := html.Parse(bytes.NewReader(htmlContent)) if err != nil { return nil, fmt.Errorf("html parse: %w\n", err)