syntax

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTMLConfig = HTMLConfig{
	String: "str", Keyword: "kwd", Comment: "com", Type: "typ", Literal: "lit", Punctuation: "pun", Plaintext: "pln",
	Tag: "tag", HTMLTag: "htm", HTMLAttrName: "atn", HTMLAttrValue: "atv", Decimal: "dec", Whitespace: "",
}

DefaultHTMLConfig ...

Functions

func AsHTML

func AsHTML(src []byte, options ...Option) ([]byte, error)

AsHTML ...

func NewScanner

func NewScanner(src []byte) *scanner.Scanner

NewScanner ...

func NewScannerReader

func NewScannerReader(src io.Reader) *scanner.Scanner

NewScannerReader ...

func Print

func Print(s *scanner.Scanner, w io.Writer, p Printer) error

Print ...

Types

type HTMLConfig

type HTMLConfig struct {
	String        string
	Keyword       string
	Comment       string
	Type          string
	Literal       string
	Punctuation   string
	Plaintext     string
	Tag           string
	HTMLTag       string
	HTMLAttrName  string
	HTMLAttrValue string
	Decimal       string
	Whitespace    string
	AsOrderedList bool
}

HTMLConfig ...

func (HTMLConfig) Class

func (c HTMLConfig) Class(kind Kind) string

Class ....

type HTMLPrinter

type HTMLPrinter HTMLConfig

HTMLPrinter ...

func (HTMLPrinter) Print

func (p HTMLPrinter) Print(w io.Writer, kind Kind, tokText string) error

Print ...

type Kind

type Kind uint8

Kind ...

const (
	Whitespace Kind = iota
	String
	Keyword
	Comment
	Type
	Literal
	Punctuation
	Plaintext
	Tag
	HTMLTag
	HTMLAttrName
	HTMLAttrValue
	Decimal
)

const

type Option

type Option func(options *HTMLConfig)

Option ...

func OrderedList

func OrderedList() Option

OrderedList ...

type Printer

type Printer interface {
	Print(w io.Writer, kind Kind, tokText string) error
}

Printer ...

Jump to

Keyboard shortcuts

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