html

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

helper library for parsing HTML for Altid markup

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTMLCleaner added in v0.1.0

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

HTMLCleaner wraps the underlying WriteCloser, and handles parsing HTML into Altid-flavoured markdown, to the underlying writer.

func NewHTMLCleaner added in v0.1.0

func NewHTMLCleaner(w io.WriteCloser, p Handler) (*HTMLCleaner, error)

NewHTMLCleaner returns a usable HTMLCleaner struct if either w or p are nil it will return an error

func (*HTMLCleaner) Close added in v0.1.0

func (c *HTMLCleaner) Close()

Close calls the underlying WriteCloser's Close method.

func (*HTMLCleaner) Parse added in v0.1.0

func (c *HTMLCleaner) Parse(r io.ReadCloser) error

Parse - This assumes properly formatted html, and will return an error from the underlying html tokenizer if encountered Parse writes properly formatted Altid markup to the underlying writer, translating many elements into their markdown form. This will be considered lossy, as the token metadata is ignored in all cases. This will return any errors encountered, and EOF on success

func (*HTMLCleaner) Write added in v0.1.0

func (c *HTMLCleaner) Write(msg []byte) (n int, err error)

Write calls the underlying WriteCloser's Write method. It does not modify the contents of `msg`

func (*HTMLCleaner) WriteString added in v0.1.0

func (c *HTMLCleaner) WriteString(msg string) (n int, err error)

WriteString is the same as Write, except it accepts a string instead of bytes.

type Handler

type Handler interface {
	NavHandler
	ImgHandler
}

type ImgHandler

type ImgHandler interface {
	Img(string) error
}
type NavHandler interface {
	Nav(*markup.Url) error
}

Jump to

Keyboard shortcuts

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