helpers.go
func (h HelperContext) BlockWith(hc hctx.Context) (string, error) {
	ctx, ok := hc.(*Context)
	if !ok {
		return "", fmt.Errorf("expected *Context, got %T", hc)
	}
	octx := h.compiler.ctx
	defer func() { h.compiler.ctx = octx }()
	h.compiler.ctx = ctx

	if h.block == nil {
		return "", errors.New("no block defined")
	}
	i, err := h.compiler.evalBlockStatement(h.block)
	if err != nil {
		return "", err
	}
	bb := &bytes.Buffer{}
	h.compiler.write(bb, i)
	return bb.String(), nil
}
func (h HelperContext) BlockWith(hc hctx.Context) (string, error) {
	ctx, ok := hc.(*Context)
	if !ok {
		return "", fmt.Errorf("expected *Context, got %T", hc)
	}
	octx := h.compiler.ctx
	defer func() { h.compiler.ctx = octx }()
	h.compiler.ctx = ctx

	if h.block == nil {
		return "", errors.New("no block defined")
	}
	i, err := h.compiler.evalBlockStatement(h.block)
	if err != nil {
		return "", err
	}
	bb := &bytes.Buffer{}
	h.compiler.write(bb, i)
	return bb.String(), nil
}
func ( h HelperContext ) BlockWith ( hc hctx . Context ) ( string , error ) { ctx , ok := hc . ( * Context ) if ! ok { return " " , fmt . Errorf ( " " , hc ) } octx := h . compiler . ctx defer func ( ) { h . compiler . ctx = octx } ( ) h . compiler . ctx = ctx if h . block == nil { return " " , errors . New ( " " ) } i , err := h . compiler . evalBlockStatement ( h . block ) if err != nil { return " " , err } bb := & bytes . Buffer { } h . compiler . write ( bb , i ) return bb . String ( ) , nil }
// BlockWith executes the block of template associated with
// the helper, think the block inside of an "if" or "each"
// statement, but with it's own context.
BlockWith executes the block of template associated with the helper think the block inside of an if or each statement but with it s own context .