emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lixin Chin <lixinchin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org.el: Relax the match criteria for MathML header line
Date: Tue, 29 Nov 2016 11:45:49 +0800	[thread overview]
Message-ID: <866cd05d-676d-aa1c-3ab0-d6e7a3edbf08@gmail.com> (raw)

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

             reply	other threads:[~2016-11-29  3:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29  3:45 Lixin Chin [this message]
2016-11-29  8:30 ` [PATCH] org.el: Relax the match criteria for MathML header line Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=866cd05d-676d-aa1c-3ab0-d6e7a3edbf08@gmail.com \
    --to=lixinchin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).