Documentation ¶
Index ¶
- Constants
- type BlockParsed
- type BlockTut
- type Course
- type LessonCounter
- type LessonTut
- type MdContent
- type TopCourse
- type TutVisitor
- type Tutorial
- type TxtPrinter
- func (v *TxtPrinter) Depth() int
- func (v *TxtPrinter) Down()
- func (v *TxtPrinter) P(s string, a ...interface{})
- func (v *TxtPrinter) Up()
- func (v *TxtPrinter) VisitBlockTut(b *BlockTut)
- func (v *TxtPrinter) VisitCourse(c *Course)
- func (v *TxtPrinter) VisitLessonTut(l *LessonTut)
- func (v *TxtPrinter) VisitTopCourse(t *TopCourse)
Constants ¶
const AnonBlockName = "clickToCopy"
AnonBlockName used for blocks that have no explicit name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockParsed ¶
BlockParsed groups a BlockBase with labels.
func NewBlockParsed ¶
func NewBlockParsed(labels []base.Label, p base.MdProse, c base.OpaqueCode) *BlockParsed
NewBlockParsed returns a BlockParsed with the given content.
func NewProseOnlyBlock ¶
func NewProseOnlyBlock(p base.MdProse) *BlockParsed
NewProseOnlyBlock makes a BlockParsed with no code.
func (*BlockParsed) HasLabel ¶
func (x *BlockParsed) HasLabel(label base.Label) bool
HasLabel is true if the block has the given label argument.
func (*BlockParsed) Labels ¶
func (x *BlockParsed) Labels() []base.Label
Labels are the labels found on the block.
type BlockTut ¶
type BlockTut struct {
BlockParsed
}
BlockTut is a part of a LessonTut - one block of code, maybe with prose.
func (*BlockTut) Children ¶
Children of the block - there aren't any at this time. One could imagine each line of code in a code block as a child if that were useful somehow.
type Course ¶
type Course struct {
// contains filtered or unexported fields
}
Course is a directory - an ordered list of Lessons and Courses.
type LessonCounter ¶
type LessonCounter struct {
// contains filtered or unexported fields
}
LessonCounter is a visitor that merely counts lessons.
func NewTutorialLessonCounter ¶
func NewTutorialLessonCounter() *LessonCounter
NewTutorialLessonCounter makes a new LessonCounter.
func (*LessonCounter) Count ¶
func (v *LessonCounter) Count() int
Count is the reason this visitor exists.
func (*LessonCounter) VisitBlockTut ¶
func (v *LessonCounter) VisitBlockTut(b *BlockTut)
VisitBlockTut does nothing.
func (*LessonCounter) VisitCourse ¶
func (v *LessonCounter) VisitCourse(c *Course)
VisitCourse visits children.
func (*LessonCounter) VisitLessonTut ¶
func (v *LessonCounter) VisitLessonTut(l *LessonTut)
VisitLessonTut increments the count.
func (*LessonCounter) VisitTopCourse ¶
func (v *LessonCounter) VisitTopCourse(t *TopCourse)
VisitTopCourse visits children.
type LessonTut ¶
type LessonTut struct {
// contains filtered or unexported fields
}
LessonTut has a one to one correspondence to a file. It must have a name, and may have blocks. An entirely empty file might appear with no blocks.
func NewLessonTutForTests ¶
NewLessonTutForTests makes one for tests.
func NewLessonTutFromMdContent ¶
NewLessonTutFromMdContent converts MdContent to a LessonTut.
type MdContent ¶
type MdContent struct { Blocks []*BlockParsed // contains filtered or unexported fields }
MdContent represents markdown content.
func (*MdContent) AddBlockParsed ¶
func (md *MdContent) AddBlockParsed(x *BlockParsed)
AddBlockParsed adds an instance of BlockParsed.
type TopCourse ¶
type TopCourse struct {
Course
}
A TopCourse is exactly like a Course accept that visitors may treat it differently, ignoring everything about it except its children. Its name is special in that it might be derived from a URL, from a list of files and directories, etc. It's usually a list of directories.
func NewTopCourse ¶
NewTopCourse makes a new TopCourse.
type TutVisitor ¶
type TutVisitor interface { VisitTopCourse(t *TopCourse) VisitCourse(c *Course) VisitLessonTut(l *LessonTut) VisitBlockTut(b *BlockTut) }
TutVisitor has the ability to visit the items specified in its methods.
type Tutorial ¶
type Tutorial interface { Accept(v TutVisitor) Title() string Name() string Path() base.FilePath Children() []Tutorial }
Tutorial represents a book in tree / hierarchical form.
type TxtPrinter ¶
type TxtPrinter struct {
// contains filtered or unexported fields
}
TxtPrinter prints a tutorial as text.
func NewTutorialTxtPrinter ¶
func NewTutorialTxtPrinter(w io.Writer) *TxtPrinter
NewTutorialTxtPrinter makes a new TxtPrinter for the given writer.
func (*TxtPrinter) Depth ¶
func (v *TxtPrinter) Depth() int
Depth is how deep we are in a tutorial tree.
func (*TxtPrinter) VisitBlockTut ¶
func (v *TxtPrinter) VisitBlockTut(b *BlockTut)
VisitBlockTut prints a BlockTut.
func (*TxtPrinter) VisitCourse ¶
func (v *TxtPrinter) VisitCourse(c *Course)
VisitCourse prints a Course.
func (*TxtPrinter) VisitLessonTut ¶
func (v *TxtPrinter) VisitLessonTut(l *LessonTut)
VisitLessonTut prints a LessonTut.
func (*TxtPrinter) VisitTopCourse ¶
func (v *TxtPrinter) VisitTopCourse(t *TopCourse)
VisitTopCourse prints the children of a TopCourse.