helpers

package
v0.0.0-...-4998ed7 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package helpers contains functions that can be used in templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(v interface{}) template.SafeString

HTML converts v to a string, escapes any special characters for HTML-safe output, and returns it as a safe string.

func Has

func Has(name string, s *scope.Scope) bool

Has returns whether the scope s stores a value identified by name. The s argument is usually filled using an evaluator.ResolveArgumentFunc.

func HasPrefix

func HasPrefix(s string, w string) bool

HasPrefix is equivalent to calling strings.HasPrefix(s, w).

func HasSuffix

func HasSuffix(s string, w string) bool

HasSuffix is equivalent to calling strings.HasSuffix(s, w).

func Len

func Len(v interface{}) int

Len returns the length of v. If v is a string, slice, or array, it returns len(v). Len panics if v is neither of those types, or if v is nil.

func Safe

func Safe(v interface{}) template.SafeString

Safe converts v to a string and returns it as a safe string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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