-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Block Scalar indentation shenanigans #553
Comments
Your example is not at the root level. You've already started a mapping which puts the level from -1 to 0.
That scalar is present when there is no indentation yet, because no mapping or sequence is yet started. I think it was a mistake to have defined no indentation as indentation of -1. imho, non-key, scalar content should not be allowed in column 1 as lines like |
regarding
This looks like an oversight in the 1.2.1 -> 1.2.2 spec.
and https://yaml.org/spec/1.2.2/#rule-c-l+literal https://yaml.org/spec/1.2.2/#rule-l+block-sequence
As you can see, for rule 183 the indentation parameter was changed from |
that confirms my suspicion def: |
making this
invalid
---
|
and this is 0 indent
instead of -1 |
I've added a fix making the first variant properly an error, i.e. abc:
| #this should be an error
block scalar header requires +1 indentation The second variant I'm going to consider a spec bug, and not fix the current implementation. I think the current implementation follows the intent of the spec, even if the specific rule (probably
|
Describe the bug
I would think this is quite some oversight in the YAML spec
what are your thoughts on it?
To Reproduce
Expected behaviour
s-l+block-scalar requires that
|
must have +1 indentation from the parent node.I would think this is valid
c-l+literal doesn't add +1 onto the l-literal-content indentation
allowing the content to have 0 indentation inside a block collection
(and -1 indentation at root level)
I would think this shouldn't be allowed
l-chomped-empty doesn't actually allow tabs before the first trailing comment
I guess it kinda makes sense
Versions:
yaml
:2.4.3
Additional context
![image](https://private-user-images.githubusercontent.com/33529441/337612277-8a0b0306-ea5a-4430-885d-5f62a683eb92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MjgzMzIsIm5iZiI6MTcyNDQyODAzMiwicGF0aCI6Ii8zMzUyOTQ0MS8zMzc2MTIyNzctOGEwYjAzMDYtZWE1YS00NDMwLTg4NWQtNWY2MmE2ODNlYjkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDE1NDcxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE4OGY3MmZkOTEwNmQ2NzFjZGY0ZDAxODMwNDM4NTU1ZGMyYjFlYzg1YzEyNGY4NmYyMzZkNTUyNmZhOGU1NmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DvB58H7d68T7zGOjSXYWDLDX8dmmnR6ZXT0AoGneHzY)
The text was updated successfully, but these errors were encountered: