README

Jet template engine functions

Build Status Coverage Status Go.Dev reference Go Report Card Release Downloads

This library inspired by Masterminds/sprig).

$ go get -u clevergo.tech/jetsprig

Usage

import (
    "clevergo.tech/jetsprig"
    "github.com/CloudyKit/jet/v5"
)

set := jet.NewHTMLSet("")
// attaches functions to Set.
jetsprig.GenericFuncMap().AttachTo(set)

Functions

String
trim strings.TrimSpace
trimPrefix strings.TrimPrefix
trimSuffix strings.TrimSuffix
join strings.Join
Date
now time.Now
date time.Time.Format

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ago

func Ago(args jet.Arguments) reflect.Value

    Ago returns duration from time.Now in seconds resolution.

    func Date

    func Date(args jet.Arguments) reflect.Value

      Date formats a date with the given layout.

      func DateInZone

      func DateInZone(args jet.Arguments) reflect.Value

        DateInZone returns the copy of same time instant with the given time zone.

        func Join

        func Join(args jet.Arguments) reflect.Value

          Join concatenates the elements of its first argument to create a single string.

          func Now

            Now returns the current local time.

            func Title

            func Title(args jet.Arguments) reflect.Value

              Title converts a string to title case.

              func Trim

              func Trim(args jet.Arguments) reflect.Value

                Trim removes space from either side of a string.

                func TrimPrefix

                func TrimPrefix(args jet.Arguments) reflect.Value

                  TrimPrefix removes the prefix of a string.

                  func TrimSuffix

                  func TrimSuffix(args jet.Arguments) reflect.Value

                    TrimSuffix removes the suffix of a string.

                    Types

                    type FuncMap

                    type FuncMap map[string]jet.Func

                      FuncMap is a set of functions.

                      func GenericFuncMap

                      func GenericFuncMap() FuncMap

                        GenericFuncMap returns generic functions.

                        func (FuncMap) AttachTo

                        func (fm FuncMap) AttachTo(set *jet.Set)

                          AttachTo attaches function to Set.