Documentation ¶
Index ¶
- type Data
- type Exif
- type Image
- type Meta
- type Post
- func (p Post) HasNext() bool
- func (p Post) HasPrevious() bool
- func (p Post) ImagePathForSize(size int) string
- func (p Post) ImagePathLarge() string
- func (p Post) ImagePathMedium() string
- func (p Post) ImagePathOriginal() string
- func (p Post) ImagePathSmall() string
- func (p Post) IndexPath() string
- func (p Post) IsImage() bool
- func (p Post) IsText() bool
- func (p Post) IsZero() bool
- func (p Post) Labels() map[string]string
- func (p Post) PostType() string
- func (p Post) TableRow() PostTableRow
- func (p Post) TitleOrDefault() string
- type PostSorter
- type PostTableRow
- type Posts
- type RenderContext
- type Stats
- type Tag
- type TagTableRow
- type Tags
- type Text
- type ViewModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { Title string `json:"title,omitempty" yaml:"title,omitempty"` Author string `json:"author,omitempty" yaml:"author,omitempty"` BaseURL string `json:"baseURl,omitempty" yaml:"baseURL,omitempty"` Posts []*Post `json:"posts,omitempty" yaml:"posts,omitempty"` Tags []Tag `json:"tags,omitempty" yaml:"tags,omitempty"` }
Data is the site's entire database of posts.
func (Data) EarliestPost ¶
EarliestPost returns the earliest post.
func (Data) LatestPost ¶
LatestPost returns the latest post.
func (Data) NumImagePosts ¶
NumImagePosts returns the number of image posts.
func (Data) NumTextPosts ¶
NumTextPosts returns the number of text posts.
type Exif ¶
type Exif struct { CaptureDate time.Time `json:"captureDate" yaml:"captureDate"` CameraMake string `json:"cameraMake" yaml:"cameraMake"` CameraModel string `json:"cameraModel" yaml:"cameraModel"` LensModel string `json:"lensModel" yaml:"lensModel"` FNumber string `json:"fNumber" yaml:"fNumber"` ExposureTime string `json:"exposureTime" yaml:"exposureTime"` FocalLength string `json:"focalLength" yaml:"focalLength"` ISOSpeedRatings string `json:"isoSpeedRatings" yaml:"isoSpeedRatings"` }
Exif are known values for a subset of the full image exif data.
type Image ¶
type Image struct { SourcePath string `json:"sourcePath" yaml:"sourcePath"` Width int `json:"width" yaml:"width"` Height int `json:"height" yaml:"height"` Exif Exif `json:"exif" yaml:"exif"` Sizes map[string]string `json:"sizes,omitempty" yaml:"sizes,omitempty"` }
Image represents a posted image.
func (Image) LongDimension ¶
LongDimension returns the longest dimension of the image.
type Meta ¶
type Meta struct { Captured time.Time `json:"captured,omitempty" yaml:"captured,omitempty"` Posted time.Time `json:"posted" yaml:"posted"` Title string `json:"title" yaml:"title"` Location string `json:"location,omitempty" yaml:"location,omitempty"` Comments string `json:"comments,omitempty" yaml:"comments,omitempty"` Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` Extra map[string]string `json:"extra,omitempty" yaml:"extra,omitempty"` }
Meta is extra data for a post.
type Post ¶
type Post struct { OriginalPath string `json:"originalPath,omitempty" yaml:"originalPath,omitempty"` OutputPath string `json:"outputPath,omitempty" yaml:"outputPath,omitempty"` Slug string `json:"slug,omitempty" yaml:"slug,omitempty"` Index int `json:"index" yaml:"index"` ModTime time.Time `json:"modTime" yaml:"modTime"` Meta Meta `json:"meta" yaml:"meta"` Text Text `json:"text,omitempty" yaml:"text,omitempty"` Image Image `json:"image,omitempty" yaml:"image,omitempty"` Template *template.Template `json:"-" yaml:"-"` Previous *Post `json:"-" yaml:"-"` Next *Post `json:"-" yaml:"-"` }
Post is a single post item.
func (Post) HasPrevious ¶
HasPrevious returns if there is a previous post.
func (Post) ImagePathForSize ¶
ImagePathForSize returns the image source for a given image size in pixels.
func (Post) ImagePathLarge ¶
ImagePathLarge returns the fully qualified image source path.
func (Post) ImagePathMedium ¶
ImagePathMedium returns the fully qualified image source path.
func (Post) ImagePathOriginal ¶
ImagePathOriginal returns the fully qualified image source path.
func (Post) ImagePathSmall ¶
ImagePathSmall returns the fully qualified image source path.
func (Post) IndexPath ¶
IndexPath is a helper that returns the fully qualified path for the post's index.html. It is in the form /Year/Month/Day/Slug/index.html
func (Post) TableRow ¶
func (p Post) TableRow() PostTableRow
TableRow returns a post as an ansi table row.
func (Post) TitleOrDefault ¶
TitleOrDefault returns the title for the post.
type PostSorter ¶
PostSorter sorts a set of posts by a given sort key.
type PostTableRow ¶
type PostTableRow struct { Title string Location string Posted time.Time Tags string Slug string PostType string }
PostTableRow is a row for table output.
type Posts ¶
type Posts []*Post
Posts is a list of posts.
func (Posts) FilterBySelector ¶
FilterBySelector filters the posts by a selector.
func (Posts) First ¶
First returns the first post in the list. It returns an empty post if the list is empty.
func (Posts) Sort ¶
func (p Posts) Sort(key string, ascending bool) *PostSorter
Sort returns a sorter.
func (Posts) TableRows ¶
func (p Posts) TableRows() []PostTableRow
TableRows returns table rows for the given slice of posts.
type RenderContext ¶
type RenderContext struct { Data *Data `json:"data"` Partials []string `json:"partials"` Stats Stats `json:"stats"` }
RenderContext is the full context for a particular render.
type Stats ¶
type Stats struct { NumPosts int NumTags int NumImagePosts int NumTextPosts int Earliest time.Time Latest time.Time }
Stats are stats about the blog.
type Tag ¶
Tag are posts associated with tags.
func (Tag) TableRow ¶
func (t Tag) TableRow() TagTableRow
TableRow returns the ansi table row form of the tag.
type TagTableRow ¶
TagTableRow is a ansi table row for tags.
type Tags ¶
type Tags []Tag
Tags orders tag posts by tag.
func (Tags) TableRows ¶
func (o Tags) TableRows() []TagTableRow
TableRows returns the table rows for the given slice of tags.
type Text ¶
type Text struct { SourcePath string `json:"sourcePath" yaml:"sourcePath"` Template string `json:"template,omitempty" yaml:"template,omitempty"` Output string `json:"output,omitempty" yaml:"output,omitempty"` }
Text is a text post.