changelog

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeepAChangelogParser added in v0.3.1

func NewKeepAChangelogParser(gm goldmark.Markdown) *kparser

func NewOGParser added in v0.3.1

func NewOGParser(gm goldmark.Markdown) *ogparser

Types

type FileFormat added in v0.3.2

type FileFormat int
const (
	OG FileFormat = iota
	KeepAChangelog
)

type LoadResult

type LoadResult struct {
	Articles []RawArticle
	HasMore  bool
}

type LoadedChangelog

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

LoadedChangelog represents a loaded changelog with its metadata.

func (LoadedChangelog) Parse

type Loader

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

Loader groups multiple ways of loading a changelog.

func NewLoader

func NewLoader(cfg config.Config, store store.Store, cache httpcache.Cache) *Loader

NewLoader creates a new Loader instance.

func (*Loader) FromConfig

func (l *Loader) FromConfig(ctx context.Context, page Pagination) (LoadedChangelog, error)

func (*Loader) FromHost added in v0.1.2

func (l *Loader) FromHost(ctx context.Context, host string, page Pagination) (LoadedChangelog, error)

Tries to load the corresponding changelog for the host, either by it's subdomain or domain.

func (*Loader) FromWorkspace

func (l *Loader) FromWorkspace(ctx context.Context, wID, cID string, page Pagination) (LoadedChangelog, error)

type Meta

type Meta struct {
	// unique id, we use the published date as unix timestampe
	ID          string
	Title       string    `yaml:"title"`
	Description string    `yaml:"description"`
	PublishedAt time.Time `yaml:"publishedAt"`
	Tags        []string  `yaml:"tags"`
}

type Pagination

type Pagination interface {
	PageSize() int
	Page() int
	StartIdx() int
	EndIdx() int
	// Returns true if the pagination is defined, else false and pagination should be ignored
	IsDefined() bool
}

func NewPagination

func NewPagination(pageSize int, page int) Pagination

func NoPagination

func NoPagination() Pagination

type ParseResult added in v0.3.2

type ParseResult struct {
	Articles []ParsedArticle
	HasMore  bool
}

type ParsedArticle

type ParsedArticle struct {
	Meta    Meta
	Content io.Reader
}

func (*ParsedArticle) AddTag added in v0.3.1

func (a *ParsedArticle) AddTag(t string)

type ParsedChangelog

type ParsedChangelog struct {
	CL       store.Changelog
	Articles []ParsedArticle
	HasMore  bool
}

ParsedChangelog represents a parsed changelog with its articles.

type Parser

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

func NewParser

func NewParser(gm goldmark.Markdown) Parser

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, raw []RawArticle, kPage Pagination) ParseResult

Parses all the raw articles, uses either the keep-a-changelog parser or our og parser. Uses the keep-a-changelog parser if only a single article in the keep-a-changelog format is provided. Pagination is only applied when using the keep-a-changelog parser. Else parses using the original parser.

type RawArticle

type RawArticle struct {
	Content io.ReadCloser
}

type Source

type Source interface {
	Load(ctx context.Context, page Pagination) (LoadResult, error)
}

A source is used to download the changelog articles from a target

Jump to

Keyboard shortcuts

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