Documentation ¶
Index ¶
- type BlockPgm
- type LessonPgm
- type LessonPgmExtractor
- func (v *LessonPgmExtractor) FirstTitle() string
- func (v *LessonPgmExtractor) Lessons() []*LessonPgm
- func (v *LessonPgmExtractor) VisitBlockTut(b *model.BlockTut)
- func (v *LessonPgmExtractor) VisitCourse(c *model.Course)
- func (v *LessonPgmExtractor) VisitLessonTut(l *model.LessonTut)
- func (v *LessonPgmExtractor) VisitTopCourse(t *model.TopCourse)
- type Program
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockPgm ¶
BlockPgm is input to execution.
func NewBlockPgm ¶
NewBlockPgm returns a block with the given code.
func NewBlockPgmFromBlockTut ¶
NewBlockPgmFromBlockTut converts a BlockTut to a BlockPgm.
type LessonPgm ¶
type LessonPgm struct {
// contains filtered or unexported fields
}
LessonPgm has a one to one correspondence to a file.
func NewLessonPgm ¶
NewLessonPgm is a ctor.
type LessonPgmExtractor ¶
type LessonPgmExtractor struct {
// contains filtered or unexported fields
}
LessonPgmExtractor extracts all Lessons in depth first order from a Tutorial to create a flat list of lessons. The lessons are edited - only blocks with the given label are carried over into the new extracted lessons. If a lesson has no blocks with the given label, it is completely dropped.
func NewLessonPgmExtractor ¶
func NewLessonPgmExtractor(label base.Label) *LessonPgmExtractor
NewLessonPgmExtractor is a ctor.
func (*LessonPgmExtractor) FirstTitle ¶
func (v *LessonPgmExtractor) FirstTitle() string
FirstTitle is first H1 header taken from the data - used as the overall title.
func (*LessonPgmExtractor) Lessons ¶
func (v *LessonPgmExtractor) Lessons() []*LessonPgm
Lessons found.
func (*LessonPgmExtractor) VisitBlockTut ¶
func (v *LessonPgmExtractor) VisitBlockTut(b *model.BlockTut)
VisitBlockTut does just that.
func (*LessonPgmExtractor) VisitCourse ¶
func (v *LessonPgmExtractor) VisitCourse(c *model.Course)
VisitCourse does just that.
func (*LessonPgmExtractor) VisitLessonTut ¶
func (v *LessonPgmExtractor) VisitLessonTut(l *model.LessonTut)
VisitLessonTut does just that.
func (*LessonPgmExtractor) VisitTopCourse ¶
func (v *LessonPgmExtractor) VisitTopCourse(t *model.TopCourse)
VisitTopCourse does just that.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a list of Lessons and a label. Each LessonPgm represents a file, so a Program is a collection of N files. Every BlockTut in every lesson is known to have the given label.
func NewProgram ¶
NewProgram returns a program with the given lessons.
func NewProgramFromTutorial ¶
NewProgramFromTutorial builds a program from blocks extracted from a tutorial.
func (Program) PrintNormal ¶
PrintNormal simply prints the contents of a program.
func (Program) PrintPreambled ¶
PrintPreambled emits the first n blocks of a file normally, then emits the n blocks _again_, as well as all the remaining blocks from remaining files, so that they run in a subshell with signal handling.
This allows the aggregate command sequence (series of command blocks) to be structured as 1) a preamble initialization that impacts the environment of the active shell, followed by 2) everything else executing in a subshell that exits on error. That way, an exit in (2) won't cause the active shell to close. This is annoying if one is running the sequence in a terminal.
It's up to the markdown author to assure that the n blocks can always complete without exit on error because they will run in the existing terminal. These blocks should just set environment variables and/or define shell functions.
The goal is to let the user both modify their existing terminal environment, and run remaining code in a trapped subshell, and survive any errors in that subshell with a modified environment.