OK, while parsing the td2 data from the ruby-lang website we stumbled on
a possible bug in YAML in the 1.8.4 version.
I am running 1.8.2-15 of the windows one click installer and the
following code is running perfectly:
require 'yaml'
bug=[{:content=>"\n\n <dl>\n<dt>From: Yukihiro Matsumoto <matz at
ruby-lang.org></dt>"}]
dumped=YAML.dump(bug)
p YAML::load( dumped )
D:\projects\ruby-lang>ruby yaml_bug.rb
[{:content=>"\n\n <dl>\n<dt>From: Yukihiro Matsumoto <matz at
ruby-lang.org></dt>"}]
The same code with the 1.8.4-16 RC2 installer produces a syntax error
when loading the dump:
D:\projects\ruby-lang>d:\ruby-1.8.4\bin\ruby.exe yaml_bug.rb
d:/ruby-1.8.4/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line
5, col 4: ` <dt>From: Yukihiro Matsu
moto <matz at ruby-lang.org></dt>' (ArgumentError)
from d:/ruby-1.8.4/lib/ruby/1.8/yaml.rb:133:in `load'
from yaml_bug.rb:6
I traced the problem to a leading space (the one before <dl>). I worked
around it by stripping all leading whitespace from our lines but James
(Edward Gray II) thought we should mention this here.
So is this a bug? It is damn inconvenient anyways :)
Cheers,
V.-
--
http://www.braveworld.net/riva
____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.