annotate

package module
v0.0.0-...-f4cad6c Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2016 License: BSD-3-Clause Imports: 3 Imported by: 26 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

annotate

A Go package for applying multiple sets of annotations to a region of text.

Documentation on Sourcegraph

Build Status status authors Total views

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStartOutOfBounds       = errors.New("annotation start out of bounds")
	ErrEndOutOfBounds         = errors.New("annotation end out of bounds")
	ErrStartAndEndOutOfBounds = errors.New("annotations start and end out of bounds")
)

Functions

func Annotate

func Annotate(src []byte, anns Annotations, writeContent func(io.Writer, []byte)) ([]byte, error)

Annotates src with annotations in anns.

Annotating an empty byte array always returns an empty byte array.

Assumes anns is sorted (using sort.Sort(anns)).

func IsOutOfBounds

func IsOutOfBounds(err error) bool

Types

type Annotation

type Annotation struct {
	// Start and End byte offsets (not rune offsets).
	Start, End int

	Left, Right []byte
	WantInner   int
}

type Annotations

type Annotations []*Annotation

func (Annotations) Len

func (a Annotations) Len() int

func (Annotations) Less

func (a Annotations) Less(i, j int) bool

func (Annotations) Swap

func (a Annotations) Swap(i, j int)

Jump to

Keyboard shortcuts

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