You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -448,11 +448,18 @@ As the conditional for `if` steps is always a template expression, _do not_ encl
448
448
449
449
## Special placeholders
450
450
451
-
Because the PROJECT variable is typically used pervasively throughout templates in the form of `{{.PROJECT}}` and `{{.PROJECT | upper}}`, we have introduced the special placeholders `projekt` and `PROJEKT`, which can be used anywhere in file/dir names and templates without any adornments.
451
+
Placeholders are a lightweight alternative to go template expressions, which can be used as plain text anywhere in file/dir names and template files. Because placeholders are processed using plain search-and-replace, ensure they have improbable names that don't risk conflicting with anything else (ie: "projekt").
452
452
453
-
For example, the text "MY PROJEKT FILE.TXT" is equivalent to "MY {{.PROJECT | upper}} FILE.TXT".
453
+
For example, you can define the following placeholders in your template spec:
454
454
455
-
Currently, those two placeholders are hardcoded and are the only ones supported, but we plan to add support for defining your own in the template spec.
455
+
```yaml
456
+
placeholders:
457
+
projekt: "{{ .PROJECT | lower }}"
458
+
Projekt: "{{ .PROJECT | title }}"
459
+
PROJEKT: "{{ .PROJECT | upper }}"
460
+
```
461
+
462
+
You can then use these placeholders anywhere without any adornments. For example, the text "MY PROJEKT FILE.TXT" is equivalent to "MY {{.PROJECT | upper}} FILE.TXT".
456
463
457
464
This feature was inspired by the way we were previously creating new projects by duplicating an existing project and doing a search-and-replace for the project name in different case variants. That strategy was very simple and effective, as long as the project name was a very distinct string that did not appear in any other undesired contexts, hence our choice of `projekt` as something that you are (hopefully!) very
458
465
unlikely to encounter in your project for any other reason than those placeholders!
@@ -486,10 +493,3 @@ To associate a template with an existing project that was not initially generate
486
493
- Add more example templates, for go, node...
487
494
- Fix `choice` step to pre-select current value, if any.
488
495
- Allow special `.tmpl` and `.notmpl` extensions to be placed before actual extension (ie: `file.tmpl.txt`), to allow file editor to recognize them better during template editing.
0 commit comments