mf2

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deflatten

func Deflatten(data map[string]interface{}) map[string]interface{}

Deflatten takes a flattened map and deflattens all single values to arrays.

func Flatten

func Flatten(data map[string][]interface{}) map[string]interface{}

Flatten takes a Microformats map and flattens all arrays with a single value to one element.

func IsType

func IsType(typ Type) bool

IsType checks if the given type is a valid Microformats type.

Types

type FlatHelper

type FlatHelper struct {
	Map        typed.Typed
	Properties typed.Typed
	// contains filtered or unexported fields
}

func NewFlatHelper

func NewFlatHelper(data map[string]interface{}) *FlatHelper

func (*FlatHelper) LocalityCountry

func (m *FlatHelper) LocalityCountry() string

func (*FlatHelper) LocationHTML

func (m *FlatHelper) LocationHTML() template.HTML

func (*FlatHelper) Name

func (m *FlatHelper) Name() string

func (*FlatHelper) Photos

func (m *FlatHelper) Photos() []map[string]interface{}

func (*FlatHelper) PostType

func (m *FlatHelper) PostType() Type

func (*FlatHelper) String

func (m *FlatHelper) String(prop string) string

func (*FlatHelper) Strings

func (m *FlatHelper) Strings(prop string) []string

func (*FlatHelper) Sub

func (m *FlatHelper) Sub(prop string) *FlatHelper

func (*FlatHelper) Type

func (m *FlatHelper) Type() string

func (*FlatHelper) TypeProperty

func (m *FlatHelper) TypeProperty() string

type Type

type Type string

Type represents a post type.

const (
	TypeRsvp     Type = "rsvp"
	TypeRepost   Type = "repost"
	TypeLike     Type = "like"
	TypeReply    Type = "reply"
	TypeBookmark Type = "bookmark"
	TypeFollow   Type = "follow"
	TypeRead     Type = "read"
	TypeWatch    Type = "watch"
	TypeListen   Type = "listen"
	TypeCheckin  Type = "checkin"
	TypeVideo    Type = "video"
	TypeAudio    Type = "audio"
	TypePhoto    Type = "photo"
	TypeEvent    Type = "event"
	TypeRecipe   Type = "recipe"
	TypeReview   Type = "review"
	TypeNote     Type = "note"
	TypeArticle  Type = "article"
	TypeAte      Type = "ate"
	TypeDrank    Type = "drank"
)

func DiscoverType

func DiscoverType(data map[string]interface{}) (Type, string)

DiscoverType discovers a post type from its properties according to the algorithm described in the "Post Type Discovery" specification.

This is a slightly modified version of @aaronpk's code to include reads and watches. Original code: https://github.com/aaronpk/XRay/blob/master/lib/XRay/PostType.php

Jump to

Keyboard shortcuts

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