markupstring

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 3 Imported by: 0

README

markup-string

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Markup

type Markup struct {
	Name      string
	Value     interface{}
	Reference string
}

type MarkupEntry

type MarkupEntry struct {
	Text       string
	Properties []Markup
	Parsed     string
}

func (*MarkupEntry) ExecParse

func (mark *MarkupEntry) ExecParse(runner *Runner, current string, stopOnErrors bool) (string, error)

type MarkupParser

type MarkupParser struct {
	HandleErrors bool          // flag if we stop on errors
	Entries      []MarkupEntry // contains all found markups
	LeftString   string        // at least the part of the string, until the first markup
}

func (*MarkupParser) ParseAll

func (mp *MarkupParser) ParseAll(runner *Runner) (string, error)

ParseAll is actually the main handler to run all parsings

type MarkupRunner

type MarkupRunner struct {
	// Callback that is responsible for a defined markup.
	// the current string contains all changes they are done
	// already by all markups before
	Exec func(mk Markup, current string) string
}

type Runner

type Runner struct {
	HandleErrors bool

	UseCache bool
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(handleErrors bool, bracketsAndSepByChar string) (*Runner, error)

func (*Runner) AddRunner

func (r *Runner) AddRunner(responsible string, runner MarkupRunner) error

AddRunner applies the logic to an markup

func (*Runner) DisableParsing

func (r *Runner) DisableParsing() *Runner

func (*Runner) EnableParsing

func (r *Runner) EnableParsing() *Runner

func (*Runner) IsDisabled

func (r *Runner) IsDisabled() bool

func (*Runner) Parse

func (r *Runner) Parse(str string) (string, error)

func (*Runner) ParseMarkup

func (r *Runner) ParseMarkup(orig string) MarkupParser

ParseMarkup is parsing the origin string. what means it extracts all markups in the the string and then create an assignemnt what markup is responsible for which part ot the text

Jump to

Keyboard shortcuts

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