Closed metasoarous closed 11 years ago
Hrm.. I guess I should have been using \lt anyway... Still, seems like this could be handled more gracefully.
require 'maruku'
require 'maruku/ext/math'
md = "$$ x<y $$ \n is an equation."
Maruku.new(md, :html_math_engine => 'itex2mml').to_html
yields
"<div class=\"maruku-equation\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"
display=\"block\" class=\"maruku-mathml\"><mi>x</mi><merror><mtext>Unknown
character</mtext></merror><mi>y</mi></math><span class=\"maruku-eq-tex\"><code
style=\"display: none\">x<y</code></span></div>\n<p>is an equation.</p>"
(which is an error, but seems graceful enough to me).
require 'maruku'
require 'maruku/ext/math'
md = "$$ x<y $$ \n is an equation."
Maruku.new(md).to_html
yields
"<div class=\"maruku-equation\"><code class=\"maruku-mathml\"> x<y </code><span
class=\"maruku-eq-tex\"><code style=\"display: none\">x<y</code></span></div>\n<p>
is an equation.</p>"
Hmm... I specified html_math_engine using MaRuKu::Gloabls[:html_math_engine] = 'itex2mml'
, and definitely did not get that graceful a response. I'll have to take another look at my environment when I'm at home to see what might be the root of the discrepancy.
Thanks for your response.
You probably didn't require 'maruku/ext/math'
.
Nope, I did require 'maruku/ext/math
. Running your code exactly gives this full stack trace:
/home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:95:in `rescue in parse': #<REXML::ParseException: malformed XML: missing tag start (REXML::ParseException)
Line: 1
Position: 18
Last 80 unconsumed characters:
<y </code>>
/home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:373:in `pull'
/home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:22:in `parse'
/home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/document.rb:230:in `build'
/home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/document.rb:43:in `initialize'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/mathml_engines/none.rb:11:in `new'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/mathml_engines/none.rb:11:in `convert_to_mathml_none'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/to_html.rb:51:in `render_mathml'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/to_html.rb:119:in `to_html_equation'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:970:in `block in array_to_html'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:961:in `each'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:961:in `array_to_html'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:956:in `children_to_html'
/home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:50:in `to_html'
mathtest.rb:4:in `<main>'
...
malformed XML: missing tag start
Line: 1
Position: 18
Last 80 unconsumed characters:
<y </code>
Line: 1
Position: 18
Last 80 unconsumed characters:
<y </code>
from /home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:20:in `parse'
from /home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/document.rb:230:in `build'
from /home/cts/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rexml/document.rb:43:in `initialize'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/mathml_engines/none.rb:11:in `new'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/mathml_engines/none.rb:11:in `convert_to_mathml_none'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/to_html.rb:51:in `render_mathml'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/ext/math/to_html.rb:119:in `to_html_equation'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:970:in `block in array_to_html'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:961:in `each'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:961:in `array_to_html'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:956:in `children_to_html'
from /home/cts/.rvm/gems/ruby-1.9.2-p320/gems/maruku-0.6.1/lib/maruku/output/to_html.rb:50:in `to_html'
from mathtest.rb:4:in `<main>'
I'm running maruku 0.6.1 on ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
If you let me know what versions of things you are running, I can see if switching addresses the issue.
Thanks
Sorry, I can't comment on 0.6.1,
If you still get an error, after switching to the master branch here (or to my "Nokogiri" branch), then we can talk.
Building the master branch does solve this problem. Thanks!
When trying to run the following
I get the following error
I'm not having this problem with the inline equations, just those in '$$'.
Any chance there is a workaround for this until is really fixed?
Thanks