diff options
Diffstat (limited to 'lisp/org/ox-odt.el')
-rw-r--r-- | lisp/org/ox-odt.el | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index 999a2b7f5cf..f9c4a93cc8b 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -27,8 +27,9 @@ (require 'cl-lib) (require 'format-spec) -(require 'ox) (require 'org-compat) +(require 'org-macs) +(require 'ox) (require 'table nil 'noerror) ;;; Define Back-End @@ -147,8 +148,7 @@ Use this to infer values of `org-odt-styles-dir' and `org-odt-schema-dir'.") -(defvar org-odt-data-dir - (expand-file-name "../../etc/" org-odt-lib-dir) +(defvar org-odt-data-dir (expand-file-name "../../etc/" org-odt-lib-dir) "Data directory for ODT exporter. Use this to infer values of `org-odt-styles-dir' and `org-odt-schema-dir'.") @@ -161,25 +161,17 @@ Use this to infer values of `org-odt-styles-dir' and "Regular expressions for special string conversion.") (defconst org-odt-schema-dir-list - (list - (and org-odt-data-dir - (expand-file-name "./schema/" org-odt-data-dir)) ; bail out - (eval-when-compile - (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install - (expand-file-name "./schema/" org-odt-data-dir)))) + (list (expand-file-name "./schema/" org-odt-data-dir)) "List of directories to search for OpenDocument schema files. -Use this list to set the default value of -`org-odt-schema-dir'. The entries in this list are -populated heuristically based on the values of `org-odt-lib-dir' -and `org-odt-data-dir'.") +Use this list to set the default value of `org-odt-schema-dir'. +The entries in this list are populated heuristically based on the +values of `org-odt-lib-dir' and `org-odt-data-dir'.") (defconst org-odt-styles-dir-list (list (and org-odt-data-dir (expand-file-name "./styles/" org-odt-data-dir)) ; bail out - (eval-when-compile - (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install - (expand-file-name "./styles/" org-odt-data-dir))) + (expand-file-name "./styles/" org-odt-data-dir) (expand-file-name "../etc/styles/" org-odt-lib-dir) ; git (expand-file-name "./etc/styles/" org-odt-lib-dir) ; elpa (expand-file-name "./org/" data-directory) ; system @@ -822,7 +814,7 @@ form (TABLE-STYLE-NAME TABLE-TEMPLATE-NAME TABLE-CELL-OPTIONS). TABLE-STYLE-NAME is the style associated with the table through \"#+ATTR_ODT: :style TABLE-STYLE-NAME\" line. -TABLE-TEMPLATE-NAME is a set of - upto 9 - automatic +TABLE-TEMPLATE-NAME is a set of - up to 9 - automatic TABLE-CELL-STYLE-NAMEs and PARAGRAPH-STYLE-NAMEs (as defined below) that is included in `org-odt-content-template-file'. @@ -1357,17 +1349,18 @@ original parsed data. INFO is a plist holding export options." ;; Update styles file. ;; Copy styles.xml. Also dump htmlfontify styles, if there is any. ;; Write styles file. - (let* ((styles-file (plist-get info :odt-styles-file)) - (styles-file (and (org-string-nw-p styles-file) - (read (org-trim styles-file)))) - ;; Non-availability of styles.xml is not a critical - ;; error. For now, throw an error. - (styles-file (or styles-file - (plist-get info :odt-styles-file) - (expand-file-name "OrgOdtStyles.xml" - org-odt-styles-dir) - (error "org-odt: Missing styles file?")))) + (let* ((styles-file + (pcase (plist-get info :odt-styles-file) + (`nil (expand-file-name "OrgOdtStyles.xml" org-odt-styles-dir)) + ((and s (pred (string-match-p "\\`(.*)\\'"))) + (condition-case nil + (read s) + (error (user-error "Invalid styles file specification: %S" s)))) + (filename (org-strip-quotes filename))))) (cond + ;; Non-availability of styles.xml is not a critical error. For + ;; now, throw an error. + ((null styles-file) (error "Missing styles file")) ((listp styles-file) (let ((archive (nth 0 styles-file)) (members (nth 1 styles-file))) @@ -1377,7 +1370,7 @@ original parsed data. INFO is a plist holding export options." (let* ((image-type (file-name-extension member)) (media-type (format "image/%s" image-type))) (org-odt-create-manifest-file-entry media-type member)))))) - ((and (stringp styles-file) (file-exists-p styles-file)) + ((file-exists-p styles-file) (let ((styles-file-type (file-name-extension styles-file))) (cond ((string= styles-file-type "xml") @@ -1421,7 +1414,7 @@ original parsed data. INFO is a plist holding export options." ;; the resulting odt file. (setq-local backup-inhibited t) - ;; Outline numbering is retained only upto LEVEL. + ;; Outline numbering is retained only up to LEVEL. ;; To disable outline numbering pass a LEVEL of 0. (goto-char (point-min)) @@ -1967,10 +1960,12 @@ contextual information." CONTENTS holds the contents of the item. INFO is a plist holding contextual information." (let* ((plain-list (org-export-get-parent item)) + (count (org-element-property :counter item)) (type (org-element-property :type plain-list))) (unless (memq type '(ordered unordered descriptive-1 descriptive-2)) (error "Unknown list type: %S" type)) - (format "\n<text:list-item>\n%s\n%s" + (format "\n<text:list-item%s>\n%s\n%s" + (if count (format " text:start-value=\"%s\"" count) "") contents (if (org-element-map item 'table #'identity info 'first-match) "</text:list-header>" @@ -1996,8 +1991,13 @@ information." (let ((depth (or (and (string-match "\\<[0-9]+\\>" value) (string-to-number (match-string 0 value))) (plist-get info :headline-levels))) - (localp (string-match-p "\\<local\\>" value))) - (org-odt-toc depth info (and localp keyword)))) + (scope + (cond + ((string-match ":target +\\(\".+?\"\\|\\S-+\\)" value) ;link + (org-export-resolve-link + (org-strip-quotes (match-string 1 value)) info)) + ((string-match-p "\\<local\\>" value) keyword)))) ;local + (org-odt-toc depth info scope))) ((string-match-p "tables\\|figures\\|listings" value) ;; FIXME (ignore)))))))) @@ -3144,7 +3144,7 @@ and prefix with \"OrgSrc\". For example, (code-info (org-export-unravel-code element)) (code (car code-info)) (refs (cdr code-info)) - ;; Does the src block contain labels? + ;; Does the source block contain labels? (retain-labels (org-element-property :retain-labels element)) ;; Does it have line numbers? (num-start (org-export-get-loc element info))) @@ -3241,7 +3241,7 @@ styles congruent with the ODF-1.2 specification." (when style-spec ;; LibreOffice - particularly the Writer - honors neither table ;; templates nor custom table-cell styles. Inorder to retain - ;; inter-operability with LibreOffice, only automatic styles are + ;; interoperability with LibreOffice, only automatic styles are ;; used for styling of table-cells. The current implementation is ;; congruent with ODF-1.2 specification and hence is ;; future-compatible. |