Things I did while unable to commit
- Log rotation - Execution cancellation - HTTP redirect, error functions - Changed naming of document parsing/loading functions
This commit is contained in:
@@ -25,6 +25,9 @@ func (this *Provider) FuncMapFor (document *step.Document) template.FuncMap {
|
||||
}
|
||||
return template.FuncMap {
|
||||
"panic": stat.funcPanic,
|
||||
"cancel": stat.funcCancel,
|
||||
"create": stat.funcCreate,
|
||||
"createHTML": stat.funcCreateHTML,
|
||||
"execute": stat.funcExecute,
|
||||
"include": stat.funcInclude,
|
||||
"includeHTML": stat.funcIncludeHTML,
|
||||
@@ -43,10 +46,23 @@ func (this *state) funcPanic (message any) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *state) funcCancel () (string, error) {
|
||||
return "", step.ErrExecutionCanceled
|
||||
}
|
||||
|
||||
func (this *state) funcCreate (name string, arguments ...any) (string, error) {
|
||||
return this.funcInclude(name, arguments)
|
||||
}
|
||||
|
||||
func (this *state) funcCreateHTML (name string, arguments ...any) (template.HTML, error) {
|
||||
return this.funcIncludeHTML(name, arguments)
|
||||
}
|
||||
|
||||
func (this *state) funcExecute (name string, data any) (step.ExecutionResult, error) {
|
||||
name, err := this.document.Rel(name)
|
||||
if err != nil { return step.ExecutionResult { }, err }
|
||||
document, err := this.document.Environment().Parse(name)
|
||||
document, err := this.document.Environment().LoadRelative (
|
||||
name, this.document)
|
||||
if err != nil { return step.ExecutionResult { }, err }
|
||||
builder := strings.Builder { }
|
||||
err = document.Execute(&builder, step.ExecutionData { Data: data })
|
||||
|
||||
Reference in New Issue
Block a user