[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Does YAML allow TAB for indentation?

Iñaki Baz Castillo

4/5/2008 3:47:00 PM

Hi, I'm trying YAML with Ruby and it allows TAB for indentation, but it see=
ms=20
that it shouldn't be allowed (at least Wikipedia says that).

Is then TAB allowed or not for indentation in YAML format?
Maybe Ruby YAML allows it but it shouldn't do it?

Thanks a lot.


=2D-=20
I=C3=B1aki Baz Castillo

4 Answers

Marc Heiler

4/5/2008 3:51:00 PM

0

"Is then TAB allowed or not for indentation in YAML format?
Maybe Ruby YAML allows it but it shouldn't do it?"

Cant give a definite answer on it but If i need to write rather freely
in yaml I normally do:


entry: |
"some really long
string coming here... describing something etc... "
--
Posted via http://www.ruby-....

Nikita Petrov

4/5/2008 3:53:00 PM

0

2008/4/5, I=F1aki Baz Castillo <ibc@aliax.net>:
> Hi, I'm trying YAML with Ruby and it allows TAB for indentation, but it s=
eems
> that it shouldn't be allowed (at least Wikipedia says that).
>
> Is then TAB allowed or not for indentation in YAML format?
> Maybe Ruby YAML allows it but it shouldn't do it?
>
> Thanks a lot.
>
>
> --
>
> I=F1aki Baz Castillo
>
>

No, it isn't allowed in Ruby YAML too.

Iñaki Baz Castillo

4/5/2008 3:58:00 PM

0

El S=C3=A1bado, 5 de Abril de 2008, I=C3=B1aki Baz Castillo escribi=C3=B3:
> Hi, I'm trying YAML with Ruby and it allows TAB for indentation, but it
> seems that it shouldn't be allowed (at least Wikipedia says that).

Sorry, my mistake. Ruby YAML doesn't allow TAB for indentation.
=46ucking VI that converts TAB to spaces XDDD

:wq



=2D-=20
I=C3=B1aki Baz Castillo

Phlip

4/5/2008 4:06:00 PM

0

Iñaki Baz Castillo wrote:

> Hi, I'm trying YAML with Ruby and it allows TAB for indentation, but it
> seems that it shouldn't be allowed (at least Wikipedia says that).

$ irb
> require 'yaml'

> YAML::load("kozmik:\n\tbullfrog")

ArgumentError: syntax error on line 1, col 9: '
from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
from (irb):3

> YAML::load("kozmik:\n bullfrog")

=> {"kozmik"=>"bullfrog"}

The Syck YAML project seems to obey the YAML specification here.

That's a good thing too, because the TAB character is a legacy of
computing's infancy, and it has no place in modern editors or source code.

--
Phlip