microformats

package module
v0.0.0-...-25ae286 Latest Latest
Warning

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

Go to latest
Published: May 23, 2015 License: MIT Imports: 7 Imported by: 4

README

Build Status

Alpha status microformats2 parser in golang

Documentation

Overview

Microformats V2 parser library

http://microformats.org/wiki/microformats2

microformats project microformats.go

Index

Constants

This section is empty.

Variables

View Source
var (
	RootClassNames     = regexp.MustCompile("^h-\\S*$")
	PropertyClassNames = regexp.MustCompile("^(p|u|dt|e)-(\\S*)$")
)

Functions

func GetAttr

func GetAttr(node *html.Node, name string) string

func GetClasses

func GetClasses(node *html.Node) []string

func HasMatchingClass

func HasMatchingClass(node *html.Node, regex *regexp.Regexp) bool

func ParseValueClass

func ParseValueClass(node *html.Node) string

Types

type AlternateRel

type AlternateRel struct {
	URL      string `json:"url,omitempty"`
	Rel      string `json:"rel,omitempty"`
	Media    string `json:"media,omitempty"`
	HrefLang string `json:"hreflang,omitempty"`
	Type     string `json:"type,omitempty"`
}

type Data

type Data struct {
	Items      []*MicroFormat      `json:"items"`
	Rels       map[string][]string `json:"rels"`
	Alternates []*AlternateRel     `json:"alternates,omitempty"`
	RelURLs    map[string]*RelURL  `json:"rel-urls,omitempty"`
}

type MicroFormat

type MicroFormat struct {
	Value      string                   `json:"value,omitempty"`
	HTML       string                   `json:"html,omitempty"`
	Type       []string                 `json:"type"`
	Properties map[string][]interface{} `json:"properties"`
	Shape      string                   `json:"shape,omitempty"`
	Coords     string                   `json:"coords,omitempty"`
	Children   []*MicroFormat           `json:"children,omitempty"`
}

type Parser

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

func New

func New() *Parser

func (*Parser) Parse

func (p *Parser) Parse(r io.Reader, baseURL *url.URL) *Data

func (*Parser) ParseNode

func (p *Parser) ParseNode(doc *html.Node, baseURL *url.URL) *Data

type RelURL

type RelURL struct {
	Rels     []string `json:"rels,omitempty"`
	Text     string   `json:"text,omitempty"`
	Media    string   `json:"media,omitempty"`
	HrefLang string   `json:"hreflang,omitempty"`
	Type     string   `json:"type,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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