Sfoglia il codice sorgente

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.
Jambunathan K 13 anni fa
parent
commit
311146aa21
1 ha cambiato i file con 14 aggiunte e 3 eliminazioni
  1. 14 3
      contrib/lisp/org-odt.el

+ 14 - 3
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)