placeholder

package
v2.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package placeholder fills {{name}}, {{name|default}} and date offset {{name+N}} variable placeholders in JSON documents, escaping each value so a filled document stays valid JSON

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONStringContent

func JSONStringContent(value string) string

JSONStringContent escapes value for use inside a JSON string, so a filled value cannot break the document it lands in

Types

type Variables

type Variables map[string]string

Variables are the values that fill {{name}}, {{name+N}} and {{name|default}} placeholders

func (Variables) Fill

func (v Variables) Fill(doc string) string

Fill replaces every placeholder in doc with the variable's value escaped for a JSON string, moved by the placeholder's day offset when it has one, or its default when unset, leaving an unset placeholder without a default unchanged

func (Variables) With

func (v Variables) With(overrides Variables) Variables

With returns the variables with overrides layered on top, leaving both inputs unchanged

Jump to

Keyboard shortcuts

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