fragment

package
v0.0.0-...-52599dc Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color string

A color fragment (hex color code)

func (*Color) AsHtml

func (c *Color) AsHtml() string

func (*Color) AsText

func (c *Color) AsText() string

func (*Color) Decode

func (c *Color) Decode(_ string, enc interface{}) error
func (c *Color) ResolveLinks(_ link.Resolver)

type Date

type Date time.Time

A date fragment (YYYY-MM-DD)

func (*Date) AsHtml

func (d *Date) AsHtml() string

func (*Date) AsText

func (d *Date) AsText() string

func (*Date) Decode

func (d *Date) Decode(_ string, enc interface{}) error
func (d *Date) ResolveLinks(_ link.Resolver)

type Embed

type Embed struct {
	Embed *embed.Embed
}

A embed fragment (see http://oembed.com/)

func (*Embed) AsHtml

func (e *Embed) AsHtml() string

func (*Embed) AsText

func (e *Embed) AsText() string

func (*Embed) Decode

func (e *Embed) Decode(_ string, enc interface{}) error
func (e *Embed) ResolveLinks(_ link.Resolver)

type Envelope

type Envelope struct {
	Type  string `json:"type"`
	Value interface{}
}

type Fragments

type Fragments map[string]List

type GeoPoint

type GeoPoint struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

A Geopoint

func (*GeoPoint) AsHtml

func (g *GeoPoint) AsHtml() string

func (*GeoPoint) AsText

func (g *GeoPoint) AsText() string

func (*GeoPoint) Decode

func (g *GeoPoint) Decode(_ string, enc interface{}) error
func (g *GeoPoint) ResolveLinks(_ link.Resolver)

type Group

type Group []GroupFragments

func NewGroup

func NewGroup(enc interface{}) (*Group, error)

func (*Group) AsHtml

func (g *Group) AsHtml() string

func (*Group) AsText

func (g *Group) AsText() string

func (*Group) Decode

func (g *Group) Decode(_ string, enc interface{}) error
func (g *Group) ResolveLinks(r link.Resolver)

type GroupFragments

type GroupFragments map[string]Interface

type Image

type Image struct {
	Main  image.View            `json:"main"`
	Views map[string]image.View `json:"views"`
}

An image, with multiple views

func (*Image) AsHtml

func (i *Image) AsHtml() string

func (*Image) AsText

func (i *Image) AsText() string

func (*Image) Decode

func (i *Image) Decode(_ string, enc interface{}) error

func (*Image) GetView

func (i *Image) GetView(view string) (*image.View, bool)

Returns a view of this image

func (i *Image) ResolveLinks(_ link.Resolver)

type Interface

type Interface interface {
	Decode(string, interface{}) error
	AsText() string
	AsHtml() string
	ResolveLinks(link.Resolver)
}
type Link struct {
	Link link.Link
}

A link fragment

func (*Link) AsHtml

func (l *Link) AsHtml() string

func (*Link) AsText

func (l *Link) AsText() string

func (*Link) Decode

func (l *Link) Decode(t string, enc interface{}) error
func (l *Link) ResolveLinks(r link.Resolver)

type List

type List []Interface

func (*List) UnmarshalJSON

func (fs *List) UnmarshalJSON(data []byte) error

type Number

type Number float64

A number

func (*Number) AsHtml

func (n *Number) AsHtml() string

func (*Number) AsText

func (n *Number) AsText() string

func (*Number) Decode

func (n *Number) Decode(_ string, enc interface{}) error
func (n *Number) ResolveLinks(_ link.Resolver)

type StructuredText

type StructuredText []block.Block

A structured text fragment is a list of blocks

func NewStructuredText

func NewStructuredText(enc interface{}) (*StructuredText, error)

func (StructuredText) AsHtml

func (st StructuredText) AsHtml() string

Formats the fragment content as html

func (StructuredText) AsText

func (st StructuredText) AsText() string

Formats the fragment content as text

func (*StructuredText) Decode

func (st *StructuredText) Decode(_ string, enc interface{}) error

func (StructuredText) GetFirstImage

func (st StructuredText) GetFirstImage() (*block.Image, bool)

Returns the first image fragment

func (StructuredText) GetFirstParagraph

func (st StructuredText) GetFirstParagraph() (*block.Paragraph, bool)

Returns the first paragraph fragment

func (StructuredText) GetFirstPreformatted

func (st StructuredText) GetFirstPreformatted() (*block.Preformatted, bool)

Returns the first preformatted fragment

func (st StructuredText) ResolveLinks(r link.Resolver)

type Text

type Text string

A text fragment

func (*Text) AsHtml

func (t *Text) AsHtml() string

func (*Text) AsText

func (t *Text) AsText() string

func (*Text) Decode

func (t *Text) Decode(_ string, enc interface{}) error
func (t *Text) ResolveLinks(_ link.Resolver)

type Tree

type Tree map[string]Fragments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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