microformats: willnorris.com/go/microformats Index | Files

package microformats

import "willnorris.com/go/microformats"

Package microformats provides a microformats V2 parser.

See also: http://microformats.org/wiki/microformats2

Index

Package Files

datetime.go microformats.go

type Data Uses

type Data struct {
    Items   []*Microformat      `json:"items"`
    Rels    map[string][]string `json:"rels"`
    RelURLs map[string]*RelURL  `json:"rel-urls"`
}

Data specifies all of the microformats and data parsed from a single HTML page.

func Parse Uses

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

Parse the microformats found in the HTML document read from r. baseURL is the URL this document was retrieved from which is used to resolve any relative URLs.

func ParseNode Uses

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

ParseNode parses the microformats found in doc. baseURL is the URL this document was retrieved from which is used to resolve any relative URLs.

type Microformat Uses

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"`
}

Microformat specifies a single microformat object and its properties. It may represent a person, an address, a blog post, etc.

type RelURL Uses

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"`
}

RelURL represents the attributes of a URL. The URL value itself is the map key in the RelURLs field of the Data type.

Package microformats imports 9 packages (graph). Updated 2017-06-23. Refresh now. Tools for package owners.