blox

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArticleCue string

ArticleCue is the cue for an Article

View Source
var ArticleTemplate string

ArticleTemplate is the template for an article

View Source
var CategoryCue string

CategoryCue is the Cue for a category

View Source
var CategoryTemplate string

CategoryTemplate is the template for a Category

View Source
var Models = []Model{
	{
		ID:         "profile",
		Name:       "Profile",
		Folder:     "profiles",
		ForeignKey: "profile_id",
		Cue:        ProfileCue,
	},
	{
		ID:         "article",
		Name:       "Article",
		Folder:     "articles",
		ForeignKey: "article_id",
		Cue:        ArticleCue,
	},
	{
		ID:         "category",
		Name:       "Category",
		Folder:     "categories",
		ForeignKey: "category_id",
		Cue:        CategoryCue,
	},
	{
		ID:         "page",
		Name:       "Page",
		Folder:     "pages",
		ForeignKey: "page_id",
		Cue:        PageCue,
	},
}

Models is used by various commands to determine how to perform certain actions based on arguments and flags provided. All new types must be represented in this slice.

View Source
var PageCue string

PageCue is the cue template for a page

View Source
var PageTemplate string

PageTemplate is the page template

View Source
var ProfileCue string

ProfileCue is the cue for a profile

View Source
var ProfileTemplate string

ProfileTemplate is the template for a profile

Functions

func FromYAML

func FromYAML(path string, modelName string, cue string) (map[string]interface{}, error)

FromYAML converts converted YAML content into output-ready map

Types

type BaseModel

type BaseModel struct {
	ID      string `json:"id"`
	Body    string `json:"body"`
	BodyRaw string `json:"body_raw"`
}

BaseModel defines fields used by all drb models

type Model

type Model struct {
	ID         string
	Name       string
	Folder     string
	ForeignKey string
	Cue        string
}

Model represents a content model

func GetModel

func GetModel(id string) (Model, error)

GetModel finds a Model definition and returns it to the caller.

func (Model) DestinationContentPath

func (m Model) DestinationContentPath() string

DestinationContentPath returns the path where output YAML is stored

func (Model) DestinationFilePath

func (m Model) DestinationFilePath(slug string) string

DestinationFilePath returns the path where a converted model will be stored as YAML.

func (Model) New

func (m Model) New(slug string, destination string) error

New creates a new content model

func (Model) SourceContentPath

func (m Model) SourceContentPath() string

SourceContentPath returns the path where content source files (markdown/yaml) are stored

func (Model) SourceFilePath

func (m Model) SourceFilePath(slug string) string

SourceFilePath returns the path where a specific content file should be stored, based on its slug

func (Model) StaticContentPath

func (m Model) StaticContentPath() string

StaticContentPath returns the path where images and other static content path will be stored

func (Model) TemplateFilePath

func (m Model) TemplateFilePath(slug string) string

TemplateFilePath returns the path for a template file

func (Model) TemplatePath

func (m Model) TemplatePath() string

TemplatePath returns the path where templates are stored

Jump to

Keyboard shortcuts

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