converter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConvertOptions = ConvertOptions{
	UseFirstHeadingAsTitle:       true,
	MissingTitlesMode:            MissingTitleModeDate,
	ConvertStarsToFigureCaptions: true,
}

Functions

This section is empty.

Types

type ConvertOptions

type ConvertOptions struct {
	// UseFirstHeadingAsTitle controls whether to use the first heading of the journal entry as the title.
	UseFirstHeadingAsTitle bool

	// MissingTitleMode controls what to use for missing titles.
	MissingTitlesMode MissingTitleMode

	// ConvertStarsToFigureCaptions searches for any lines with stars that appear directly after an image as the
	// image caption.
	ConvertStarsToFigureCaptions bool
}

ConvertOptions are the available conversion options. TODO: these should be processors

type MissingTitleMode

type MissingTitleMode int
const (
	MissingTitleModeBlank MissingTitleMode = iota
	MissingTitleModeDate
	MissingTitleModeFirstLine
)

type SelectOption

type SelectOption struct {
	FromDate time.Time
	ToDate   time.Time
}

func (SelectOption) EntryMatch

func (o SelectOption) EntryMatch(entry models.Entry) bool

type Service

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

func New

func New(hugoDir *hugodir.Provider, convertOptions ConvertOptions) *Service

func (*Service) ConvertToPost

func (s *Service) ConvertToPost(entry models.Entry) (post models.Post, err error)

func (*Service) PrintSelectedEntries

func (s *Service) PrintSelectedEntries(w io.Writer, pack models.JournalPack, options SelectOption) error

func (*Service) WriteToHugo

func (s *Service) WriteToHugo(site models.Site, journalPack models.JournalPack, selectOptions SelectOption) error

Jump to

Keyboard shortcuts

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