Documentation ¶
Index ¶
- Variables
- func AppendChild(parent goldast.Node, child goldast.Node)
- func ConvertTextForSubenv(node goldast.Node, reader goldtext.Reader, treatments *Treatment)
- func ConvertToRundownNode(node *ast.RundownBlock, reader goldtext.Reader) (goldast.Node, error)
- func DissolveRundownBlock(block goldast.Node)
- func FindEndOfSection(startNode *goldast.Heading) goldast.Node
- func NewRundownASTTransformer() *rundownASTTransformer
- func PopulateSectionMetadata(start *ast.SectionPointer, reader goldtext.Reader)
- func Remove(nodeToRemove goldast.Node, reader goldtext.Reader) goldast.Node
- func Replace(nodeToReplace goldast.Node, replacement goldast.Node)
- func ReplaceWithChildren(nodeToReplace goldast.Node, replacement goldast.Node, ...)
- type GatherProcessor
- type NodeProcessor
- type OpenTags
- type RundownHtmlTag
- 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 ConvertToRundownNode ¶
Converts a RundownBlock into a proper instruction node. Returns the node to continue iterating from, or an error.
func DissolveRundownBlock ¶
Deletes a rundown block, moving it's children into it's parent.
func FindEndOfSection ¶
Given the startNode (being the section node itself), returns the last node of the section. Called after the section has been inserted into the AST, but before children have been moved into it.
func NewRundownASTTransformer ¶
func NewRundownASTTransformer() *rundownASTTransformer
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, 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.
type RundownHtmlTag ¶
type RundownHtmlTag struct {
// contains filtered or unexported fields
}
func ExtractRundownElement ¶
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.