Info SiteInfo
Shortcodes map[string]ShortcodeFunc
timer *nitro.B
- Transformer *transform.Transformer
+ Transformer transform.Transformer
Target target.Output
Alias target.AliasPublisher
}
}
if s.Transformer == nil {
- s.Transformer = &transform.Transformer{BaseURL: s.Config.BaseUrl}
+ s.Transformer = &transform.AbsURL{BaseURL: s.Config.BaseUrl}
}
final := new(bytes.Buffer)
s.Transformer.Apply(content, final)
"net/url"
)
-type Transformer struct {
+type Transformer interface {
+ Apply(io.Reader, io.Writer) error
+}
+
+type AbsURL struct {
BaseURL string
}
-func (t *Transformer) Apply(r io.Reader, w io.Writer) (err error) {
+func (t *AbsURL) Apply(r io.Reader, w io.Writer) (err error) {
var tr *htmltran.Transformer
if tr, err = htmltran.NewFromReader(r); err != nil {
tag, attr string
}
-func (t *Transformer) absUrlify(tr *htmltran.Transformer, selectors ...elattr) (err error) {
+func (t *AbsURL) absUrlify(tr *htmltran.Transformer, selectors ...elattr) (err error) {
var baseURL, inURL *url.URL
if baseURL, err = url.Parse(t.BaseURL); err != nil {