Although you (the owners?) had decided not to trim the last newline in #225 , I'm still not for it. I'd like to make the newline “obvious”. E.g.
key = '''
Just a sentence.
'''
is equal to key = """\nJust a sentence.\n""". Is it really counter-intuitive?
And a special case:
# key = "\n"
key = """
"""
To me, yes, what you are suggesting would be counter-intuitive. Trimming the leading newline is also slightly counter-intuitive, but the value of "all column-1 text can start on column 1 of the file" is greater than that counter-intuitiveness. But in your "Just a sentence" example, my brain expects to see two newlines at the end, because there's a blank line there before the closing delimiter. The absence of that second newline would bother me immensely, as would the absence of a final newline in this example:
key = """
Just a sentence.
"""
If I wanted to have no newline at the end of that example, I would have put the closing tag immediately after the period -- and, in fact, I would have simply written "Just a sentence." on a single line in that case. If TOML stripped the newline that I intended to be there, I would be surprised and annoyed.
Think about indentation, or you'll repeat the ugliness of "here documents" taught in too many bash tutorials:
function ugly () {
( foo_header
foo_content_escape <<EndOfContent
Hello world, indentation is great!
Unfortunately, most tutorials make it
look like it's not allowed here:
EndOfContent
foo_trailer
) | tr A-Z a-z
}
In bash and dash, fortunately, you can cheat by making the exact amount of whitespace part of your marker (which you'll then have to quote). In TOML however, you can't choose the marker.
I think this issue can be closed:
\ after the opening quotes.
Most helpful comment
I think this issue can be closed:
\after the opening quotes.