all repos — rel2abs @ master

go library to convert all relative urls in a html document to absolute ones

readme (view raw)

 1rel2abs
 2-------
 3
 4Go library to convert all relative URLs to absolute ones, resolved
 5against a specified base URL.
 6
 7
 8EXAMPLE
 9
10    import (
11        "fmt"
12
13        "git.icyphox.sh/rel2abs"
14    )
15
16    func main() {
17        htmlRel := `<html><body><a href="#footnote-1">[1]</a></body></html>`
18        htmlAbs, err := rel2abs.Convert([]byte(htmlRel), "http://foo.com/bar")
19
20        fmt.Println(htmlAbs)
21        // <html><body><a href="http://foo.com/bar#footnote-1">[1]</a></body></html>
22    }