parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParserNotSupported = errors.New("Unsupported parser")

ErrParserNotSupported an unknown parser type was given

Functions

This section is empty.

Types

type BasicParser

type BasicParser struct {
	// contains filtered or unexported fields
}

BasicParser Is the default parser for notes. The first sentence is used as the title. Everything after the first sentence is used as the note's body. Any word starting with `#` is parsed as a tag.

func (*BasicParser) Body

func (p *BasicParser) Body() string

Body returns the parsed body

func (*BasicParser) Parse

func (p *BasicParser) Parse(text string)

Parse parses the text for the note's title, tags, and body

func (*BasicParser) Tags

func (p *BasicParser) Tags() []string

Tags returns the parsed tags

func (*BasicParser) Title

func (p *BasicParser) Title() string

Title returns the parsed title

type Parser

type Parser interface {
	Parse(text string)
	Title() string
	Tags() []string
	Body() string
}

Parser interface for a note parser

func NewParser

func NewParser(ptype string) (Parser, error)

NewParser returns a new parser for the type given

Jump to

Keyboard shortcuts

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