You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is safer as it never depends on parent document's encoding, but on the other hand it hampers readability.
My suggestion is to add :escape_non_ascii option to Expression#to_mathml method which would disable this kind of escaping (of course <, >, and & will be escaped anyway). This option should default to false.
Perhaps similar option could be added to Expression#to_html method.
The text was updated successfully, but these errors were encountered:
I've added the code to do this already. I'm still trying to figure out how I can let users pass options to to_mathml without breaking backwards compatibility. Looks like I've painted myself into a corner there.
classExpression# use like:# expr.with_options(escape_non_ascii: false).to_math_mldefwith_options(options)dup.tapdo |new_expr|
# set some options like disabling escaping on expression, which is quite odd, but at least gives reasonable interfaceendendend
Keyword argument would be even better, but I suppose this gem still supports old good Ruby 1.9 for some reason?
This is a feature request. I can provide implementation, but I wanted to discuss things first.
MathML does not enforce any particular encoding, UTF-8 is legal, and non-ASCII characters can be used without escaping them [W3C].
However, this gem always encodes non-ASCII characters using numeric XML character references (e.g.
é
):asciimath/lib/asciimath/mathml.rb
Lines 234 to 249 in 3a4bbab
This is safer as it never depends on parent document's encoding, but on the other hand it hampers readability.
My suggestion is to add
:escape_non_ascii
option toExpression#to_mathml
method which would disable this kind of escaping (of course<
,>
, and&
will be escaped anyway). This option should default tofalse
.Perhaps similar option could be added to
Expression#to_html
method.The text was updated successfully, but these errors were encountered: