Reputation: 133
So I'd like to be able to add a longer block of text to a YAML locale file in Rails. However, the YAML parser gives syntax errors for blocks that appear to be fine! I've read through the Ruby YAML cookbook and it seems like these examples below should all work, but they don't.
This one works fine:
tx:
states:
show:
state_population: "2009 est. pop.: 24,782,302 (cit. <a href=\"http://quickfacts.census.gov/qfd/states/48000.html\">Census.gov</a>"
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
...but is ugly.
tx:
states:
show:
state_population: |
2009 est. pop.: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: >
2009 est. pop.: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: |
"2009 est. pop.: 24,782,302 (cit. <a href=\"http://quickfacts.census.gov/qfd/states/48000.html\">Census.gov</a>"
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
tx:
states:
show:
state_population: |
2009 est. pop.\: 24,782,302 (cit. <a href="http://quickfacts.census.gov/qfd/states/48000.html">Census.gov</a>
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
Upvotes: 2
Views: 1148
Reputation: 11
From http://pastie.org/1352791
tx:
states:
show:
state_population: >
2009 est. pop.: 24,782,302
(cit.
<a href=\"http://quickfacts.census.gov/qfd/states/48000.html\">Census.gov</a>)
state_pop_per_upper_chamber_member: "Each senator serves a four-year term and represents approx. 774,447 Texans"
Upvotes: 1