Documentation ¶
Overview ¶
Package flashcards parses and formats flashcards.
Index ¶
- Variables
- func WriteHTMLMathJaxTeX(directory string, flashcards []*Flashcard) error
- func WriteHTMLText(directory string, flashcards []*Flashcard) error
- func WriteJSON(w io.Writer, flashcards []*Flashcard) error
- func WriteStudyBlue(w io.Writer, flashcards []*Flashcard) error
- type DirWriteFunc
- type Flashcard
- type Reader
- type WriteFunc
Constants ¶
This section is empty.
Variables ¶
var ErrNoFlashcardBack = errors.New("Flashcard has no back side")
ErrNoFlashcardBack is the error returned when a Flashcard has no back side.
Functions ¶
func WriteHTMLMathJaxTeX ¶
WriteHTMLMathJaxTeX creates the directory and writes the flashcards, which may contain MathJax TeX, to index.html and associated asset files in the directory.
func WriteHTMLText ¶
WriteHTMLText creates the directory and writes the flashcards as text to index.html and associated asset files in the directory.
Types ¶
type DirWriteFunc ¶
A DirWriteFunc creates the directory and writes the flashcards in it.
type Flashcard ¶
type Flashcard struct {
Front, Back string
}
A Flashcard has a front side and a back side.
type Reader ¶
Reader reads Flashcards. It does not hold references to a Flashcard after returning it. If the error is not nil, callers must discard the returned Flashcard.
func NewReader ¶
NewReader returns a new Reader reading from r. A flashcard consists of adjacent, non-empty lines. The first line is the flashcard's front, the remaining lines are its back. If a flashcard has no back side, the Reader stops with ErrNoFlashcardBack. Flashcards are separated by empty lines. Lines are terminated by "\n".