From 311146aa2122f3bd64ec71cba0155bdfa0378c66 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Tue, 8 Nov 2011 05:07:00 +0530 Subject: [PATCH] Add support for embedding an equation via a link to its *.odf file * contrib/lisp/org-odt.el (org-odt-is-formula-link-p): Recognize *.mml and *.mathml as mathml files. Recognize *.odf files as OpenDocument formula file. (org-odt-copy-formula-file): Use `org-odt-zip-extract-one' to handle ODF formula files. (org-export-odt-format-formula): If a ODF formula link has no caption or label, embed it inline. Otherwise embed it as displayed. --- contrib/lisp/org-odt.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index 2d4b4fcf2..0d53efd71 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -1271,7 +1271,7 @@ value of `org-export-odt-fontify-srcblocks." (and latex-frag (org-find-text-property-in-string 'org-latex-src-embed-type src)) - 'paragraph)) + (if (or caption label) 'paragraph 'character))) width height) (when latex-frag (setq href (org-propertize href :title "LaTeX Fragment" @@ -1306,7 +1306,14 @@ value of `org-export-odt-fontify-srcblocks." (org-odt-create-manifest-file-entry "application/vnd.oasis.opendocument.formula" target-dir "1.2") - (copy-file src-file target-file 'overwrite) + (case (org-odt-is-formula-link-p src-file) + (mathml + (copy-file src-file target-file 'overwrite)) + (odf + (org-odt-zip-extract-one src-file "content.xml" target-dir)) + (t + (error "%s is not a formula file" src-file))) + (org-odt-create-manifest-file-entry "text/xml" target-file)) target-file)) @@ -1323,7 +1330,11 @@ value of `org-export-odt-fontify-srcblocks." (defun org-odt-is-formula-link-p (file) (let ((case-fold-search nil)) - (string-match "\\.mathml\\'" file))) + (cond + ((string-match "\\.\\(mathml\\|mml\\)\\'" file) + 'mathml) + ((string-match "\\.odf\\'" file) + 'odf)))) (defun org-odt-format-org-link (opt-plist type-1 path fragment desc attr descp) -- 2.11.4.GIT