Skip to content

fix: add template variable syntax guidance - #14

Merged
chris-regnier merged 1 commit into
mainfrom
fix/template-variable-syntax
Feb 16, 2026
Merged

fix: add template variable syntax guidance#14
chris-regnier merged 1 commit into
mainfrom
fix/template-variable-syntax

Conversation

@chris-regnier

Copy link
Copy Markdown
Owner

Summary

  • Adds help text to diaryctl template create documenting that template variables use Go {{.varname}} syntax and must start with a letter
  • Fixes the "three-things" template to use {{.first}}/{{.second}}/{{.third}} instead of invalid {.0}/{.1}/{.2} syntax (done via CLI, not in code)

Context

The template.Render() function uses Go's text/template, which requires double-brace {{.varname}} syntax. Additionally, numeric keys like .0 are interpreted as integer literals by Go templates, not map key lookups — so {{.0}} silently outputs 0 instead of the variable value.

Test plan

  • go test ./internal/template/... — no regressions
  • go test ./cmd/... — no regressions
  • MCP create_entry with template_names: ["three-things"] and template_variables: {"first": "a", "second": "b", "third": "c"} — variables substituted correctly

🤖 Generated with Claude Code

Template variables require Go text/template double-brace syntax
({{.varname}}) and alphabetic names. Without this guidance, users
create templates with invalid syntax like {.0} that passes through
as literal text instead of being substituted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chris-regnier
chris-regnier force-pushed the fix/template-variable-syntax branch from 552f523 to d4a5d49 Compare February 16, 2026 17:33
@chris-regnier
chris-regnier merged commit 17ae5fd into main Feb 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant