printer/plainprinter.go
changeset 126 7d712d2bde73
parent 121 10453a1c5698
child 145 0f6b8411ad36
equal deleted inserted replaced
125:d436b88d137b 126:7d712d2bde73
    10 	"io"
    10 	"io"
    11 	"os"
    11 	"os"
    12 	"reflect"
    12 	"reflect"
    13 	"time"
    13 	"time"
    14 
    14 
    15 	"github.com/jaytaylor/html2text"
       
    16 	"github.com/m0t0k1ch1/gomif"
    15 	"github.com/m0t0k1ch1/gomif"
    17 
    16 
    18 	"github.com/McKael/madon"
    17 	"github.com/McKael/madon"
       
    18 	"github.com/McKael/madonctl/printer/html2text"
    19 )
    19 )
    20 
    20 
    21 // PlainPrinter is the default "plain text" printer
    21 // PlainPrinter is the default "plain text" printer
    22 type PlainPrinter struct {
    22 type PlainPrinter struct {
    23 	Indent      string
    23 	Indent      string
   118 	}
   118 	}
   119 	return nil
   119 	return nil
   120 }
   120 }
   121 
   121 
   122 func html2string(h string) string {
   122 func html2string(h string) string {
   123 	t, err := html2text.FromString(h)
   123 	t, err := html2text.Textify(h)
   124 	if err == nil {
   124 	if err == nil {
   125 		return t
   125 		return t
   126 	}
   126 	}
   127 	return h // Failed: return initial string
   127 	return h // Failed: return initial string
   128 }
   128 }