html

package
v0.0.0-...-c05b5d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodySectionContent

type BodySectionContent struct {
	PubName  string
	Items    []linksrc.LinkItem
	Overview string // General statement about the links scraped for the site
}

BodySectionContent is used to populate email body templates

func NewBodySectionContent

func NewBodySectionContent(s linksrc.Set) BodySectionContent

NewBodySectionContent readies a linksrc.Set for inclusion in an email body. We want to keep linksrc.Set as close as possible to what a scraper had originally parsed, and BodySectionContent as close as possible to what a reader would want to see, while decoupling the two.

type EmailData

type EmailData struct {
	// contains filtered or unexported fields
}

EmailData contains metadata for the body of an email to send with a newsletter etc. Since each linksrc.Set in linksets comes from a different upstream, this is designed to support concurrent access. You should create this with NewEmailData.

func NewEmailData

func NewEmailData() *EmailData

NewEmailData safely creates an EmailData.

func (*EmailData) Add

func (ed *EmailData) Add(s linksrc.Set)

Add stores a new linksrc.Set in the EmailData in a goroutine-safe way. Callers must use Add for adding linksrc.Sets to the EmailData.

func (*EmailData) GenerateBody

func (ed *EmailData) GenerateBody() string

GenerateBody produces an HTML email body to send based on the unformatted content. It's meant to include multiple sources of links in the same email to reduce the number of emails we send. Any scraping- or parsing- related error messages are included in the text.

func (*EmailData) GenerateText

func (ed *EmailData) GenerateText() string

GenerateText produces an email body to send based on the unformatted content, satisfying the text/plain MIME type. It's meant to include multiple sources of links in the same email to reduce the number of emails we send. Any scraping- or parsing- related error messages are included in the text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL