Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strings: Add nindent function #50

Merged
merged 1 commit into from
Sep 5, 2017

Conversation

binoculars
Copy link
Contributor

Convenience function for working with YAML files, among other things.

Problem

{{ $foo := "bar\nbaz" }}
key: |-
  {{- indent 2 $foo }}

will produce:

key: |-  bar
  baz

We could unindent, and not use white space trimming ({{ vs {{-), but this breaks visual consistency. Another solution may be to pipe to an additional print, but this is inconvenient.

Solution

{{ $foo := "bar\nbaz" }}
key: |-
  {{- nindent 2 $foo }}

will produce:

key: |-
  bar
  baz

@binoculars binoculars changed the title Add nindent function strings: Add nindent function Aug 5, 2017
@technosophos technosophos merged commit a075d46 into Masterminds:master Sep 5, 2017
@binoculars binoculars deleted the feature/newline-indent branch September 5, 2017 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants