Documentation ¶
Index ¶
- Variables
- func ConvertTextForSubenv(node goldast.Node, reader goldtext.Reader, treatments *Treatment)
- func FindEndOfSection(startNode *goldast.Heading) goldast.Node
- func NewRundownASTTransformer() parser.ASTTransformer
- func PopulateSectionMetadata(start *ast.SectionPointer, end *ast.SectionEnd, reader goldtext.Reader)
- type GatherProcessor
- type NodeProcessor
- type OpenTags
- type RundownHtmlTag
- type SectionProcessor
- type SubEnvProcessor
- type Treatment
- func (t *Treatment) AppendChild(parent goldast.Node, child goldast.Node)
- func (t *Treatment) DissolveRundownBlock(block goldast.Node)
- func (t *Treatment) Ignore(nodeToIgnore goldast.Node)
- func (t *Treatment) IsIgnored(nodeInQuestion goldast.Node) bool
- func (t *Treatment) NewNodes() []goldast.Node
- func (t *Treatment) Process(reader goldtext.Reader)
- func (t *Treatment) Remove(nodeToRemove goldast.Node) goldast.Node
- func (t *Treatment) Replace(nodeToReplace goldast.Node, replacement goldast.Node)
- func (t *Treatment) ReplaceWithChildren(nodeToReplace goldast.Node, replacement goldast.Node, ...)
Constants ¶
This section is empty.
Variables ¶
var EnvMatcher = regexp.MustCompile(`(\$[A-Z0-9_]+)`)
Functions ¶
func ConvertTextForSubenv ¶
func FindEndOfSection ¶
Given the startNode (being the section node itself), returns the node which terminates the section.
func NewRundownASTTransformer ¶
func NewRundownASTTransformer() parser.ASTTransformer
Rundown AST Transformer converts Rundown Elements in the markdown tree into proper rundown nodes, and applies any effects.
func PopulateSectionMetadata ¶
func PopulateSectionMetadata(start *ast.SectionPointer, end *ast.SectionEnd, reader goldtext.Reader)
Types ¶
type GatherProcessor ¶
type GatherProcessor struct {
// contains filtered or unexported fields
}
func NewGatherProcessor ¶
func NewGatherProcessor(replacingNode goldast.Node, newNode goldast.Node) *GatherProcessor
Gathers nodes directly descending from replacingNode and putting them into newNode. If newNode is nil, then replacingNode and all children are deleted instead.
func (*GatherProcessor) Begin ¶
func (p *GatherProcessor) Begin(openingTag *RundownHtmlTag)
func (*GatherProcessor) End ¶
func (p *GatherProcessor) End(node goldast.Node, reader goldtext.Reader, openingTag *RundownHtmlTag, treatments *Treatment) bool
type NodeProcessor ¶
type NodeProcessor interface { Begin(openingTag *ast.RundownBlock) // Process a Markdown Node. Returns true to indicate the processor is done and should be removed. Process(node goldast.Node, reader goldtext.Reader, treatments *Treatment) bool // Indicates to the processor it should end itself. End(node goldast.Node, reader goldtext.Reader, treatments *Treatment) }
NodeProcessors allow us to apply effects to subsequent nodes or "child" nodes of a Rundown tag.
func ConvertToRundownNode ¶
func ConvertToRundownNode(node *ast.RundownBlock, reader goldtext.Reader, treatments *Treatment) NodeProcessor
type RundownHtmlTag ¶
type RundownHtmlTag struct {
// contains filtered or unexported fields
}
func ExtractRundownElement ¶
type SectionProcessor ¶
type SectionProcessor struct { SectionPointer *ast.SectionPointer // contains filtered or unexported fields }
SectionProcessor inserts a SectionEndPointer at the end of a section. Sections defined on a heading are terminated at the next heading of equal or structurally higher level. Sections defined as being wrapped inside a rundown tag are terminated at the end of the rundown tag.
func (*SectionProcessor) Begin ¶
func (p *SectionProcessor) Begin(openingTag *RundownHtmlTag)
func (*SectionProcessor) End ¶
func (p *SectionProcessor) End(node goldast.Node, reader goldtext.Reader, openingTag *RundownHtmlTag, treatments *Treatment) bool
type SubEnvProcessor ¶
type SubEnvProcessor struct {
// contains filtered or unexported fields
}
SubEnv Processor replaces all mentions of $ENV_VAR with a EnvironmentSubstitution node.
func (*SubEnvProcessor) Begin ¶
func (p *SubEnvProcessor) Begin(node *ast.RundownBlock)
type Treatment ¶
type Treatment struct {
// contains filtered or unexported fields
}
Treatment is used to indicate a node should be modified, but batches these modifications for after we've walked the AST, otherwise the walker gets confused.
func NewTreatment ¶
func (*Treatment) AppendChild ¶
func (*Treatment) DissolveRundownBlock ¶
Deletes a rundown block, moving it's children into it's parent.
func (*Treatment) Remove ¶
Remove a node. Returns what the next node will be after this node is removed.