Categories

Text Template Engine

Fill text templates with variables and data using various template formats

Key Facts

Category
Text Processing
Input Types
textarea, select, checkbox
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The Text Template Engine is a versatile utility designed to automate document generation by injecting dynamic data into predefined text structures using popular syntax formats like Mustache, Handlebars, and ES6.

When to Use

  • Generating personalized emails or reports from structured JSON datasets.
  • Standardizing repetitive text output across multiple documents or configurations.
  • Converting raw data into formatted strings with specific numeric or date requirements.

How It Works

  • Paste your base text containing variables into the template field.
  • Provide your data in JSON format, ensuring keys match the variables in your template.
  • Select your preferred template syntax and formatting rules for dates and numbers.
  • Generate the final text output instantly with all variables replaced by your data.

Use Cases

Bulk generation of personalized customer notification emails.
Creating standardized configuration files or code snippets from a central data source.
Formatting complex financial or analytical reports for consistent presentation.

Examples

1. Personalized Email Generation

Marketing Specialist
Background
Need to send personalized welcome emails to a list of new subscribers.
Problem
Manually typing individual emails is inefficient and prone to errors.
How to Use
Input the email draft with {{name}} variables and provide the subscriber JSON data.
Example Config
Template: 'Hello {{name}}, welcome to our service!' | Format: Mustache
Outcome
A fully populated email ready for distribution with the name field correctly injected.

2. Financial Report Formatting

Data Analyst
Background
Preparing a summary report for stakeholders based on raw transaction data.
Problem
Raw numbers lack the necessary currency formatting for professional presentation.
How to Use
Use the template engine to map transaction values and apply the 'Currency' number format.
Example Config
Template: 'Total Revenue: [revenue]' | Number Format: Currency
Outcome
The output displays the revenue value formatted as $1,234.56 instead of a raw float.

Try with Samples

json, html, text

Related Hubs

FAQ

Which template formats are supported?

The tool supports Mustache, Handlebars, ES6 template literals, custom delimiters, and simple bracket-based syntax.

How does the tool handle missing variables?

You can choose to replace missing variables with an empty string, keep the original syntax, display them in brackets, or replace them with the word 'null'.

Can I format numbers and dates within the template?

Yes, the tool includes dedicated dropdowns to apply specific date formats like ISO or YYYY-MM-DD and number formats like currency, percentage, or decimal.

Is it possible to escape HTML in the output?

Yes, you can enable the 'Escape HTML Output' checkbox to ensure special characters are safely encoded for web display.

What input format is required for the data?

The tool requires a valid JSON object where keys correspond to the variable names used in your template text.

API Documentation

Request Endpoint

POST /en/api/tools/text-template

Request Parameters

Parameter Name Type Required Description
templateText textarea Yes -
variablesData textarea Yes -
templateFormat select Yes -
missingVariableAction select Yes -
dateFormat select Yes -
numberFormat select Yes -
escapeOutput checkbox No -

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-text-template": {
      "name": "text-template",
      "description": "Fill text templates with variables and data using various template formats",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=text-template",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]