equal
deleted
inserted
replaced
26 |
26 |
27 // NewPrinterTemplate returns a Template ResourcePrinter |
27 // NewPrinterTemplate returns a Template ResourcePrinter |
28 // For TemplatePrinter, the option parameter contains the template string. |
28 // For TemplatePrinter, the option parameter contains the template string. |
29 func NewPrinterTemplate(option string) (*TemplatePrinter, error) { |
29 func NewPrinterTemplate(option string) (*TemplatePrinter, error) { |
30 tmpl := option |
30 tmpl := option |
31 t, err := template.New("output").Funcs(template.FuncMap{"fromhtml": html2string}).Parse(tmpl) |
31 t, err := template.New("output").Funcs(template.FuncMap{ |
|
32 "fromhtml": html2string, |
|
33 "fromunix": unix2string, |
|
34 }).Parse(tmpl) |
32 if err != nil { |
35 if err != nil { |
33 return nil, err |
36 return nil, err |
34 } |
37 } |
35 return &TemplatePrinter{ |
38 return &TemplatePrinter{ |
36 rawTemplate: tmpl, |
39 rawTemplate: tmpl, |