peyote

package module
v0.0.0-...-7d9bb2c Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: ISC Imports: 10 Imported by: 1

README

peyote

cacti gemtext parser and writer

Documentation

Index

Constants

View Source
const (
	PSNone         ParserState = iota
	PSMetadata                 = iota
	PSPreformatted             = iota
	PSBlockquote               = iota
	PSList                     = iota
)
View Source
const (
	NodeNil               NodeType = iota
	NodePara                       = iota
	NodeH1                         = iota
	NodeH2                         = iota
	NodeH3                         = iota
	NodeLink                       = iota
	NodeListStart                  = iota
	NodeListText                   = iota
	NodeListEnd                    = iota
	NodePreformattedStart          = iota
	NodePreformattedAlt            = iota
	NodePreformattedText           = iota
	NodePreformattedEnd            = iota
	NodeBlockquoteStart            = iota
	NodeBlockquoteText             = iota
	NodeBlockquoteEnd              = iota
)

Variables

This section is empty.

Functions

func WriteHTML

func WriteHTML(n Node, w io.Writer) error

Types

type Metadata

type Metadata struct {
	Title   string
	Aside   string
	Special bool
	Date    time.Time
	Extra   map[string]string
}

type Metadatable

type Metadatable interface {
	Set(key string, value string)
}

type Node

type Node struct {
	Type NodeType
	Text string
	URL  string
}

type NodeType

type NodeType uint16

type Parser

type Parser struct {
	Metadata Metadatable
	// contains filtered or unexported fields
}

func NewParser

func NewParser(r io.ReadSeeker, md Metadatable) Parser

func NewParserFromString

func NewParserFromString(s string, md Metadatable) Parser

func (*Parser) Next

func (gp *Parser) Next() bool

func (*Parser) Node

func (gp *Parser) Node() Node

func (*Parser) ParseMetadata

func (gp *Parser) ParseMetadata()

func (*Parser) Restart

func (gp *Parser) Restart()

func (*Parser) WriteDocument

func (gp *Parser) WriteDocument(w io.Writer, fn func(n Node, w io.Writer) error) error

type ParserState

type ParserState uint16

Jump to

Keyboard shortcuts

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