func (n *NoteWidget) Init() (err error) {
	var note string
	if n.options.Type == "text_file" {
		// for TextFile Widget
		var path string
		if n.options.Path[0:1] == "/" {
			path = n.options.Path
		} else {
			path = "./" + n.options.ExecPath + "/" + n.options.Path
		}
		b, err := ioutil.ReadFile(path)
		if err != nil {
			note = path + " does not exist"
		} else {
			note = string(b)
		}
	} else {
		// for Note Widget
		if err = m2s.Decode(n.options.Content, &note); err != nil {
			return
		}
	}

	items := strings.Split(note, "\n")
	var body []string
	for _, item := range items {
		rep := regexp.MustCompile(`(^#.*|^--*)`)
		item = rep.ReplaceAllString(item, "[$1](fg-blue)")
		body = append(body, " "+item)
	}
	lopt := &listable.ListWrapperOption{
		Title:      n.options.GetTitle(),
		RealHeight: n.options.GetHeight(),
		Body:       body,
	}
	n.renderer = listable.NewListWrapper(lopt)
	n.isReady = true

	return
}
// Init is the implementation of stack.Init
Init is the implementation of stack.Init
// Init is the implementation of stack . Init
func (n *NoteWidget) Init() (err error) {
	var note string
	if n.options.Type == "text_file" {
		var path string
		if n.options.Path[0:1] == "/" {
			path = n.options.Path
		} else {
			path = "./" + n.options.ExecPath + "/" + n.options.Path
		}
		b, err := ioutil.ReadFile(path)
		if err != nil {
			note = path + " does not exist"
		} else {
			note = string(b)
		}
	} else {
		if err = m2s.Decode(n.options.Content, &note); err != nil {
			return
		}
	}
	items := strings.Split(note, "\n")
	var body []string
	for _, item := range items {
		rep := regexp.MustCompile(`(^#.*|^--*)`)
		item = rep.ReplaceAllString(item, "[$1](fg-blue)")
		body = append(body, " "+item)
	}
	lopt := &listable.ListWrapperOption{
		Title:      n.options.GetTitle(),
		RealHeight: n.options.GetHeight(),
		Body:       body,
	}
	n.renderer = listable.NewListWrapper(lopt)
	n.isReady = true
	return
}
func ( n * NoteWidget ) Init ( ) ( err error ) { var note string if n . options . Type == " " { var path string if n . options . Path [ 0 : 1 ] == " " { path = n . options . Path } else { path = " " + n . options . ExecPath + " " + n . options . Path } b , err := ioutil . ReadFile ( path ) if err != nil { note = path + " " } else { note = string ( b ) } } else { if err = m2s . Decode ( n . options . Content , & note ) ; err != nil { return } } items := strings . Split ( note , " \n " ) var body [ ] string for _ , item := range items { rep := regexp . MustCompile ( `(^#.*|^--*)` ) item = rep . ReplaceAllString ( item , " " ) body = append ( body , " " + item ) } lopt := & listable . ListWrapperOption { Title : n . options . GetTitle ( ) , RealHeight : n . options . GetHeight ( ) , Body : body , } n . renderer = listable . NewListWrapper ( lopt ) n . isReady = true return }
Init is the implementation of stack.Init
Init is the implementation of stack . Init
// for TextFile Widget // for Note Widget