Documentation ¶
Index ¶
- type AdornmentNode
- type BlockQuoteNode
- type BulletListItemNode
- type BulletListNode
- type CommentNode
- type DefinitionListItemNode
- type DefinitionListNode
- type DefinitionNode
- type DefinitionTermNode
- type EnumAffixType
- type EnumListNode
- type EnumListType
- type InlineEmphasisNode
- type InlineInterpretedText
- type InlineInterpretedTextRole
- type InlineLiteralNode
- type InlineStrongNode
- type JSON
- type LiteralBlockNode
- type Node
- type NodeList
- type NodeTarget
- type NodeType
- type ParagraphNode
- type Renderer
- type SectionNode
- type SystemMessageNode
- type SystemMessagesNode
- type TextNode
- type TitleNode
- type TransitionNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdornmentNode ¶
type AdornmentNode struct { Type NodeType `json:"type"` Rune rune `json:"rune,string"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
AdornmentNode contains the parsed data for a section overline or underline.
func (AdornmentNode) MarshalJSON ¶
func (a AdornmentNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (AdornmentNode) NodeType ¶
func (a AdornmentNode) NodeType() NodeType
NodeType returns the Node type of the AdornmentNode.
func (AdornmentNode) String ¶
func (a AdornmentNode) String() string
String satisfies the Stringer interface
type BlockQuoteNode ¶
type BlockQuoteNode struct { Type NodeType `json:"type"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` // NodeList contains Nodes parsed as children of the BlockQuoteNode. NodeList `json:"nodeList"` }
BlockQuoteNode contains a parsed blockquote Node. Any nodes that are children of the blockquote are contained in NodeList.
func NewBlockQuote ¶
func NewBlockQuote(i *tok.Item) *BlockQuoteNode
func NewEmptyBlockQuote ¶
func NewEmptyBlockQuote(i *tok.Item) *BlockQuoteNode
func (BlockQuoteNode) MarshalJSON ¶
func (b BlockQuoteNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (BlockQuoteNode) NodeType ¶
func (b BlockQuoteNode) NodeType() NodeType
NodeType returns the Node type of the BlockQuoteNode.
func (BlockQuoteNode) String ¶
func (b BlockQuoteNode) String() string
String satisfies the Stringer interface
type BulletListItemNode ¶
BulletListItemNode defines a Bullet List Item element.
func NewBulletListItemNode ¶
func NewBulletListItemNode(i *tok.Item) *BulletListItemNode
NewBulletListNode initializes a new EnumListNode.
func (BulletListItemNode) MarshalJSON ¶
func (b BulletListItemNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (BulletListItemNode) NodeType ¶
func (b BulletListItemNode) NodeType() NodeType
NodeType returns the type of Node for the bullet list item.
func (BulletListItemNode) String ¶
func (b BulletListItemNode) String() string
String satisfies the Stringer interface
type BulletListNode ¶
type BulletListNode struct { Type NodeType `json:"type"` Bullet string `json:"bullet"` NodeList `json:"nodeList"` }
BulletListNode defines a bullet list element.
func NewBulletListNode ¶
func NewBulletListNode(i *tok.Item) *BulletListNode
NewEnumListNode initializes a new BulletListNode.
func (BulletListNode) MarshalJSON ¶
func (b BulletListNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (BulletListNode) NodeType ¶
func (b BulletListNode) NodeType() NodeType
NodeType returns the type of Node for the bullet list.
func (BulletListNode) String ¶
func (b BulletListNode) String() string
String satisfies the Stringer interface
type CommentNode ¶
type CommentNode struct { Type NodeType `json:"type"` Text string `json:"text,omitempty"` Length int `json:"length,omitempty"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
CommentNode is a parsed comment element. Comment elements do not appear as visible elements in document transformations.
func NewComment ¶
func NewComment(i *tok.Item) *CommentNode
func (CommentNode) MarshalJSON ¶
func (c CommentNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (CommentNode) NodeType ¶
func (c CommentNode) NodeType() NodeType
NodeType returns the Node type of the CommentNode.
func (CommentNode) String ¶
func (c CommentNode) String() string
String satisfies the Stringer interface
type DefinitionListItemNode ¶
type DefinitionListItemNode struct { Type NodeType `json:"type"` Term *DefinitionTermNode `json:"term"` Definition *DefinitionNode `json:"definition"` }
DefinitionListItemNode defines a definition list item element.
func NewDefinitionListItem ¶
func NewDefinitionListItem(defTerm *tok.Item, def *tok.Item) *DefinitionListItemNode
func (DefinitionListItemNode) MarshalJSON ¶
func (d DefinitionListItemNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (DefinitionListItemNode) NodeType ¶
func (d DefinitionListItemNode) NodeType() NodeType
NodeType returns the Node type of DefinitionListItemNode.
func (DefinitionListItemNode) String ¶
func (d DefinitionListItemNode) String() string
String satisfies the Stringer interface
type DefinitionListNode ¶
DefinitionListNode defines a definition list element.
func NewDefinitionList ¶
func NewDefinitionList(i *tok.Item) *DefinitionListNode
func (DefinitionListNode) MarshalJSON ¶
func (d DefinitionListNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (DefinitionListNode) NodeType ¶
func (d DefinitionListNode) NodeType() NodeType
NodeType returns the Node type of DefinitionListNode.
func (DefinitionListNode) String ¶
func (d DefinitionListNode) String() string
String satisfies the Stringer interface
type DefinitionNode ¶
type DefinitionNode struct { Type NodeType `json:"type"` Line int `json:"line,omitempty"` NodeList `json:"nodeList"` }
DefinitionNode defines a difinition element.
func (DefinitionNode) MarshalJSON ¶
func (d DefinitionNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (DefinitionNode) NodeType ¶
func (d DefinitionNode) NodeType() NodeType
NodeType returns the Node type of DefinitionNode.
func (DefinitionNode) String ¶
func (d DefinitionNode) String() string
String satisfies the Stringer interface
type DefinitionTermNode ¶
type DefinitionTermNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
DefinitionTermNode defines a definition list term element.
func (DefinitionTermNode) MarshalJSON ¶
func (d DefinitionTermNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (DefinitionTermNode) NodeType ¶
func (d DefinitionTermNode) NodeType() NodeType
NodeType returns the Node type of DefinitionTermNode.
func (DefinitionTermNode) String ¶
func (d DefinitionTermNode) String() string
String satisfies the Stringer interface
type EnumAffixType ¶
type EnumAffixType int
EnumAffixType identifies the type of affix for the Enumerated list element
func (EnumAffixType) String ¶
func (a EnumAffixType) String() string
String satisfies the Stringer interface
type EnumListNode ¶
type EnumListNode struct { Type NodeType `json:"type"` EnumType EnumListType `json:"enumType"` Affix EnumAffixType `json:"affix"` NodeList `json:"nodeList"` }
EnumListNode defines an enumerated list element.
func NewEnumListNode ¶
func NewEnumListNode(enumList *tok.Item, affix *tok.Item) *EnumListNode
NewEnumListNode initializes a new EnumListNode.
func (EnumListNode) MarshalJSON ¶
func (e EnumListNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (EnumListNode) NodeType ¶
func (e EnumListNode) NodeType() NodeType
NodeType returns the Node type of the EnumListNode.
func (EnumListNode) String ¶
func (e EnumListNode) String() string
String satisfies the Stringer interface
type EnumListType ¶
type EnumListType int
EnumListType identifies the type of the enumeration list element
func (EnumListType) String ¶
func (e EnumListType) String() string
type InlineEmphasisNode ¶
type InlineEmphasisNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
InlineEmphasisNode is parsed inline italicized text.
func NewInlineEmphasis ¶
func NewInlineEmphasis(i *tok.Item) *InlineEmphasisNode
func (InlineEmphasisNode) MarshalJSON ¶
func (e InlineEmphasisNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (InlineEmphasisNode) NodeType ¶
func (e InlineEmphasisNode) NodeType() NodeType
NodeType returns the Node type of the InlineEmphasisNode.
func (InlineEmphasisNode) String ¶
func (e InlineEmphasisNode) String() string
String satisfies the Stringer interface
type InlineInterpretedText ¶
type InlineInterpretedText struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` // NodeList contains Nodes parsed as children of the BlockQuoteNode. NodeList `json:"nodeList"` }
InlineInterpretedText is a parsed interpreted text role.
func NewInlineInterpretedText ¶
func NewInlineInterpretedText(i *tok.Item) *InlineInterpretedText
func (InlineInterpretedText) MarshalJSON ¶
func (i InlineInterpretedText) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (InlineInterpretedText) NodeType ¶
func (i InlineInterpretedText) NodeType() NodeType
NodeType returns the Node type of the InlineInterpretedText.
func (InlineInterpretedText) String ¶
func (i InlineInterpretedText) String() string
String satisfies the Stringer interface
type InlineInterpretedTextRole ¶
type InlineInterpretedTextRole struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
InlineInterpretedTextRole is a parsed interpreted text role.
func NewInlineInterpretedTextRole ¶
func NewInlineInterpretedTextRole(i *tok.Item) *InlineInterpretedTextRole
func (InlineInterpretedTextRole) MarshalJSON ¶
func (i InlineInterpretedTextRole) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (InlineInterpretedTextRole) NodeType ¶
func (i InlineInterpretedTextRole) NodeType() NodeType
NodeType returns the Node type of the InlineInterpretedTextRole
func (InlineInterpretedTextRole) String ¶
func (i InlineInterpretedTextRole) String() string
String satisfies the Stringer interface
type InlineLiteralNode ¶
type InlineLiteralNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
InlineLiteralNode is a parsed inline literal node.
func NewInlineLiteral ¶
func NewInlineLiteral(i *tok.Item) *InlineLiteralNode
func (InlineLiteralNode) MarshalJSON ¶
func (l InlineLiteralNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (InlineLiteralNode) NodeType ¶
func (l InlineLiteralNode) NodeType() NodeType
NodeType returns the Node type of the InlineStrongNode.
func (InlineLiteralNode) String ¶
func (l InlineLiteralNode) String() string
String satisfies the Stringer interface
type InlineStrongNode ¶
type InlineStrongNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
InlineStrongNode is a parsed inline bold text.
func NewInlineStrong ¶
func NewInlineStrong(i *tok.Item) *InlineStrongNode
func (InlineStrongNode) MarshalJSON ¶
func (s InlineStrongNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (InlineStrongNode) NodeType ¶
func (s InlineStrongNode) NodeType() NodeType
NodeType returns the Node type of the InlineStrongNode.
func (InlineStrongNode) String ¶
func (s InlineStrongNode) String() string
String satisfies the Stringer interface
type JSON ¶
type JSON struct { Messages *NodeList Nodes *NodeList log.Logger // contains filtered or unexported fields }
JSON type for rendering the document to JSON. Do not initialize this directly. Call JsonRenderer instead.
type LiteralBlockNode ¶
type LiteralBlockNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
LiteralBlockNode is a parsed literal block element.
func NewLiteralBlock ¶
func NewLiteralBlock(i *tok.Item) *LiteralBlockNode
func (LiteralBlockNode) MarshalJSON ¶
func (l LiteralBlockNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (LiteralBlockNode) NodeType ¶
func (l LiteralBlockNode) NodeType() NodeType
NodeType returns the Node type of LiteralBlockNode.
func (LiteralBlockNode) String ¶
func (l LiteralBlockNode) String() string
String satisfies the Stringer interface
type NodeList ¶
type NodeList []Node
NodeList is a list of parser nodes that implement Node.
func (*NodeList) MarshalJSON ¶
MarshalJSON satisfies the Marshaler interface.
type NodeTarget ¶
type NodeTarget struct { MainList *NodeList // The default NodeList for reset() SubList *NodeList // The nodelist contained in target Parent Node // If set, a parent Node containing a NodeList. Can be nil. log.Logger // contains filtered or unexported fields }
NodeTarget contains the NodeList where subsequent nodes will be added during parsing. It also contains a pointer to the parent Node of the NodeTarget NodeList.
func NewNodeTarget ¶
func NewNodeTarget(pNodes *NodeList, logConf log.Config) *NodeTarget
NewNodeTarget creates a NodeTarget with a context logger.
func (*NodeTarget) Append ¶
func (nt *NodeTarget) Append(n ...Node)
Append add a node to the NodeTarget list.
func (*NodeTarget) IsParagraphNode ¶
func (nt *NodeTarget) IsParagraphNode() bool
IsParentParagraph will return true if the parent Node of the NodeTarget is a paragraph.
func (*NodeTarget) Reset ¶
func (nt *NodeTarget) Reset()
Reset sets the NodeTarget to the root document.
func (*NodeTarget) SetParent ¶
func (nt *NodeTarget) SetParent(n Node)
SetParent sets the NodeTarget to the NodeList of a Node
type NodeType ¶
type NodeType int
NodeType identifies the type of a parse tree node.
const ( // NodeSection is a section element. NodeSection NodeType = iota // NodeText is ordinary text. NodeText // NodeParagraph is a paragraph container that contains text and inline markup. NodeParagraph // NodeAdornment is the overline or underline of a section. NodeAdornment // NodeBlockQuote is a blockquote element. NodeBlockQuote // NodeSystemMessage contains an error encountered by the parser. NodeSystemMessage // NodeSystemMessages contains a list of NodeSystemMessage NodeSystemMessages // NodeLiteralBlock is a literal block element. NodeLiteralBlock // NodeTransition is a transition element. Transitions are very similar // to NodeSection except that they have newlines before and after. NodeTransition // NodeTitle is a section title element to be used inside SectionNodes. NodeTitle // NodeComment is a comment element NodeComment // NodeBulletList is the beginning of a bullet list NodeBulletList // NodeBulletListItem is a bullet list item NodeBulletListItem // NodeEnumList is an enumerated list NodeEnumList // NodeDefinitionList is the beginning of a definition list element NodeDefinitionList // NodeDefinitionListItem is a definition list item NodeDefinitionListItem // NodeDefinitionTerm is a definition list term element NodeDefinitionTerm // NodeDefinition is a definition element NodeDefinition // NodeInlineEmphasis is the italicized text element NodeInlineEmphasis // NodeInlineStrong is the bold text element NodeInlineStrong // NodeInlineLiteral defines inline literal markup NodeInlineLiteral // NodeInlineInterpretedText is part of an interpreted text role NodeInlineInterpretedText // NodeInlineInterpretedTextRole is the role of the interpreted text NodeInlineInterpretedTextRole )
type ParagraphNode ¶
type ParagraphNode struct { Type NodeType `json:"type"` NodeList `json:"nodeList"` // NodeList contains children of the ParagraphNode, even other ParagraphNodes! }
ParagraphNode is a parsed paragraph.
func NewParagraph ¶
func NewParagraph() *ParagraphNode
func NewParagraphWithNodeText ¶
func NewParagraphWithNodeText(i *tok.Item) *ParagraphNode
func (ParagraphNode) MarshalJSON ¶
func (p ParagraphNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (ParagraphNode) NodeType ¶
func (p ParagraphNode) NodeType() NodeType
NodeType returns the Node type of the ParagraphNode.
func (ParagraphNode) String ¶
func (p ParagraphNode) String() string
String satisfies the Stringer interface
type SectionNode ¶
type SectionNode struct { Type NodeType `json:"type,string"` // Level is the hierarchical level of the section. The first level is level 1, any further sections encountered after // the first level are given consecutive level numbers. Level int `json:"level"` // OverLine and UnderLine are the parsed Nodes that make up the section. Title *TitleNode `json:"title"` OverLine *AdornmentNode `json:"overLine"` UnderLine *AdornmentNode `json:"underLine"` // NodeList contains NodeList `json:"nodeList"` }
SectionNode is a a single section node. It contains overline, title, and underline nodes. NodeList contains nodes that are children of the section.
func NewSection ¶
func (SectionNode) MarshalJSON ¶
func (s SectionNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (*SectionNode) NodeType ¶
func (s *SectionNode) NodeType() NodeType
NodeType returns the Node type of the SectionNode.
func (*SectionNode) String ¶
func (s *SectionNode) String() string
String satisfies the Stringer interface
type SystemMessageNode ¶
type SystemMessageNode struct { Type NodeType `json:"type"` // The line containing the problem resulted in the system message Line int `json:"line,omitempty"` // The start line of the message block StartLine int `json:"startLine,omitempty"` // The end line of the message block EndLine int `json:"endLine,omitempty"` // The character position of the start of the problem that resulted in a system message StartPosition int `json:"StartPosition,omitempty"` // The type of parser message that generated the systemMessage. MessageType string `json:"messageType"` // Severity is the level of importance of the message. It can be one of either info, warning, error, and severe. Severity string `json:"severity"` // NodeList contains children Nodes of the systemMessage. Typically containing the first list item as a NodeParagraph // which contains the message, and a NodeLiteralBlock which contains the input data causing the systemMessage to be // generated. NodeList `json:"nodeList"` }
SystemMessageNode are messages generated by the parser. System messages are leveled by severity and can be one of either Warning, Error, Info, and Severe.
func NewSystemMessage ¶
func NewSystemMessage(pm *messages.ParserMessage, line int) *SystemMessageNode
func (SystemMessageNode) MarshalJSON ¶
func (s SystemMessageNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (SystemMessageNode) NodeType ¶
func (s SystemMessageNode) NodeType() NodeType
NodeType returns the Node type of the SystemMessageNode.
func (SystemMessageNode) String ¶
func (s SystemMessageNode) String() string
String satisfies the Stringer interface
type SystemMessagesNode ¶
type SystemMessagesNode struct { Type NodeType `json:"type"` NodeList `json:"nodeList"` // NodeList contains a list of system messages generated while parsing }
SystemMessages contains system messages if present
func NewSystemMessagesNode ¶
func NewSystemMessagesNode() *SystemMessagesNode
func (SystemMessagesNode) MarshalJSON ¶
func (s SystemMessagesNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (SystemMessagesNode) NodeType ¶
func (s SystemMessagesNode) NodeType() NodeType
NodeType returns the Node type of the SystemMessagesNode.
func (SystemMessagesNode) String ¶
func (s SystemMessagesNode) String() string
String satisfies the Stringer interface
type TextNode ¶
type TextNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
TextNode is ordinary text. Typically added to the nodelist of parapgraphs.
func (TextNode) MarshalJSON ¶
MarshalJSON satisfies the Marshaler interface.
type TitleNode ¶
type TitleNode struct { // Text string `json:"text"` Type NodeType `json:"type"` IndentLength int `json:"indentLength,omitempty"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` NodeList `json:"nodeList"` // NodeList contains children of the ParagraphNode, even other ParagraphNodes! }
TitleNode contains the parsed data for a section titles.
func NewTitleNode ¶
func NewTitleNode() *TitleNode
func NewTitleNodeWithText ¶
func (TitleNode) MarshalJSON ¶
MarshalJSON satisfies the Marshaler interface.
type TransitionNode ¶
type TransitionNode struct { Type NodeType `json:"type"` Text string `json:"text"` Length int `json:"length"` Line int `json:"line,omitempty"` StartPosition int `json:"startPosition,omitempty"` }
TransitionNode is a parsed transition element. Transition elements are very similar to AdornmentNodes.
func NewTransition ¶
func NewTransition(i *tok.Item) *TransitionNode
func (TransitionNode) MarshalJSON ¶
func (t TransitionNode) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the Marshaler interface.
func (TransitionNode) NodeType ¶
func (t TransitionNode) NodeType() NodeType
NodeType returns the Node type of the TransitionNode.
func (TransitionNode) String ¶
func (t TransitionNode) String() string
String satisfies the Stringer interface