Documentation ¶
Index ¶
- Variables
- func Camelize(term string, firstLetter string) string
- func Concat[T any](S1 []T, S2 []T) (ret []T)
- func Diff(S1, S2 []string) []string
- func FirstSentence(text string) string
- func Format2Regex(format string) string
- func Plural(source string) string
- func Reject[T any](S []T, test func(T) bool) (ret []T)
- func Select[T any](S []T, test func(T) bool) (ret []T)
- func SpaceSeparated(source string) string
- func SpaceSeparatedTitle(source string) string
- func TrimTemplate(templatePath string, e any) string
- func Underscore(source string) string
- type YamlValidator
Constants ¶
This section is empty.
Variables ¶
var TemplateFunctions = template.FuncMap{ "title": SpaceSeparatedTitle, "replace": strings.Replace, "replaceAll": strings.ReplaceAll, "camelize": Camelize, "underscore": Underscore, "plural": Plural, "contains": strings.Contains, "join": strings.Join, "lower": strings.ToLower, "upper": strings.ToUpper, "hasSuffix": strings.HasSuffix, "dict": wrapMultipleParams, "format2regex": Format2Regex, "hasPrefix": strings.HasPrefix, "sub": subtract, "plus": plus, "firstSentence": FirstSentence, "trimTemplate": TrimTemplate, }
Functions ¶
func FirstSentence ¶
Returns all the characters up until the period (.) or returns text unchanged if there is no period.
func Format2Regex ¶
Transforms a format string with field markers to a regex string with capture groups. For instance,
projects/{{project}}/global/networks/{{name}}
is transformed to
projects/(?P<project>[^/]+)/global/networks/(?P<name>[^/]+)
Values marked with % are URL-encoded, and will match any number of /'s. Note: ?P indicates a Python-compatible named capture group. Named groups aren't common in JS-based regex flavours, but are in Perl-based ones
func Reject ¶
Returns a new slice containing all of the elements for which the test function returns false in the original slice
func Select ¶
Returns a new slice containing all of the elements for which the test function returns true in the original slice
func SpaceSeparated ¶
Converts from PascalCase to Space Separated For example, converts "AccessApproval" to "Access approval"
func SpaceSeparatedTitle ¶
Converts a string to space-separated capitalized words
func TrimTemplate ¶
Temporary function to simulate how Ruby MMv1's lines() function works for nested documentation. Can replace with normal "template" after switchover
func Underscore ¶
// Helper class to process and mutate strings. class StringUtils Converts string from camel case to underscore
Types ¶
type YamlValidator ¶
type YamlValidator struct{}
A helper class to validate contents coming from YAML files.
func (*YamlValidator) Parse ¶
func (v *YamlValidator) Parse(content []byte, obj interface{}, yamlPath string)