Documentation ¶
Index ¶
- func Close()
- func Compile(path string, opts map[string]interface{}, compressOutput uint8) ([]byte, error)
- func GetOpt(arg []byte, opts *map[string]interface{}, pre bool, addVars *[]KeyVal) (interface{}, bool)
- func HasPreCompile(path string, optExt string) bool
- func NewFunc(name string, ...) error
- func PreCompile(path string, opts map[string]interface{}) error
- func SetConfig(config Config) error
- type Config
- type KeyVal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
Compile handles the final output and returns valid html/xhtml that can be passed to the user
this method will automatically call preCompile if needed, and can read the cache file while its being written for an extra performance boost
@compressOutput: 0 = none, 1 = gzip, 2 = brotli
func GetOpt ¶
func GetOpt(arg []byte, opts *map[string]interface{}, pre bool, addVars *[]KeyVal) (interface{}, bool)
GetOpt is used to handle grabing an option from the user options that were passed
this method accepts the arg as a simple text like []byte("myOption")
this method can also handle complex options like {{this|'that'}} (with optional or statements) and even {{class="myClass"}} vars
func HasPreCompile ¶
HasPreCompile returns true if a file has been pre compiled in the cache and is not expired
func NewFunc ¶
func NewFunc(name string, fn func(args *map[string][]byte, cont *[]byte, opts *map[string]interface{}, pre bool, addVars *[]KeyVal) (interface{}, error)) error
NewFunc can be used to create custom functions for the compiler
these user defined functions will only run after the default functions have been resolved
func PreCompile ¶
preCompile generates a new pre-compiled file for the cache
this compiles markdown and handles other complex methods
this function is useful if you need to update any constand vars, defined with a "$" as the first char in their key name
Types ¶
type Config ¶
type Config struct { // Root is the root directory for your html/markdown files to be compiled // // default: views Root string // Components is an optional directory that can be used to organize components // // if a component is not found within the components directory first, it will then be checked for in the root directory you chose for the compiler // // default: components // // note: this file is relative to your chosen Root for the compiler Components string // Layout is the main template that all other files will be placed inside of // // default: layout // // pass "!" to disable // // pass "*" to set to default // // note: this file is relative to your chosen Root for the compiler Layout string // Ext is the file extention for your files to be compiled // // default: .md Ext string // Public is an optional path you can use if you have a public directory with client side scripts and stylesheets // // the compiller will use this directory to auto upgrade to .min files // // note: the compiler will Not make this directory public, it will simply read from it Public string // Cache sets the amount of time before the cache will expire Cache string // ConstOpts is an optional list of constant options you would like to make default // // note: for an option to be read by the pre-compiler, all keys must start with a "$" in there name ConstOpts map[string]interface{} }
Config is used in the SetConfig method to simplify the args and make them optional