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

Availability of block remarks/comment's #330

Open
nielsnl68 opened this issue Apr 16, 2024 · 0 comments
Open

Availability of block remarks/comment's #330

nielsnl68 opened this issue Apr 16, 2024 · 0 comments

Comments

@nielsnl68
Copy link

Hello,
i could not find an earlier post about this, i'm sure this must have been talked about many times before.

I use YAML to program code for (esphome)[www.esphome.io] for some time now. And YAML is good way to be used in this context.
But sometime I would love to block out data without removing the whole "code" block. i know you could add a # for every line but when you need a lot of line it is not that nice. Having a way to easily blockout some parts would be preferable to me.

Now i was wondering of it could be possible to think of a way to make this happen.

Option 1 could be the introducing of for example "##" that everything blocks until the second "##". The "##" should be place on a new line without any text after it. This will mean that YAML scripts are not backward compatible anymore.

like:

american:
- Boston Red Sox
- Detroit Tigers
- New York Yankees
##
# de below 4 lines are commented out
national:
- New York Mets
- Chicago Cubs
- Atlanta Braves
##

Option 2 could be that a "#" before a key, without a space between, and ended with the : will comment out all Sequence and/or mappings below it below the key. For commenting out a sequenced mapping you add the "#" direct before the "-" like #- key: value.

Like:

NormalKey: Valuepair
national:
- New York Mets
- Chicago Cubs
- Atlanta Braves
#avg: 0.278 # Batting average   # this comment out only this line.

# american:    # this will only comment out this line
- Boston Red Sox
- Detroit Tigers
- New York Yankees
 
# The following "#" comment out the whole stack block
#Stack:
- file: TopClass.py
  line: 23
  code: |
    x = MoreObject("345\n")
- file: MoreClass.py
  line: 58
  code: |-
    foo = bar

product:
    - sku         : BL394D
      quantity    : 4
      description : Basketball
      price       : 450.00

# the below sequenced mapping will be commented out
    #- sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
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

No branches or pull requests

1 participant