generated from coulomb/repo-seed
feat: add custom placeholder mapping for non-standard templates
Added optional placeholderMapping to project.json for templates that
don't follow the standard ITEM_{PROPERTY} convention.
Features:
- Override default placeholder names per field
- Useful for legacy templates or migration from other tools
- Fallback to ITEM_{PROPERTY} convention when not specified
Example usage:
{
"fieldMapping": {
"id": "ID",
"title": "Title"
},
"placeholderMapping": {
"id": "TASK_ID", // Use {{TASK_ID}} instead of {{ITEM_ID}}
"title": "TASK_NAME" // Use {{TASK_NAME}} instead of {{ITEM_TITLE}}
}
}
Changes:
- generator.js: Check for cfg.placeholderMapping before using default
- Added 2 new tests for custom mapping behavior
- Updated TEMPLATE_V2_GUIDE.md with documentation and examples
All 58 tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,32 @@ The following placeholders become available:
|
||||
|
||||
**Note:** The `due` field is used for positioning and is not available as a placeholder (use `{{MONTH_LABEL}}` for date display).
|
||||
|
||||
**Custom Placeholder Mapping:**
|
||||
|
||||
If your template uses non-standard placeholder names, you can override the default convention using `placeholderMapping` in project.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"fieldMapping": {
|
||||
"id": "ID",
|
||||
"title": "Title",
|
||||
"assignee": "Assignee"
|
||||
},
|
||||
"placeholderMapping": {
|
||||
"id": "TASK_ID", // Use {{TASK_ID}} instead of {{ITEM_ID}}
|
||||
"title": "TASK_NAME", // Use {{TASK_NAME}} instead of {{ITEM_TITLE}}
|
||||
"assignee": "ASSIGNEE" // Use {{ASSIGNEE}} instead of {{ITEM_ASSIGNEE}}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is useful when:
|
||||
- Working with existing templates that use different naming conventions
|
||||
- Migrating from other timeline tools
|
||||
- Maintaining compatibility with legacy templates
|
||||
|
||||
Without `placeholderMapping`, the default `ITEM_{PROPERTY}` convention is used.
|
||||
|
||||
### Global Placeholders
|
||||
|
||||
These appear in the main template body (not in template elements):
|
||||
|
||||
Reference in New Issue
Block a user