will generate¶
Generate a Word document from a YAML or JSON specification file.
Synopsis¶
Description¶
The generate command creates a Word document based on a YAML or JSON specification file. This is the most powerful way to create complex documents with full control over structure and content.
Arguments¶
| Argument | Description |
|---|---|
SPEC_FILE |
Path to YAML (.yaml, .yml) or JSON (.json) specification file |
Options¶
| Option | Short | Required | Description |
|---|---|---|---|
--output |
-o |
Yes | Output file path (.docx) |
--template |
-t |
No | Template file (.docx) to use as base |
--var |
-V |
No | Variable substitution (KEY=VALUE), can be repeated |
Examples¶
Basic Generation¶
With Template¶
With Variables¶
will generate invoice-template.yaml -o invoice.docx \
-V CLIENT="Acme Corp" \
-V INVOICE_NUM="INV-001" \
-V DATE="2024-01-15" \
-V AMOUNT="$1,500.00"
JSON Specification¶
Specification Format¶
YAML Example¶
title: Quarterly Report
subtitle: Q4 2024
author: Analytics Team
page_size: letter
margins: moderate
table_of_contents: true
sections:
- type: section
title: Executive Summary
- type: content
text: |
This report summarizes key findings.
- type: content
bullets:
- Revenue up 25%
- Customer growth 50%
- type: table
headers: [Metric, Value]
data:
- [Revenue, "$1.5M"]
- [Users, "15K"]
JSON Example¶
{
"title": "Report",
"sections": [
{"type": "heading", "title": "Introduction", "level": 1},
{"type": "content", "text": "Hello, World!"}
]
}
Variables (Placeholders)¶
Use {{PLACEHOLDER}} syntax in your spec:
Replace at generation time:
Output¶
On success, displays: - Confirmation message - Document statistics
See Also¶
- YAML Format Reference - Complete specification format
- will create - Simple document creation
- will replace - Replace placeholders