emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el: Relax the match criteria for MathML header line
@ 2016-11-29  3:45 Lixin Chin
  2016-11-29  8:30 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Lixin Chin @ 2016-11-29  3:45 UTC (permalink / raw)
  To: emacs-orgmode

Hi everyone,

This fixes a minor bug in converting LaTeX equations to MathML.  The
default match criteria for the toplevel <math> is unnecessarily strict,
and should probably be relaxed.

Thanks,
Lixin Chin

* lisp/org.el (org-create-math-formula): Allow the xmlns attribute to
   be preceded by any other mathml header attribute.

The problem here was that the match criteria for MathML assumed that
the xmlns attribute is the first listed in the top level MathML <math>
element.  Some LaTeX -> MathML converters (e.g., pandoc) will add
attributes before xmlns, which is still valid MathML.
---
  lisp/org.el | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index e372475..93d00ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19387,8 +19387,9 @@ inspection."
            (goto-char (point-min))
            (when (re-search-forward
               (concat
+              "<math[^>]*?"
                (regexp-quote
-               "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"")
+               "xmlns=\"http://www.w3.org/1998/Math/MathML\"")
                "[^>]*?>"
                "\\(.\\|\n\\)*"
                "</math>")
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] org.el: Relax the match criteria for MathML header line
  2016-11-29  3:45 [PATCH] org.el: Relax the match criteria for MathML header line Lixin Chin
@ 2016-11-29  8:30 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-11-29  8:30 UTC (permalink / raw)
  To: Lixin Chin; +Cc: emacs-orgmode

Hello,

Lixin Chin <lixinchin@gmail.com> writes:

> This fixes a minor bug in converting LaTeX equations to MathML.  The
> default match criteria for the toplevel <math> is unnecessarily strict,
> and should probably be relaxed.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-29  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-29  3:45 [PATCH] org.el: Relax the match criteria for MathML header line Lixin Chin
2016-11-29  8:30 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).