func (t *Transform) ProcessLink(base_url string, url string) string {
	var result []string
	length := len(url)
	if length == 0 {
		return ""
	}
	if strings.HasPrefix(url, t.site_url) {
		return url
	}
	var rep string = ""
	if url[0] == '\'' || url[length-1] == '"' {
		if length <= 2 {
			return url
		}
		rep = url[0:1]
		result = append(result, rep)
		url = url[1 : length-1]
	}
	pos := strings.Index(base_url, "/db.")
	if pos == -1 {
		return url
	}
	for strings.HasPrefix(url, "../") {
		url = url[3:]
		spos := strings.LastIndex(base_url[:len(base_url)-1], "/")
		if spos != -1 && spos != pos {
			base_url = base_url[:spos+1]
		}
		if len(url) == 0 {
			return t.site_url + base_url
		}
	}
	if strings.HasPrefix(url, "#") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "about:blank") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "data:") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "file:") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "res:") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "C:") {
		result = append(result, url)
	} else if strings.HasPrefix(url, "javascript:") {
		result = append(result, url)
	} else if strings.HasPrefix(url, t.site_url) {
		result = append(result, url)
	} else if strings.HasPrefix(url, "//") {
		host, uri := t.SplitAddress(url[2:])
		result = append(result, t.site_url)
		result = append(result, t.ReverseHost(host, ".", "/"))
		if strings.Contains(base_url, "db.b") {
			result = append(result, "/db.b")
		} else {
			result = append(result, "/db.a")
		}
		result = append(result, uri)
	} else if url[0] == '/' {
		var i = strings.Index(base_url, "db.")
		if i == -1 {
			i = len(base_url)
		} else {
			i += 4
		}
		result = append(result, t.site_url)
		result = append(result, base_url[:i])
		result = append(result, url)
	} else if strings.HasPrefix(url, "http://") {
		host, uri := t.SplitAddress(url[7:])
		result = append(result, t.site_url)
		result = append(result, t.ReverseHost(host, ".", "/"))
		result = append(result, "/db.a")
		result = append(result, uri)
	} else if strings.HasPrefix(url, "https://") {
		host, uri := t.SplitAddress(url[8:])
		result = append(result, t.site_url)
		result = append(result, t.ReverseHost(host, ".", "/"))
		result = append(result, "/db.b")
		result = append(result, uri)
	} else {
		result = append(result, t.site_url)
		result = append(result, base_url)
		result = append(result, url)
	}
	if rep != "" {
		result = append(result, rep)
	}
	return strings.Join(result, "")
}
base_url must is "a/" prefix or "/" suffix
package transform
import (
	"bytes"
	"errors"
	"strings"
)
import (
	"golang.org/x/net/html"
)
import (
	"../ecmascript"
)
var c_link_attrs = map[string]bool{
	"action": true, "archive": true, "background": true, "cite": true, "classid": true,
	"codebase": true, "data": true, "href": true, "longdesc": true, "profile": true, "src": true,
	"usemap": true,
	"sprite": true,
	"dynsrc": true, "lowsrc": true,
}
type Transform struct {
	site_url string
	css      CSSTransform
	js       ecmascript.JSTransform
}
func (t *Transform) Init(site_url string) error {
	t.site_url = site_url
	return t.css.Init(t)
}