Add function "fromhtml" for Go templates
Example (for a status): {{.content | fromhtml}}
--- a/printer/templateprinter.go Sun Apr 23 23:32:16 2017 +0200
+++ b/printer/templateprinter.go Mon Apr 24 22:30:07 2017 +0200
@@ -26,7 +26,7 @@
// For TemplatePrinter, the option parameter contains the template string.
func NewPrinterTemplate(option string) (*TemplatePrinter, error) {
tmpl := option
- t, err := template.New("output").Parse(tmpl)
+ t, err := template.New("output").Funcs(template.FuncMap{"fromhtml": html2string}).Parse(tmpl)
if err != nil {
return nil, err
}