2017-06-24 11:19:21 -04:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2017-07-06 19:31:36 -04:00
|
|
|
"github.com/osteele/gojekyll/config"
|
2017-06-24 14:00:19 -04:00
|
|
|
"github.com/osteele/gojekyll/pipelines"
|
2017-06-24 11:19:21 -04:00
|
|
|
)
|
|
|
|
|
2017-07-08 19:57:41 -04:00
|
|
|
// A Document is a Jekyll post, page, or file.
|
2017-06-29 10:13:25 -04:00
|
|
|
type Document interface {
|
2017-06-24 11:19:21 -04:00
|
|
|
// Paths
|
2017-07-08 19:57:41 -04:00
|
|
|
Permalink() string // relative URL path
|
|
|
|
SourcePath() string // relative to the site source directory
|
2017-06-24 11:19:21 -04:00
|
|
|
OutputExt() string
|
|
|
|
|
|
|
|
// Output
|
|
|
|
Published() bool
|
|
|
|
Static() bool
|
2017-07-04 17:36:06 -04:00
|
|
|
Write(io.Writer, RenderingContext) error
|
2017-06-24 11:19:21 -04:00
|
|
|
|
2017-07-03 09:37:14 -04:00
|
|
|
Categories() []string
|
|
|
|
Tags() []string
|
2017-06-24 11:19:21 -04:00
|
|
|
}
|
|
|
|
|
2017-06-29 10:13:25 -04:00
|
|
|
// RenderingContext provides context information for rendering.
|
2017-06-24 11:19:21 -04:00
|
|
|
type RenderingContext interface {
|
2017-06-24 14:00:19 -04:00
|
|
|
RenderingPipeline() pipelines.PipelineInterface
|
2017-07-03 10:39:55 -04:00
|
|
|
// Site is the value of the "site" template variable.
|
|
|
|
Site() interface{} // used as a drop in the rendering context
|
2017-06-24 11:58:12 -04:00
|
|
|
}
|
|
|
|
|
2017-06-29 10:13:25 -04:00
|
|
|
// Container is the document container.
|
|
|
|
// It's either the Site or Collection that immediately contains the document.
|
2017-06-24 11:19:21 -04:00
|
|
|
type Container interface {
|
2017-07-06 19:31:36 -04:00
|
|
|
Config() *config.Config
|
2017-06-24 11:58:12 -04:00
|
|
|
OutputExt(pathname string) string
|
2017-06-24 11:19:21 -04:00
|
|
|
PathPrefix() string // PathPrefix is the relative prefix, "" for the site and "_coll/" for a collection
|
|
|
|
}
|