Treatment of the comment character has long been discussed on the yaml-core
list and has changed a bit in the spec over this year. Currently, any pound
character which is preceded by space trims to the next newline as a comment.
Yes, quotes can overcome this weakness.
···
plain: one #this is a comment
quoted: ‘one # this is not a comment’
also plain: one#this is not a comment
and also: one# this is also not a comment
I do agree with the rule. I can see compelling reasons to follow plain
scalars with descriptive comments. I don’t see the compelling reason for the
space-pound in plain scalars. But if you have a good use case, hop on
yaml-core ML and lay it out for us, Brother Black.
_why
On Thursday 11 December 2003 05:11 pm, David A. Black wrote:
Hi –
I’m wondering whether the “#” and everything after it are
really supposed to be taken out of the string in this
example:
irb(main):015:0> YAML.load(“—\nstring: one # two”)
=> {“string”=>“one”}
I guess I can wrap it all in quotation marks, but I didn’t
think I had to.
suggests this is the right behaviour; so the quites are necessary.
I’d read that part of the spec yesterday and come away uncertain
(hence my question mainly because I thought that the last
line of the example:
this: | # Comments may trail block indicators.
contains three lines of text.
The third one starts with a
# character. This isn’t a comment.
should be a comment if my line contained a comment. But now I think
I’m grasping the idea that indentation on the left isn’t counted as
whitespace for purposes of defining a comment as whitespace followed
optionally by ‘#’ and so on.
As it stands right now, though, yaml can’t read it’s own output, which
strikes me as a fairly major issue;
require ‘yaml’
fred = “Call the method #dave”
str = YAML.dump(fred)
fred1 = YAML.load(str)
puts fred1 # => 'Call the method ’
For me, this, combined with the stuct bug I mentioned over on -core,
makes YAML unusable for my RI work. At the very least, shouldn’t ::dump
escape the output?
Cheers
Dave
···
On Dec 12, 2003, at 12:33, why the lucky stiff wrote:
Treatment of the comment character has long been discussed on the
yaml-core
list and has changed a bit in the spec over this year. Currently, any
pound
character which is preceded by space trims to the next newline as a
comment.
Yes, quotes can overcome this weakness.
I do agree with the rule. I can see compelling reasons to follow plain
scalars with descriptive comments. I don’t see the compelling reason
for the
space-pound in plain scalars. But if you have a good use case, hop on
yaml-core ML and lay it out for us, Brother Black.
Yeah, that bug was fixed a few hours after you reported it. Checked into Ruby
CVS. I could have sworn I responded, but I must have … got distracted.
Got a fix for this bug, too. Testing it out just now.
_why
···
On Saturday 13 December 2003 01:32 pm, Dave Thomas wrote:
As it stands right now, though, yaml can’t read it’s own output, which
strikes me as a fairly major issue;
require ‘yaml’
fred = “Call the method #dave”
str = YAML.dump(fred)
fred1 = YAML.load(str)
puts fred1 # => 'Call the method ’
For me, this, combined with the stuct bug I mentioned over on -core,
makes YAML unusable for my RI work. At the very least, shouldn’t ::dump
escape the output?