Awee

Quick Guide

An overview of the functionality and all of the modifiers

Templating engine built for workflows, document generation, and data transformations.

{{ response | from:'json' | key:'orders' | filter:'status','paid' | pluck:'total' | sum | decimal:2 }}

Features

  • Pipe syntax — chain 51 built-in modifiers to transform any value in a single expression
  • Dependency resolution — variables can reference each other; sintax resolves them in the correct order automatically
  • Cycle detection — circular variable references are caught at resolution time, not at runtime
  • Nested data — maps, slices, structs, and pointers are all resolved and rendered recursively
  • Conditionals{{ if x }} … {{ else }} … {{ endif }} blocks
  • Loops{{ for v in items }} … {{ endfor }} over slices and maps, with auto-bound index/key helpers
  • Typed errors — parse failures, missing variables, and circular dependencies are surfaced as distinct, branchable error categories
  • Extensible — register your own modifiers alongside the built-ins

Template syntax

PatternExample
Variable{{ name }}
Modifier chain{{ text | trim | upper }}
Modifier with args{{ items | join:',' }}
Variable as argument{{ text | trim-prefix:prefix_var }}
Fallback to literal{{ value | default:'n/a' }}
Fallback to empty array{{ items | default:[] }}
Fallback to empty object{{ user | default:{} }}
If / else{{ if active }}yes{{ else }}no{{ endif }}
Loop over a slice{{ for x in items }}- {{ x }}\n{{ endfor }}
Loop with index{{ for i, x in items }}{{ i }}:{{ x }} {{ endfor }}
Loop over a map{{ for k, v in headers }}{{ k }}={{ v }} {{ endfor }}

Modifier syntax: the name and the first argument are separated by :, additional arguments by ,. String literals use single or double quotes; unquoted tokens resolve as variables, numbers, or booleans.

Block tags use endif and endfor to close.

Whitespace control

A leading or trailing - inside a tag eats whitespace on that side, the same way Jinja and Go templates do:

PatternEffect
{{- expr }}strip trailing whitespace (including newlines) from the text before this tag
{{ expr -}}strip leading whitespace (including newlines) from the text after this tag
{{- expr -}}both at once

Block control tags (if/else/endif/for/endfor) that sit alone on their own line are auto-trimmed — the surrounding indentation and the line's newline are removed automatically, so you don't have to write - on every block tag just to keep your output clean. Use the explicit {{- / -}} form when a tag shares a line with text or you want extra whitespace eaten.


Loops

{{ for v in xs }} iterates over slices, arrays, and maps. Two binding forms are supported:

{{ for v in xs }} … {{ endfor }}        # bind value
{{ for i, v in xs }} … {{ endfor }}     # bind index/key + value

Inside the loop body the following helpers are available — <v> is whatever name you bound the value to:

BindingSet on
<v>_indexboth slice and map iterations (0-based)
<v>_first, <v>_lastboth — booleans for the first/last iteration
<v>_keymap iterations only, when no explicit key name was bound

Map iteration order is sorted by key. Loops nest freely and parent variables remain visible inside the body.

{{ for item in cart }}{{ item.name }} × {{ item.qty }}{{ if item_last }}.{{ else }}, {{ endif }}{{ endfor }}

Special variables

These names resolve to runtime-generated values without being declared.

NameReturns
{{ uuid }}UUID v4 string (alias for uuidv4)
{{ uuidv1 }}UUID v1 string (time + MAC)
{{ now }}timestamp — pipe into format
{{ [] }}empty array — useful with default
{{ {} }}empty object — useful with default

Modifiers

Each modifier links to its own page with full inputs, parameters, and examples.

Text

Trim, case-shift, slugify, split, and reshape strings.

ModifierDescriptionExample
concatConcat appends one or more strings to the value.{{ greeting | concat:'!' }}
joinJoin combines an array of strings into a single string with a separator.{{ tags | join:',' }}
linesLines splits a string or byte slice into an array of lines.{{ note | lines }}
lowerToLower converts a string to lowercase.{{ email | lower }}
replaceReplace replaces all occurrences of a substring within the string value.{{ greeting | replace:'world','everyone' }}
replace_patternReplacePattern replaces all regex matches within the string value.{{ text | replace_pattern:'\s+',' ' }}
reverseReverse reverses the characters in a string.{{ name | reverse }}
sexySexy returns a bear ASCII art.{{ anything | sexy }}
shortenShorten truncates a string to the given maximum character length.{{ description | shorten:30 }}
slugSlug converts a string to a URL-friendly slug.{{ title | slug }}
splitSplit splits a string into an array using a separator.{{ csv_line | split:',' }}
titleTitle converts a hyphen-separated slug into a title-cased string.{{ slug | title }}
title_modelModelTitle formats an AI model identifier into a human-readable title.{{ model_id | title_model }}
trimTrim removes leading and trailing whitespace, or the given character set.{{ name | trim }}
trim-prefixTrimPrefix removes a leading prefix string or leading whitespace from the value.{{ path | trim-prefix:'/' }}
trim-suffixTrimSuffix removes a trailing suffix string or trailing whitespace from the value.{{ url | trim-suffix:'/' }}
upperToUpper converts a string to uppercase.{{ name | upper }}

Collections

Sort, filter, find, and reshape arrays and maps.

ModifierDescriptionExample
filterFilter returns a subset of a slice where a nested field matches a value.{{ items | filter:'status','active' }}
findFind returns the first element in a slice or map where a field equals the given value.{{ users | find:'id',42 }}
firstFirst returns the first character of a string or the first element of a slice.{{ items | first }}
flattenFlatten flattens a slice of slices by one level.{{ groups | pluck:'items' | flatten }}
hasHas returns true if the slice or map contains the given value.{{ tags | has:'featured' }}
isIs returns true if the value equals any of the given parameters.{{ status | is:'active' }}
keyKey extracts a value from a map or slice by key path or index.{{ user | key:'name' }}
lastLast returns the last character of a string or the last element of a slice.{{ items | last }}
mapMap converts a slice of maps into a map keyed by the given field's string value.{{ users | map:'id' }}
mergeMerge converts a slice of maps into a map keyed by the given field's string value.{{ users | merge:'id' }}
pluckPluck extracts a single field from each element of a slice of maps and returns a slice of values.{{ users | pluck:'id' }}
sortSort sorts a slice in ascending or descending order.{{ names | sort }}
sumSum returns the numeric sum of the elements of a slice.{{ amounts | sum }}
wrapWrap wraps the value in a map under the given key.{{ name | wrap:'user' }}

Boolean

Compare values for use inside if/else blocks and conditional expressions.

ModifierDescriptionExample
eqEq returns true if the value equals the given parameter.{{ status | eq:'active' }}
gtGt returns true if the numeric value is greater than the threshold.{{ items_in_cart | gt:0 }}
gteGte returns true if the numeric value is greater than or equal to the threshold.{{ qty | gte:1 }}
notNot inverts the truthiness of the value.{{ is_active | not }}

Convert

Move between Go values, JSON, YAML, and other serialized formats.

ModifierDescriptionExample
fromFrom parses the string value as the given format and returns the parsed result.{{ body | from:'json' }}
jsonJSON serializes the value to a JSON string.{{ user | json }}
markdownMarkdown converts an HTML string to Markdown.{{ html_content | markdown }}
yamlYAML serializes or parses a value as YAML.{{ config | yaml }}

Utilities

Defaults, lengths, line numbers, and date formatting.

ModifierDescriptionExample
decimalDecimal formats a number with a fixed number of decimal places.{{ amount | decimal:2 }}
defaultDefault returns the fallback value if the input is nil or an empty string.{{ name | default:'anonymous' }}
formatFormat formats a time.{{ created_at | format:'YYYY-MM-DD' }}
lengthLength returns the number of characters in a string, bytes in a byte slice, or elements in a slice/array/map.{{ name | length }}
line-numbersLineNumbers prepends each line of the string with its zero-based line number.{{ note | line-numbers }}

File System

Pull pieces out of file paths — directory, name, and extension.

ModifierDescriptionExample
dirnameDirname returns the directory portion of a file path.{{ file_path | dirname }}
extFilenameExt returns the file extension without the leading dot.{{ file_path | ext }}
ext-dotFilenameExtDot returns the file extension including the leading dot.{{ file_path | ext-dot }}
ext-prependFilenamePrependExt inserts an additional extension before the existing file extension.{{ file_path | ext-prepend:'min' }}
ext-trimFilenameTrimExt returns the file path without its extension.{{ file_path | ext-trim }}
filenameFilename returns the base file name from a path, including the extension.{{ file_path | filename }}

Money

Convert numbers between currency units like dollars and cents.

ModifierDescriptionExample
currencyCurrency converts a numeric value between currency units by applying a unit multiplier ratio.{{ price | currency:1,100 }}

How is this guide?

On this page