Skip to content

Releases: jucardi/infuse

v1.0.12

15 Feb 08:17
Compare
Choose a tag to compare

v1.0.12

New Helpers:

  • includeAsString: Similar to include, allows to register a template, but reads the template contents from a string instead of a file. E.g: {{ includeAsString “templateName” .var_with_contents }}
  • invoke: Similar to {{ template [name] [data] }}, invokes a template by a given name with a data object. The difference with template is that 'invoke can be used with a string variable as the name instead of a hardcoded string.
  • parse: Attempts to parse the provided template contents using the provided data object and returns the parsed value. Usage {{ parse [obj] [template contents] }}.
  • parseXpath: Attempts to parse a value inside a data object as a template and returns the parsed value using the same entry object to parse the template. Usage {{ parse [obj] [xpath to value with template] }}
  • in: Indicates whether a value is contained in an array. Usage: {{ in [array] [value] }}

Minor Fixes:

  • The helper yaml now properly allows an optional argument to indicate the indentation of the resulting YAML. Usage {{ yaml [obj] [int] }} where the int number indicates the amount of spaces for indentation.
  • Map functions now allow XPATH to be provided with or without a . as a prefix

v1.0.11

15 Nov 04:17
Compare
Choose a tag to compare
  • Minor fix to the 'set' helper so it allows map[interface{}]interface{} as well as map[string]interface{}.
  • Added support for arm64 targets for all supported OS (Windows, MacOS, Linux)
  • Added stringsSub helper to obtain the substring of a string
  • Added new map helpers to allow XPATH notation to be used to get or set values

v1.0.10

30 Jun 00:01
Compare
Choose a tag to compare

v1.0.10

Added new helpers:

  • stringsCompare - Returns an integer comparing two strings lexicographically. See strings.Compare
  • stringsContains - Returns a boolean indicating whether the string s begins with prefix. See strings.Contains

v1.0.9

22 Jun 02:47
Compare
Choose a tag to compare
  • Fixed an issue where 'include' would not work with absolute paths

v1.0.8

21 Apr 15:06
Compare
Choose a tag to compare

New features:

  • Implemented support for directory templates. Now a directory can be specified as the source, and another directory as the destination. All files within the source directory will be treated as template files and will be parsed with the source data using the same filenames as the target. This is done recursively, so subdirectories can also be used. See https://github.com/jucardi/ms-sample for an example on directory templates.

Compatibility Updates

  • Initialized Go Modules
  • Added vendor directory for dependencies

New String conversion handlers

16 Oct 23:36
Compare
Choose a tag to compare
  • Introduced new handlers for String conversion:

    • stringxCamelToDash > Converts a camelCase string to a dash-separated string
    • stringxCamelToSnake > Converts a camelCase string to a snake_case string
    • stringxDashToCamel > Converts a dash-separated string to a camelCase string
    • stringxDashToPascal > Converts a dash-separated string to a PascalCase string
    • stringxPascalToDash > Converts a PascalCase string to a dash-separated string
    • stringxPascalToSnake > Converts a PascalCase string to a snake_case string
    • stringxSnakeToCamel > Converts a SnakeToCamel string to a camelCase string
    • stringxSnakeToPascal > Converts a SnakeToCamel string to a PascalCase string
  • Changed the behavior of title, it now properly converts a provided string to a title case, capitalizing the first letter of every word in a text, and ensuring the rest of the characters in the word are lowercase

  • Added short alias lower for lowercase

  • Added short alias upper for uppercase

stringsJoin now allows any type of array

29 May 23:49
Compare
Choose a tag to compare

Replaced the stringsJoin handler to be a custom function that will allow an array instead of only []string, and will attempt to convert all members to string, so the resulting string array will be passed to strings.Join

New helpers added

04 Feb 23:38
Compare
Choose a tag to compare
  • indent: Indents a given string using the provided indentation. Eg: {{ indent "somestring with line breaks" " " }}
  • loadJson: Unmarshals a JSON string into a map[string]interface{}. Eg: {{ $obj := loadJson "{\"someKey\": 1234}" }}
  • mathAdd: Adds all the provided numbers together and returns the result
  • mathMult: Multiplies all the provided numbers together and returns the result

Added `iterate` helper

14 Nov 20:02
Compare
Choose a tag to compare

Added iterate helper for Go Templates since there is no for loop.

Usage:

{{ range $val := iterate N }}

Where N is the length of the iteration

Added 'append' helper

27 Jun 01:16
Compare
Choose a tag to compare
  • Added 'append' helper to easily append values to arrays within templates