summaryrefslogtreecommitdiff
path: root/lisp/ox-odt.el
diff options
context:
space:
mode:
authorSébastien Delafond <sdelafond@gmail.com>2015-11-27 17:40:16 +0100
committerSébastien Delafond <sdelafond@gmail.com>2015-11-27 17:40:16 +0100
commit09600666ecbbebe86830a937658465d046e13d06 (patch)
treef8140dfdec0fdfc11323d6c491f7680673bcc0de /lisp/ox-odt.el
parent1be13d57dc8357576a8285c6dadc03db9e3ed7b0 (diff)
Imported Upstream version 8.3.2
Diffstat (limited to 'lisp/ox-odt.el')
-rw-r--r--lisp/ox-odt.el93
1 files changed, 45 insertions, 48 deletions
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index e578a17..75353a0 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -245,13 +245,13 @@ standard Emacs.")
(defvar org-odt-automatic-styles '()
"Registry of automatic styles for various OBJECT-TYPEs.
The variable has the following form:
-\(\(OBJECT-TYPE-A
- \(\(OBJECT-NAME-A.1 OBJECT-PROPS-A.1\)
- \(OBJECT-NAME-A.2 OBJECT-PROPS-A.2\) ...\)\)
- \(OBJECT-TYPE-B
- \(\(OBJECT-NAME-B.1 OBJECT-PROPS-B.1\)
- \(OBJECT-NAME-B.2 OBJECT-PROPS-B.2\) ...\)\)
- ...\).
+ ((OBJECT-TYPE-A
+ ((OBJECT-NAME-A.1 OBJECT-PROPS-A.1)
+ (OBJECT-NAME-A.2 OBJECT-PROPS-A.2) ...))
+ (OBJECT-TYPE-B
+ ((OBJECT-NAME-B.1 OBJECT-PROPS-B.1)
+ (OBJECT-NAME-B.2 OBJECT-PROPS-B.2) ...))
+ ...).
OBJECT-TYPEs could be \"Section\", \"Table\", \"Figure\" etc.
OBJECT-PROPS is (typically) a plist created by passing
@@ -306,7 +306,7 @@ according to the default face identified by the `htmlfontify'.")
This is an alist where each element is of the form:
- \(STYLE-NAME ATTACH-FMT REF-MODE REF-FMT)
+ (STYLE-NAME ATTACH-FMT REF-MODE REF-FMT)
ATTACH-FMT controls how labels and captions are attached to an
entity. It may contain following specifiers - %e and %c. %e is
@@ -333,7 +333,7 @@ See also `org-odt-format-label'.")
This is a list where each entry is of the form:
- \(CATEGORY-HANDLE OD-VARIABLE LABEL-STYLE CATEGORY-NAME ENUMERATOR-PREDICATE)
+ (CATEGORY-HANDLE OD-VARIABLE LABEL-STYLE CATEGORY-NAME ENUMERATOR-PREDICATE)
CATEGORY_HANDLE identifies the captionable entity in question.
@@ -685,11 +685,11 @@ The default value simply returns the value of CONTENTS."
"Function to format headline text.
This function will be called with 5 arguments:
-TODO the todo keyword \(string or nil\).
-TODO-TYPE the type of todo \(symbol: `todo', `done', nil\)
-PRIORITY the priority of the headline \(integer or nil\)
-TEXT the main headline text \(string\).
-TAGS the tags string, separated with colons \(string or nil\).
+TODO the todo keyword (string or nil).
+TODO-TYPE the type of todo (symbol: `todo', `done', nil)
+PRIORITY the priority of the headline (integer or nil)
+TEXT the main headline text (string).
+TAGS the tags string, separated with colons (string or nil).
The function result will be used as headline text."
:group 'org-export-odt
@@ -867,11 +867,11 @@ ON-OR-OFF := t | nil
For example, with the following configuration
\(setq org-odt-table-styles
- '\(\(\"TableWithHeaderRowsAndColumns\" \"Custom\"
- \(\(use-first-row-styles . t\)
- \(use-first-column-styles . t\)\)\)
- \(\"TableWithHeaderColumns\" \"Custom\"
- \(\(use-first-column-styles . t\)\)\)\)\)
+ '((\"TableWithHeaderRowsAndColumns\" \"Custom\"
+ ((use-first-row-styles . t)
+ (use-first-column-styles . t)))
+ (\"TableWithHeaderColumns\" \"Custom\"
+ ((use-first-column-styles . t)))))
1. A table associated with \"TableWithHeaderRowsAndColumns\"
style will use the following table-cell styles -
@@ -1175,14 +1175,15 @@ table of contents as a string, or nil."
;; /TOC/, as otherwise there will be duplicated anchors one in TOC
;; and one in the document body.
;;
- ;; FIXME: Are there any other objects that need to be suppressed
- ;; within TOC?
+ ;; Likewise, links, footnote references and regular targets are also
+ ;; suppressed.
(let* ((headlines (org-export-collect-headlines info depth scope))
(backend (org-export-create-backend
:parent (org-export-backend-name (plist-get info :back-end))
- :transcoders (mapcar
- (lambda (type) (cons type (lambda (d c i) c)))
- (list 'radio-target)))))
+ :transcoders '((footnote-reference . ignore)
+ (link . (lambda (object c i) c))
+ (radio-target . (lambda (object c i) c))
+ (target . ignore)))))
(when headlines
(org-odt--format-toc
(and (not scope) (org-export-translate "Table of Contents" :utf-8 info))
@@ -1410,8 +1411,8 @@ original parsed data. INFO is a plist holding export options."
((member styles-file-type '("odt" "ott"))
(org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir)))))
(t
- (error (format "Invalid specification of styles.xml file: %S"
- (plist-get info :odt-styles-file)))))
+ (error "Invalid specification of styles.xml file: %S"
+ (plist-get info :odt-styles-file))))
;; create a manifest entry for styles.xml
(org-odt-create-manifest-file-entry "text/xml" "styles.xml")
@@ -1765,8 +1766,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((not
(org-export-footnote-first-reference-p footnote-reference info nil t))
(funcall --format-footnote-reference n))
- ;; Inline definitions are secondary strings.
- ;; Non-inline footnotes definitions are full Org data.
(t
(let* ((raw (org-export-get-footnote-definition
footnote-reference info))
@@ -1784,9 +1783,14 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"OrgFootnoteCenter"
"OrgFootnoteQuotations")))))
info))))
- (if (eq (org-element-type raw) 'org-data) def
- (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
- "Footnote" def)))))
+ ;; Inline definitions are secondary strings. We
+ ;; need to wrap them within a paragraph.
+ (if (memq (org-element-type (car (org-element-contents raw)))
+ org-element-all-elements)
+ def
+ (format
+ "\n<text:p text:style-name=\"Footnote\">%s</text:p>"
+ def)))))
(funcall --format-footnote-definition n def))))))))
@@ -2781,17 +2785,10 @@ INFO is a plist holding contextual information. See
(org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info))))
(case (org-element-type destination)
- ;; Case 1: Fuzzy link points nowhere.
- ('nil
- (format "<text:span text:style-name=\"%s\">%s</text:span>"
- "Emphasis"
- (or desc
- (org-export-data (org-element-property :raw-link link)
- info))))
- ;; Case 2: Fuzzy link points to a headline.
+ ;; Fuzzy link points to a headline. If there's
+ ;; a description, create a hyperlink. Otherwise, try to
+ ;; provide a meaningful description.
(headline
- ;; If there's a description, create a hyperlink.
- ;; Otherwise, try to provide a meaningful description.
(if (not desc) (org-odt-link--infer-description destination info)
(let ((label
(or (and (string= type "custom-id")
@@ -2800,15 +2797,15 @@ INFO is a plist holding contextual information. See
(format
"<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
label desc))))
- ;; Case 3: Fuzzy link points to a target.
+ ;; Fuzzy link points to a target. If there's a description,
+ ;; create a hyperlink. Otherwise, try to provide
+ ;; a meaningful description.
(target
- ;; If there's a description, create a hyperlink.
- ;; Otherwise, try to provide a meaningful description.
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-get-reference destination info)
(or desc (org-export-get-ordinal destination info))))
- ;; Case 4: Fuzzy link points to some element (e.g., an
- ;; inline image, a math formula or a table).
+ ;; Fuzzy link points to some element (e.g., an inline image,
+ ;; a math formula or a table).
(otherwise
(let ((label-reference
(ignore-errors
@@ -4118,8 +4115,8 @@ contextual information."
nil standard-output nil (cdr cmd)))))
(or (zerop exitcode)
(error (concat "Unable to create OpenDocument file."
- (format " Zip failed with error (%s)"
- err-string)))))
+ " Zip failed with error (%s)")
+ err-string)))
cmds)))
;; Move the zip file from temporary work directory to
;; user-mandated location.