thumblink

package
Version: v0.0.0-...-d98ca20 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package thumblink parses HTML and replaces links with images.

Index

Constants

This section is empty.

Variables

View Source
var ErrSeekPastEnd = errors.New("seek past possible end of stream")

Functions

func Join

func Join(htmlable []HTMLAble) string

func JoinLen

func JoinLen(a []string) int

Types

type HTML

type HTML []string

HTML represents raw HTML. no further transforming should be done

func (HTML) HTML

func (l HTML) HTML() []string

HTML impl HTMLAble

func (HTML) Len

func (l HTML) Len() int

Len impl HTMLAble

type HTMLAble

type HTMLAble interface {
	HTML() []string
	Len() int
}

HTMLAble is a item that can be turned into HTML.

func FindLinks(input string) ([]HTMLAble, error)

FindLinks traverses HTML in input, making a array of HTMLAble

type Link url.URL

Link is the url of a link

func (*Link) HTML

func (l *Link) HTML() []string

HTML impl HTMLAble

func (*Link) HostMatch

func (l *Link) HostMatch(test string) bool

HostMatch returns true if the url's host looks like *test(:port)?

func (*Link) Len

func (l *Link) Len() int

Len impl HTMLAble

func (*Link) String

func (l *Link) String() string

String call url.*URL.String()

type Mutator

type Mutator interface {
	Mutate([]HTMLAble) ([]HTMLAble, []error)
	Help() string
}

Mutators mutate HTML data

type Peekable

type Peekable struct {
	Reader io.Reader
	// contains filtered or unexported fields
}

Peekable allows you to read ahead indefinatly It will cache any Read()s made on a Peeker. Read()int on a Peekable will destroy cache as it reads. Peekers are seekable to any point cached.

func NewPeekable

func NewPeekable(reader io.Reader, offset int) *Peekable

func (*Peekable) Peeker

func (a *Peekable) Peeker() *Peeker

func (*Peekable) PeekerOffset

func (a *Peekable) PeekerOffset(offset, mode int) (*Peeker, error)

func (*Peekable) Read

func (a *Peekable) Read(data []byte) (read int, err error)

type Peeker

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

func (*Peeker) Read

func (r *Peeker) Read(data []byte) (read int, err error)

func (*Peeker) Seek

func (r *Peeker) Seek(offset int64, mode int) (int64, error)

type Prefix

type Prefix struct {
	Prefix  string
	Mutator PrefixMutator
}

func (Prefix) Help

func (p Prefix) Help() string

func (Prefix) Mutate

func (p Prefix) Mutate(in []HTMLAble) ([]HTMLAble, []error)

type PrefixMutator

type PrefixMutator interface {
	Mutate(link *Link) ([]HTMLAble, []error)
	Help() string
}

type Tag

type Tag string

Tag represents a html tag.

func (Tag) HTML

func (t Tag) HTML() []string

HTML impl HTMLAble

func (Tag) Len

func (l Tag) Len() int

Len impl HTMLAble

type Text

type Text []string

Text represents text inside of a pair of Tags

func (Text) HTML

func (t Text) HTML() []string

HTML impl HTMLAble

func (Text) Len

func (l Text) Len() int

Len impl HTMLAble

Directories

Path Synopsis
mutators
fourChan
package fourChan transforms fourChan so they are inlined
package fourChan transforms fourChan so they are inlined
gfycat
package gfycat transform gfycat links so they are inlineable
package gfycat transform gfycat links so they are inlineable
google
package google transforms google tracking urls so the content that is pointed to is inlined
package google transforms google tracking urls so the content that is pointed to is inlined
imgur
package imgur transforms imgur so they are inlined
package imgur transforms imgur so they are inlined
reddit
package reddit transforms reddit threads so they are inlined
package reddit transforms reddit threads so they are inlined
twitch
package twitch transforms twitch so they are inlined
package twitch transforms twitch so they are inlined
twitter
package twitter transforms twitter so they are inlined
package twitter transforms twitter so they are inlined
vine
package vine transforms vine so they are inlined
package vine transforms vine so they are inlined
wiki
package wiki transforms wiki so they are inlined
package wiki transforms wiki so they are inlined
youtube
package youtube transforms youtube so they are inlined
package youtube transforms youtube so they are inlined

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL