parser

package
v0.0.0-...-6fde0a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BlockName       = "Block"
	BlockResultName = "BlockResult"
)
View Source
const (
	InlineTextName      = "InlineText"
	InlineLinkName      = "Link"
	InlinePercentName   = "Percent"
	InlineEmphasisName  = "Emphasis"
	InlineLineBreakName = "LineBreak"
	InlineBackSlashName = "BackSlash"
	InlineTimestampName = "Timestamp"
)
View Source
const (
	ListName        = "List"
	ListItemName    = "ListItem"
	OrderlistName   = "OrderList"
	UnorderlistName = "UnorderList"
	DescriptiveName = "Descriptive"

	DescriptiveItemName = "DescriptiveItem"
)
View Source
const (
	HrName        = "Hr"
	FootnoteName  = "Footnote"
	BlanklineName = "Blankline"
	ParagraghName = "Paragragh"
)
View Source
const (
	TableName       = "Table"
	TableRowName    = "TableRow"
	TableColumnName = "TableColumn"
)
View Source
const (
	DrawerName = "Drawer"
)
View Source
const HeadingName = "Heading"
View Source
const (
	KeywordName = "Keyword"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Blankline

type Blankline struct {
	Count int
}

func (Blankline) Name

func (Blankline) Name() string

type Block

type Block struct {
	Type       string
	Parameters []string
	Result     *BlockResult
	Children   []Node
}

func (Block) Name

func (Block) Name() string

type BlockResult

type BlockResult struct {
	Children []Node
}

func (BlockResult) Name

func (BlockResult) Name() string

type DescriptiveItem

type DescriptiveItem struct {
	Level    int
	Bullet   string
	Status   string
	Title    string
	Descs    []Node
	Children []Node
}

func (DescriptiveItem) Name

func (DescriptiveItem) Name() string

type Document

type Document struct {
	Children        []Node
	Sections        *Section
	Keywords        map[string]string
	Properties      map[string]string
	Hyperlinks      []string
	TimestampFormat string
}

func (*Document) Get

func (d *Document) Get(k string) string

func (*Document) Set

func (d *Document) Set(k, v string)

type Drawer

type Drawer struct {
	Type       string
	Level      int
	Properties map[string]string
	Children   []Node
}

func (*Drawer) Get

func (s *Drawer) Get(key string) string

func (Drawer) Name

func (Drawer) Name() string

type Footnote

type Footnote struct {
	Label      string
	Inline     bool
	Definition []Node
}

func (Footnote) Name

func (Footnote) Name() string

type Heading

type Heading struct {
	Index      string
	Stars      int
	Keyword    string
	Priority   string
	Title      []Node
	Tags       []string
	Properties *Drawer
	Children   []Node
}

STARS KEYWORD PRIORITY TITLE TAGS

func (*Heading) Id

func (s *Heading) Id() string

func (Heading) Name

func (Heading) Name() string

type Hr

type Hr struct{}

func (Hr) Name

func (Hr) Name() string

type InlineBackSlash

type InlineBackSlash struct {
	Count int
	Break bool
}

func (InlineBackSlash) Name

func (InlineBackSlash) Name() string

type InlineEmphasis

type InlineEmphasis struct {
	Marker   string
	Children []Node
}

func (InlineEmphasis) Name

func (InlineEmphasis) Name() string

type InlineLineBreak

type InlineLineBreak struct {
	Count int
}

func (InlineLineBreak) Name

func (InlineLineBreak) Name() string
type InlineLink struct {
	URL      string
	Desc     string
	Protocol string
}

func (InlineLink) Name

func (InlineLink) Name() string

func (*InlineLink) Type

func (s *InlineLink) Type() LinkType

type InlinePercent

type InlinePercent struct {
	Num string
}

func (InlinePercent) Name

func (InlinePercent) Name() string

type InlineText

type InlineText struct {
	Raw     bool
	Content string
}

func (InlineText) Name

func (InlineText) Name() string

type InlineTimestamp

type InlineTimestamp struct {
	Time     time.Time
	IsDate   bool
	Interval string
}

func (InlineTimestamp) Name

func (InlineTimestamp) Name() string

type Keyword

type Keyword struct {
	Key   string
	Value string
}

func (*Keyword) Get

func (s *Keyword) Get(string) (string, bool)

func (Keyword) Name

func (Keyword) Name() string

type KeywordAttr

type KeywordAttr struct {
	Key   string
	Value map[string]string
}

type LinkType

type LinkType int
const (
	RegularLink LinkType = iota
	ImageLink
	VideoLink
)

type List

type List struct {
	Type     string
	Level    int
	Children []Node
}

func (List) Name

func (List) Name() string

type ListItem

type ListItem struct {
	Level    int
	Bullet   string
	Status   string
	Title    string
	Children []Node
}

func (ListItem) Kind

func (s ListItem) Kind() string

func (ListItem) Name

func (ListItem) Name() string

type Node

type Node interface {
	Name() string
}

func Parse

func Parse(d *Document, r io.Reader) []Node

func ParseFromLines

func ParseFromLines(d *Document, lines []string) []Node

func ParseFromText

func ParseFromText(d *Document, text string) []Node

type Paragragh

type Paragragh struct {
	Children []Node
}

func (Paragragh) Name

func (Paragragh) Name() string

type Parser

type Parser interface {
	Parse(*Document, []string) (Node, int)
	ParseAll(*Document, []string, bool) []Node
	ParseInline(*Document, string, int) (Node, int)
	ParseAllInline(*Document, string, bool) []Node
}

type Section

type Section struct {
	*Heading

	Children []*Section
	// contains filtered or unexported fields
}

type Table

type Table struct {
	Children []Node
}

func (Table) Name

func (Table) Name() string

type TableColumn

type TableColumn struct {
	Align    string
	Width    int
	IsHeader bool
	Children []Node
}

func (TableColumn) Name

func (TableColumn) Name() string

type TableRow

type TableRow struct {
	Children  []Node
	Separator bool
	Infos     []string
}

func (TableRow) Name

func (TableRow) Name() string

type WithKeyword

type WithKeyword struct {
	Caption   map[string][]string
	HTMLAttrs map[string][]string
	Node      Node
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL