// NewPartText creates a "text/plain" part, with the text string as its content
// (do not encode, this will happen automatically when needed).
508331
func NewPartText(textPlain string) *Message {
	return &Message{
		Header: Header{"Content-Type": []string{"text/plain; charset=\"UTF-8\""}},
		Body:   []byte(textPlain)}
}
1304093
func NewSimpleStyledText() *SimpleStyledText {
	ss := &SimpleStyledText{}
	// Create map and establish default styles.
	ss.styles = make(map[rune]tcell.Style)
	ss.styles['N'] = tcell.StyleDefault
	ss.styles['S'] = tcell.StyleDefault.Reverse(true)
	ss.styles['U'] = tcell.StyleDefault.Underline(true)
	ss.styles['B'] = tcell.StyleDefault.Bold(true)
	return ss
}
75763
func indentContent(indent int, content string) string {
	var b bytes.Buffer
	length := len(strings.Split(content, "\n")) - 1
	for i, x := range strings.Split(content, "\n") {
		// @check if the length of the line is zero and set spacer
		spacer := indent
		if i == 0 || len(x) <= 0 {
			spacer = 0
		}
		// @step: write the line to the buffer
		line := fmt.Sprintf("%"+fmt.Sprintf("%d", spacer)+"s%s", "", x)
		b.WriteString(line)

		// @check if we need a newline
		if i < length {
			b.WriteString("\n")
		}
	}

	return b.String()
}
328450
func ht(parts []string) (string, []string) {
	switch len(parts) {
	case 0:
		return "", []string{}
	case 1:
		return parts[0], []string{}
	default:
		return parts[0], parts[1:]
	}
}
572242
func NewContent(contentType string, value string) *Content {
	return &Content{
		Type:  contentType,
		Value: value,
	}
}
568266
func (s *UnmarshallableString) UnmarshalText(data []byte) error {
	*s = UnmarshallableString(data)
	return nil
}
1244741
func NewPartAttachment(r io.Reader, filename string) (*Message, error) {
	b, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, err
	}
	return NewPartAttachmentFromBytes(b, filename), nil
}
205667
func NewInsertTextArgs(text string) *InsertTextArgs {
	args := new(InsertTextArgs)
	args.Text = text
	return args
}
748318
func (c *Conn) SendPlainText(to []string, from, subj, plaintext string) error {
	return c.conn.SendPlainText(to, from, subj, plaintext)
}
997907
func newPartFromBytes(raw []byte, contentType string, contentDisposition string, contentID string) *Message {
	headers := Header{}

	if len(contentType) > 0 {
		headers.Set("Content-Type", contentType)
	} else {
		headers.Set("Content-Type", "application/octet-stream")
	}

	if len(contentDisposition) > 0 {
		headers.Set("Content-Disposition", contentDisposition)
	}

	if len(contentID) > 0 {
		headers.Set("Content-ID", "<"+contentID+">")
	}

	return &Message{Header: headers, Body: raw}
}
706605
func (p *parser) addText(text string) {
	if text == "" {
		return
	}

	if p.shouldFosterParent() {
		p.fosterParent(&Node{
			Type: TextNode,
			Data: text,
		})
		return
	}

	t := p.top()
	if n := t.LastChild; n != nil && n.Type == TextNode {
		n.Data += text
		return
	}
	p.addChild(&Node{
		Type: TextNode,
		Data: text,
	})
}
638766
func (s *Service) NewTXT(name string) *dns.TXT {
	return &dns.TXT{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: s.TTL}, Txt: split255(s.Text)}
}
794699
func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig {
	return EditMessageTextConfig{
		BaseEdit: BaseEdit{
			ChatID:    chatID,
			MessageID: messageID,
		},
		Text: text,
	}
}
440416
func NewGetStyleSheetTextArgs(styleSheetID StyleSheetID) *GetStyleSheetTextArgs {
	args := new(GetStyleSheetTextArgs)
	args.StyleSheetID = styleSheetID
	return args
}
494108
func (client *restClient) createFieldPart(fieldname, value, boundary string) io.Reader {
	str := fmt.Sprintf("\r\n--%s\r\n", boundary)
	str += fmt.Sprintf("Content-Disposition: form-data; name=\"%s\"\r\n\r\n", quoteEscaper.Replace(fieldname))
	str += value
	return strings.NewReader(str)
}
406719
func (t *templateHandler) NewTextTemplate() tpl.TemplateParseFinder {
	t.mu.Lock()
	defer t.mu.Unlock()

	tt := &textTemplate{t: texttemplate.New("")}
	t.extTextTemplates = append(t.extTextTemplates, tt)

	return struct {
		tpl.TemplateParser
		tpl.TemplateLookup
		tpl.TemplateLookupVariant
	}{
		tt,
		tt,
		new(nopLookupVariant),
	}

}
1050808
func (F *Frisby) ExpectContent(content string) *Frisby {
	Global.NumAsserts++
	text, err := F.Resp.Text()
	if err != nil {
		F.AddError(err.Error())
		return F
	}
	contains := strings.Contains(text, content)
	if !contains {
		err_str := fmt.Sprintf("Expected Body to contain %q, but it was missing", content)
		F.AddError(err_str)
	}
	return F
}