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

Directive formatting in output #112

Closed
acklavidian opened this issue May 17, 2019 · 5 comments
Closed

Directive formatting in output #112

acklavidian opened this issue May 17, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@acklavidian
Copy link

acklavidian commented May 17, 2019

Is there anyway to have the --- (directive maybe?) at the top of the document on stringification?'
eg:

---
description: 'i do not know what that thing up there at the top is called'
possibly:
  - directive
  - triple dash
  - separator  
...
@eemeli
Copy link
Owner

eemeli commented May 18, 2019

At least for the moment the directives-end indicator --- is only included if the document has explicit %YAML or %TAG directives. Do you have a use case where it would be needed or useful in other cases?

@acklavidian
Copy link
Author

Ah, directives-end indicator... thank you. Well I'm trying to parse and manipulate some yaml that exists in 3 dimensions. A ruby based CLI tool, a web based UI, and in version control. So the document gets written from this ruby tool and then interpreted by my web-UI code. Then my code (using your lib) overwrites the yaml files incase there were some changes. Then on top of that there is also version control watching these yaml files (git via bitbucket) So even if there isn't any changes my side will wanna remove the --- at the top of the file and this in turn shows up in the version control. Obviously, this isn't a meaningful change. I know I could just prepend the ---\n with string interpolation to the doc. I just would prefer not to do any string interpolation if your library can handle it cleaner.

@eemeli
Copy link
Owner

eemeli commented May 21, 2019

So the use case here is that you're trying to use the library together with a ruby tool that always includes the --- indicator?

I'm pondering adding an option for this, given that it might be useful to have certainty about whether or not the indicator is included in the output. Or more likely reading its presence from the input, and if so including it in the input.

@eemeli eemeli added the enhancement New feature or request label May 21, 2019
@acklavidian
Copy link
Author

Yeah, that is pretty much the long and short of it. Either/Both of those options would work for my uses.

@eemeli
Copy link
Owner

eemeli commented May 23, 2019

Fixed in version 1.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants