Hi there,
I wanted to use RedCloth with my RubyOnRails 3 application, but it seems
that RoR uses 1.9.2's Psych by default as the YAML parser if available,
and Psych fails to load the LaTeX entities file:
====================================================================
#ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
irb(main):001:0> Dir.pwd
=>
"/opt/rubies/ruby-1.9.2-p136/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.3/lib/redcloth/formatters"
irb(main):002:0> YAML
=> Psych
irb(main):003:0> YAML.load_file("latex_entities.yml")
Psych::SyntaxError: couldn't parse YAML at line 182 column 9
from /opt/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in
`parse'
from /opt/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in
`parse_stream'
from /opt/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:in
`parse'
from /opt/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:106:in `load'
from /opt/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:205:in
`load_file'
from (irb):3
from /home/quintus/bin/irb_:56:in `<main>'
irb(main):004:0>
====================================================================
The criticized line is this one (for whatever reason Psych's error
reporting is off by 1 line):
====================================================================
ldquor: ,,
====================================================================
There are some more occurences of such characters in that file. Apply
this patch and loading works fine:
====================================================================
--- lib/redcloth/formatters/latex_entities.yml.old 2011-02-05
12:59:03.143333338 +0100
+++ lib/redcloth/formatters/latex_entities.yml 2011-02-05
13:01:30.540000006 +0100
@@ -180,10 +180,10 @@
"8218": ","
#DOUBLE LOW-9 QUOTATION MARK
#requires fontenc:T1
-ldquor: ,,
+ldquor: ",,"
#DOUBLE LOW-9 QUOTATION MARK
#requires fontenc:T1
-"8222": ,,
+"8222": ",,"
#LATIN SMALL LIGATURE FF
"64256": ff
#LATIN SMALL LIGATURE FI
@@ -197,9 +197,9 @@
#LATIN SMALL LIGATURE FL
"64258": fl
#DOUBLE HIGH-REVERSED-9 QUOTATION MARK
-"8223": ``
+"8223": "``"
#SINGLE HIGH-REVERSED-9 QUOTATION MARK
-"8219": `
+"8219": "`"
#VERTICAL ELLIPSIS
"8942": \vdots{}
#HYPHEN BULLET
@@ -502,17 +502,17 @@
#requires fontenc:T1
"187": \guillemotright{}
#LEFT SINGLE QUOTATION MARK
-lsquo: `
+lsquo: "`"
#LEFT SINGLE QUOTATION MARK
-"8216": `
+"8216": "`"
#RIGHT SINGLE QUOTATION MARK
rsquo: "'"
#RIGHT SINGLE QUOTATION MARK
"8217": "'"
#LEFT DOUBLE QUOTATION MARK
-ldquo: ``
+ldquo: "``"
#LEFT DOUBLE QUOTATION MARK
-"8220": ``
+"8220": "``"
#RIGHT DOUBLE QUOTATION MARK
rdquo: "''"
#RIGHT DOUBLE QUOTATION MARK
====================================================================
Steps to reproduce:
1) Get a Ruby build with Psych support (the libyaml development headers
have to be present when compiling Ruby)
2) Go to IRB
3) require "psych"
4) YAML = Psych
5) require "redcloth"
Valete,
Marvin
on 2011-02-06 21:52
on 2011-02-07 16:56
It's already fixed in master. I'm working on pushing it out now. Thanks for reporting it, though! I wanted to make sure I had caught up with everything before I pushed a release. Jason
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.