diff options
Diffstat (limited to 'lisp/org/ox-odt.el')
-rw-r--r-- | lisp/org/ox-odt.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index 51cb42a49a5..3b90d03b1d7 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -96,7 +96,7 @@ (if a (org-odt-export-to-odt t s v) (org-open-file (org-odt-export-to-odt nil s v) 'system)))))) :options-alist - '((:odt-styles-file "ODT_STYLES_FILE" nil nil t) + '((:odt-styles-file "ODT_STYLES_FILE" nil org-odt-styles-file t) (:description "DESCRIPTION" nil nil newline) (:keywords "KEYWORDS" nil nil space) (:subtitle "SUBTITLE" nil nil parse) @@ -110,7 +110,6 @@ (:odt-inline-formula-rules nil nil org-odt-inline-formula-rules) (:odt-inline-image-rules nil nil org-odt-inline-image-rules) (:odt-pixels-per-inch nil nil org-odt-pixels-per-inch) - (:odt-styles-file nil nil org-odt-styles-file) (:odt-table-styles nil nil org-odt-table-styles) (:odt-use-date-fields nil nil org-odt-use-date-fields) ;; Redefine regular option. @@ -741,7 +740,7 @@ link's path." :value-type (regexp :tag "Path"))) (defcustom org-odt-inline-image-rules - '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")) + `(("file" . ,(regexp-opt '(".jpeg" ".jpg" ".png" ".gif" ".svg")))) "Rules characterizing image files that can be inlined into ODT. A rule consists in an association whose key is the type of link @@ -940,7 +939,7 @@ See `org-odt--build-date-styles' for implementation details." (has-time-p (or (not timestamp) (org-timestamp-has-time-p timestamp))) (iso-date (let ((format (if has-time-p "%Y-%m-%dT%H:%M:%S" - "%Y-%m-%dT%H:%M:%S"))) + "%Y-%m-%d"))) (funcall format-timestamp timestamp format end)))) (if iso-date-p iso-date (let* ((style (if has-time-p "OrgDate2" "OrgDate1")) @@ -1383,6 +1382,8 @@ original parsed data. INFO is a plist holding export options." ;; create a manifest entry for styles.xml (org-odt-create-manifest-file-entry "text/xml" "styles.xml") + ;; Ensure we have write permissions to this file. + (set-file-modes (concat org-odt-zip-dir "styles.xml") #o600) ;; FIXME: Who is opening an empty styles.xml before this point? (with-current-buffer @@ -2199,16 +2200,15 @@ SHORT-CAPTION are strings." (defun org-odt--image-size (file info &optional user-width user-height scale dpi embed-as) (let* ((--pixels-to-cms - (function (lambda (pixels dpi) - (let ((cms-per-inch 2.54) - (inches (/ pixels dpi))) - (* cms-per-inch inches))))) + (lambda (pixels dpi) + (let ((cms-per-inch 2.54) + (inches (/ pixels dpi))) + (* cms-per-inch inches)))) (--size-in-cms - (function - (lambda (size-in-pixels dpi) - (and size-in-pixels - (cons (funcall --pixels-to-cms (car size-in-pixels) dpi) - (funcall --pixels-to-cms (cdr size-in-pixels) dpi)))))) + (lambda (size-in-pixels dpi) + (and size-in-pixels + (cons (funcall --pixels-to-cms (car size-in-pixels) dpi) + (funcall --pixels-to-cms (cdr size-in-pixels) dpi))))) (dpi (or dpi (plist-get info :odt-pixels-per-inch))) (anchor-type (or embed-as "paragraph")) (user-width (and (not scale) user-width)) @@ -2699,13 +2699,14 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((string= type "file") (org-export-file-uri raw-path)) + ((string= type "file") + (org-export-file-uri raw-path)) (t raw-path))) ;; Convert & to & for correct XML representation (path (replace-regexp-in-string "&" "&" path))) (cond ;; Link type is handled by a special function. - ((org-export-custom-protocol-maybe link desc 'odt)) + ((org-export-custom-protocol-maybe link desc 'odt info)) ;; Image file. ((and (not desc) imagep) (org-odt-link--inline-image link info)) ;; Formula file. @@ -2946,7 +2947,7 @@ channel." (when scheduled (concat (format "<text:span text:style-name=\"%s\">%s</text:span>" - "OrgScheduledKeyword" org-deadline-string) + "OrgScheduledKeyword" org-scheduled-string) (org-odt-timestamp scheduled contents info))))))) @@ -3728,7 +3729,8 @@ contextual information." (cache-dir (file-name-directory input-file)) (cache-subdir (concat (cl-case processing-type - ((dvipng imagemagick) "ltxpng/") + ((dvipng imagemagick) + org-preview-latex-image-directory) (mathml "ltxmathml/")) (file-name-sans-extension (file-name-nondirectory input-file)))) @@ -4239,7 +4241,7 @@ Return output file's name." `((?i . ,(shell-quote-argument in-file)) (?I . ,(browse-url-file-url in-file)) (?f . ,out-fmt) - (?o . ,out-file) + (?o . ,(shell-quote-argument out-file)) (?O . ,(browse-url-file-url out-file)) (?d . , (shell-quote-argument out-dir)) (?D . ,(browse-url-file-url out-dir)) |