ref: 98ee69bce207a4c2a7c2ffca2b3e7c0ccdd6e8c9
dir: /transform/absurl.go/
package transform import ( "sync" ) var absURLInit sync.Once var ar *absURLReplacer // for performance reasons, we reuse the first baseURL given func initAbsURLReplacer(baseURL string) { absURLInit.Do(func() { ar = newAbsURLReplacer(baseURL) }) } func AbsURL(absURL string) (trs []link, err error) { initAbsURLReplacer(absURL) trs = append(trs, func(rw ContentReWriter) { ar.replaceInHTML(rw) }) return } func AbsURLInXML(absURL string) (trs []link, err error) { initAbsURLReplacer(absURL) trs = append(trs, func(rw ContentReWriter) { ar.replaceInXML(rw) }) return }