parse

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGoldmark

func CreateGoldmark() goldmark.Markdown

Creates a new goldmark instance, used to parse Markdown to HTML.

func NewKeepAChangelogParser

func NewKeepAChangelogParser(gm goldmark.Markdown) *kparser

func NewOGParser

func NewOGParser(gm goldmark.Markdown) *ogparser

Types

type FileFormat

type FileFormat int
const (
	OG FileFormat = iota
	KeepAChangelog
)

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 ParseResult

type ParseResult struct {
	ReleaseNotes []ParsedReleaseNote
	HasMore      bool
}

type ParsedReleaseNote

type ParsedReleaseNote struct {
	Meta    Meta
	Content io.Reader
}

func (*ParsedReleaseNote) AddTag

func (a *ParsedReleaseNote) AddTag(t string)

type Parser

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

func NewParser

func NewParser(gm goldmark.Markdown) Parser

Creates a new Parser that can be used to parse RawReleaseNote files to ParsedReleaseNote. Converts all Markdown content to HTML.

func (*Parser) Parse

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.

func (*Parser) ParseRawRelease

func (p *Parser) ParseRawRelease(ctx context.Context, raw source.RawReleaseNote, kPage internal.Pagination) ParseResult

Parses a raw release note, using either the keep-a-changelog parser or our own format og parser. Uses our own og parser if the raw release notes starts with "---". Else uses keep-a-changelog parser. Pagination is only applied when using keep-a-changelog parser.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳