Bring back support for Starlark multi-line strings
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
## Acceptance Criteria
White space stored in starlark multi-line strings should be preserved.
**Given** a template calling function that returns a multi-line starlark string:
```
#@ def f():
#@ return """ asd1
#@ asd2
#@ asd3
#@ """
#@ end
string: #@ f()
```
when executing `ytt -f .`
**Undesired Result:**
```
string: |
asd1
asd2
asd3
```
**Desired Result:**
```
string: |
asd1
asd2
asd3
```
_Below is the original issue_
---
**What steps did you take? What happened?**
Attempted to use multi-line strings, but they lost their indentation (inexplicably).
```
#@ def f():
#@ return """asd1
#@ asd2
#@ asd3
#@ asd4
#@ """
#@ end
lel: #@ f()
#! generates
#! lel: |2
#! asd1
#! asd2
#! asd3
#! asd4
```
see: https://kubernetes.slack.com/archives/CH8KCCKA5/p1616177776070200
**What did you expect:**
Either:
- the indentation to be preserved. (this is preferred)
- this limitation be clearly documented (at the very least)
```
#@ def f():
#@ return """asd1
#@ asd2
#@ asd3
#@ asd4
#@ """
#@ end
lel: #@ f()
#! to generate
#! lel: |2
#! asd1
#! asd2
#! asd3
#! asd4
```
**Anything else you would like to add:**
Indentation within a multi-line string feature was a conscious trade-off in story #120
Contributor guide
Research direction
No source file or test is named. Start by reproducing the provided Starlark multi-line string example with the ytt CLI and trace where its whitespace is lost; done means the generated YAML preserves the original indentation shown in the desired result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, yaml
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100