zrenderer_commons

package
v0.3.31 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScriptExtensions []string = []string{".js", ".css"}

ScriptExtensions scripts deployed into output

View Source
var TemplatesExtensions []string = []string{".html", ".json", ".txt", ".md"}

TemplatesExtensions files

Functions

func GetContent

func GetContent(value string) (response string, err error)

func IncPrefix

func IncPrefix(prefix string) string

func InferFilename

func InferFilename(value string) (response string)

func IsScript

func IsScript(file string) bool

func IsTemplate

func IsTemplate(file string) bool

Types

type RenderHandler

type RenderHandler func(prefix string, content []byte, data *gg_.ModelDataWrapper) (interrupt bool, err error)

RenderHandler can change data of generate custom documents

type RendererOptions

type RendererOptions struct {
	DirSrc         string   `json:"dir-src"`       // sources to auto-deploy
	DirOutput      string   `json:"dir-output"`    // output or build
	DirTemplates   string   `json:"dir-templates"` // templates for rendering, output for templates
	AutoDeploy     bool     `json:"auto-deploy"`
	Minify         bool     `json:"minify"`
	RenderOnly     []string `json:"render-only"` // empty = all, array of names
	Prefix         string   `json:"prefix"`
	Index          string   `json:"index"` // name of template for index page. empty=no index
	IndexOverwrite bool     `json:"index-overwrite"`
}

func NewRendererOptions

func NewRendererOptions(args ...interface{}) (instance *RendererOptions, err error)

func (*RendererOptions) Map

func (instance *RendererOptions) Map() map[string]interface{}

func (*RendererOptions) String

func (instance *RendererOptions) String() string

type RendererOutputFile

type RendererOutputFile struct {
	Name     string                 `json:"name"`
	Path     string                 `json:"path"`
	Relative string                 `json:"relative"`
	DateTime time.Time              `json:"date-time"`
	Data     map[string]interface{} `json:"data"`
}

func SortFilesAsc

func SortFilesAsc(files []*RendererOutputFile) (response []*RendererOutputFile)

func SortFilesDesc

func SortFilesDesc(files []*RendererOutputFile) (response []*RendererOutputFile)

func (*RendererOutputFile) Refresh

func (instance *RendererOutputFile) Refresh()

type RendererResourceFile

type RendererResourceFile struct {
	Path       string `json:"path"` // original path. relative if file has been loaded from dir
	Name       string `json:"name"` // file.ext
	DirSource  string `json:"root"` // /dir1/
	IsTemplate bool   `json:"is-template"`
	IsScript   bool   `json:"is-script"`
	Content    []byte `json:"content"`
	Minify     bool   `json:"minify"`
}

func NewResource

func NewResource(name string, filenameOrContent interface{}) (instance *RendererResourceFile, err error)

func NewResourceFileFromBytes

func NewResourceFileFromBytes(name string, content []byte) (instance *RendererResourceFile, err error)

func NewResourceFileFromFilename

func NewResourceFileFromFilename(path string) (instance *RendererResourceFile, err error)

func NewResourceFileFromText

func NewResourceFileFromText(name string, content string) (instance *RendererResourceFile, err error)

func (*RendererResourceFile) GetContent

func (instance *RendererResourceFile) GetContent() (response []byte, err error)

func (*RendererResourceFile) GetFullPath

func (instance *RendererResourceFile) GetFullPath() (response string)

func (*RendererResourceFile) GetOutPath

func (instance *RendererResourceFile) GetOutPath(dirSrc, dirOut string) (response string)

func (*RendererResourceFile) Map

func (instance *RendererResourceFile) Map() map[string]interface{}

func (*RendererResourceFile) MatchName

func (instance *RendererResourceFile) MatchName(name string) bool

func (*RendererResourceFile) Refresh

func (instance *RendererResourceFile) Refresh(autoDetectMinify bool) *RendererResourceFile

func (*RendererResourceFile) String

func (instance *RendererResourceFile) String() string

Jump to

Keyboard shortcuts

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