carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.66k stars 136 forks source link

please preserve leading whitespace after the ytt inline-code token #823

Open dreftymac opened 1 year ago

dreftymac commented 1 year ago

Overview

Problem

Example

## -------------------------------------------------------------------
## begin_ ytt.functions

#@ def feature_request_preserve_indentation():
  #@ str_multiline = ('''
  #@  charlie_info:
  #@    charlie_one:    111
  #@    charlie_two:    222
  #@    charlie_three:  333
  #@  delta_info:
  #@    delta_one:      111
  #@    delta_two:      222
  #@    delta_three:    333
  #@  echo_info:
  #@    echo_one:       111
  #@    echo_two:       222
  #@    echo_three:     333
  #@ ''')
  #@ return(str_multiline)
#@ end

## -------------------------------------------------------------------
## begin_ yaml data output

dataroot:
  demo_string: #@ feature_request_preserve_indentation()

Results

Non desired result -- BEFORE

dataroot:
  demo_string: |2

    charlie_info:
    charlie_one:    111
    charlie_two:    222
    charlie_three:  333
    delta_info:
    delta_one:      111
    delta_two:      222
    delta_three:    333
    echo_info:
    echo_one:       111
    echo_two:       222
    echo_three:     333

Yes desired result -- AFTER

dataroot:
  demo_string: |
    charlie_info:
      charlie_one:    111
      charlie_two:    222
      charlie_three:  333
    delta_info:
      delta_one:      111
      delta_two:      222
      delta_three:    333
    echo_info:
      echo_one:       111
      echo_two:       222
      echo_three:     333

Feature request

Rationale


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

github-actions[bot] commented 1 year ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.

vmunishwar commented 1 year ago

Sorry for the late reply. Thanks for adding this issue. We are able to reproduce this issue. We will analyze this further and get back to you soon. Thanks for reaching out!