anki

package
v0.0.0-...-32faa4a Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Barn

type Barn struct {
	BarnSetting
	QnAs []QnACard `toml:"q_a,omitempty" json:"q_a,omitempty"`
}

Barn - 一组卡片的配置

func ParseTomlContent

func ParseTomlContent(ctx context.Context, content []byte) (*Barn, error)

ParseTomlContent takes a file path and parses the .apkg.md config file.

func ParseTomlFile

func ParseTomlFile(ctx context.Context, filePath string) (*Barn, error)

ParseTomlFile takes a file path and parses the `.apkg.md` config file.

type BarnSetting

type BarnSetting struct {
	Title string `toml:"title,omitempty" json:"title,omitempty"`

	// RuntimeEnabled if set true, record runtime to original file when created
	// todo: 回写的时候会改变格式,不是很理想,再想想办法,或者开发其他 parser
	// todo: 目前只有回写,还不支持读取时沿用原来的 ID
	RuntimeEnabled bool `toml:"runtime,omitempty" json:"runtime,omitempty"`

	// Meta - 卡片 Meta 的默认配置,被具体的卡片覆盖
	Meta
}

type Meta

type Meta struct {
	Tags             []string                  `toml:"tags,omitempty" json:"tags,omitempty"`
	ContentFormatter apkg.NoteContentFormatter `toml:"content_fmt,omitempty" json:"content_fmt,omitempty"`
}

type QnACard

type QnACard struct {
	Meta

	Question string `toml:"question,omitempty"`
	Answer   string `toml:"answer,omitempty"`

	// todo: 考虑把这个拆出来,不过怎么建立索引关系是个问题,源文件里的 query 是一个动态变化的值
	*Runtime `toml:"runtime,omitempty"`
}

QnACard - 问答格式的卡片

func (*QnACard) GetCardID

func (c *QnACard) GetCardID() int

func (*QnACard) GetNoteGUID

func (c *QnACard) GetNoteGUID() string

func (*QnACard) GetNoteID

func (c *QnACard) GetNoteID() int

type Runtime

type Runtime struct {
	CardID   int    `toml:"cid,omitempty"`
	NoteID   int    `toml:"nid,omitempty"`
	NoteGUID string `toml:"guid,omitempty"`
}

Runtime - to record already created card and note

Jump to

Keyboard shortcuts

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