Browse Source

ox-odt: Use options instead of hard-coded variables

* lisp/ox-odt.el (org-odt-styles-dir,
  org-odt-create-custom-styles-for-srcblocks, org-odt-table-styles,
  org-odt-get-table-cell-styles): Fix docstring.
(org-odt-format-headline-function,
org-odt-format-inlinetask-function): Change default value.

(org-odt-template, org-odt-drawer, org-odt-format-headline--wrap,
org-odt-inlinetask, org-odt--enumerate, org-odt--image-size,
org-odt--enumerable-image-p, org-odt--enumerable-latex-image-p,
org-odt--enumerable-formula-p, org-odt-link, org-odt-table-style-spec,
org-odt-timestamp): Use option instead of hard-coded variables.

(org-odt-format-headline): Remove function.

(org-odt-do-format-code): Change signature.  Use options instead of
hard-coded variables.
(org-odt-fixed-width, org-odt-latex-environment,
org-odt-link--inline-image, org-odt-format-code): Apply signature
change.

(org-odt-format-headline-default-function,
org-odt-format-inlinetask-default-function): New functions.

(org-odt-link--inline-image): Fix indentation.
Nicolas Goaziou 11 years ago
parent
commit
3c22bb19e0
1 changed files with 109 additions and 102 deletions
  1. 109 102
      lisp/ox-odt.el

+ 109 - 102
lisp/ox-odt.el

@@ -203,8 +203,7 @@ heuristically based on the values of `org-odt-lib-dir' and
 This directory contains the following XML files -
 This directory contains the following XML files -
  \"OrgOdtStyles.xml\" and \"OrgOdtContentTemplate.xml\".  These
  \"OrgOdtStyles.xml\" and \"OrgOdtContentTemplate.xml\".  These
  XML files are used as the default values of
  XML files are used as the default values of
- `org-odt-styles-file' and
- `org-odt-content-template-file'.
+ `org-odt-styles-file' and `org-odt-content-template-file'.
 
 
 The default value of this variable varies depending on the
 The default value of this variable varies depending on the
 version of org in use and is initialized from
 version of org in use and is initialized from
@@ -676,7 +675,8 @@ The default value simply returns the value of CONTENTS."
 
 
 ;;;; Headline
 ;;;; Headline
 
 
-(defcustom org-odt-format-headline-function 'ignore
+(defcustom org-odt-format-headline-function
+  'org-odt-format-headline-default-function
   "Function to format headline text.
   "Function to format headline text.
 
 
 This function will be called with 5 arguments:
 This function will be called with 5 arguments:
@@ -688,14 +688,15 @@ TAGS      the tags string, separated with colons \(string or nil\).
 
 
 The function result will be used as headline text."
 The function result will be used as headline text."
   :group 'org-export-odt
   :group 'org-export-odt
-  :version "24.4"
-  :package-version '(Org . "8.0")
+  :version "24.5"
+  :package-version '(Org . "8.3")
   :type 'function)
   :type 'function)
 
 
 
 
 ;;;; Inlinetasks
 ;;;; Inlinetasks
 
 
-(defcustom org-odt-format-inlinetask-function 'ignore
+(defcustom org-odt-format-inlinetask-function
+  'org-odt-format-inlinetask-default-function
   "Function called to format an inlinetask in ODT code.
   "Function called to format an inlinetask in ODT code.
 
 
 The function must accept six parameters:
 The function must accept six parameters:
@@ -708,8 +709,8 @@ The function must accept six parameters:
 
 
 The function should return the string to be exported."
 The function should return the string to be exported."
   :group 'org-export-odt
   :group 'org-export-odt
-  :version "24.4"
-  :package-version '(Org . "8.0")
+  :version "24.5"
+  :package-version '(Org . "8.3")
   :type 'function)
   :type 'function)
 
 
 
 
@@ -797,8 +798,8 @@ Use the latter option if you do not want the custom styles to be
 based on your current display settings.  It is necessary that the
 based on your current display settings.  It is necessary that the
 styles.xml already contains needed styles for colorizing to work.
 styles.xml already contains needed styles for colorizing to work.
 
 
-This variable is effective only if
-`org-odt-fontify-srcblocks' is turned on."
+This variable is effective only if `org-odt-fontify-srcblocks' is
+turned on."
   :group 'org-export-odt
   :group 'org-export-odt
   :version "24.1"
   :version "24.1"
   :type 'boolean)
   :type 'boolean)
@@ -835,8 +836,7 @@ TABLE-STYLE-NAME is the style associated with the table through
 
 
 TABLE-TEMPLATE-NAME is a set of - upto 9 - automatic
 TABLE-TEMPLATE-NAME is a set of - upto 9 - automatic
 TABLE-CELL-STYLE-NAMEs and PARAGRAPH-STYLE-NAMEs (as defined
 TABLE-CELL-STYLE-NAMEs and PARAGRAPH-STYLE-NAMEs (as defined
-below) that is included in
-`org-odt-content-template-file'.
+below) that is included in `org-odt-content-template-file'.
 
 
 TABLE-CELL-STYLE-NAME := TABLE-TEMPLATE-NAME + TABLE-CELL-TYPE +
 TABLE-CELL-STYLE-NAME := TABLE-TEMPLATE-NAME + TABLE-CELL-TYPE +
                          \"TableCell\"
                          \"TableCell\"
@@ -1375,7 +1375,7 @@ original parsed data.  INFO is a plist holding export options."
 	 ;; Non-availability of styles.xml is not a critical
 	 ;; Non-availability of styles.xml is not a critical
 	 ;; error. For now, throw an error.
 	 ;; error. For now, throw an error.
 	 (styles-file (or styles-file
 	 (styles-file (or styles-file
-			  org-odt-styles-file
+			  (plist-get info :odt-styles-file)
 			  (expand-file-name "OrgOdtStyles.xml"
 			  (expand-file-name "OrgOdtStyles.xml"
 					    org-odt-styles-dir)
 					    org-odt-styles-dir)
 			  (error "org-odt: Missing styles file?"))))
 			  (error "org-odt: Missing styles file?"))))
@@ -1400,7 +1400,7 @@ original parsed data.  INFO is a plist holding export options."
 	  (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir)))))
 	  (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir)))))
      (t
      (t
       (error (format "Invalid specification of styles.xml file: %S"
       (error (format "Invalid specification of styles.xml file: %S"
-		     org-odt-styles-file))))
+		     (plist-get info :odt-styles-file)))))
 
 
     ;; create a manifest entry for styles.xml
     ;; create a manifest entry for styles.xml
     (org-odt-create-manifest-file-entry "text/xml" "styles.xml")
     (org-odt-create-manifest-file-entry "text/xml" "styles.xml")
@@ -1461,7 +1461,7 @@ original parsed data.  INFO is a plist holding export options."
 	    '("%Y-%M-%d %a" . "%Y-%M-%d %a %H:%M"))))
 	    '("%Y-%M-%d %a" . "%Y-%M-%d %a %H:%M"))))
     (with-temp-buffer
     (with-temp-buffer
       (insert-file-contents
       (insert-file-contents
-       (or org-odt-content-template-file
+       (or (plist-get info :odt-content-template-file)
 	   (expand-file-name "OrgOdtContentTemplate.xml"
 	   (expand-file-name "OrgOdtContentTemplate.xml"
 			     org-odt-styles-dir)))
 			     org-odt-styles-dir)))
       ;; Write automatic styles.
       ;; Write automatic styles.
@@ -1475,7 +1475,7 @@ original parsed data.  INFO is a plist holding export options."
 	    (when (setq props (or (plist-get props :rel-width) "96"))
 	    (when (setq props (or (plist-get props :rel-width) "96"))
 	      (insert (format org-odt-table-style-format style-name props))))
 	      (insert (format org-odt-table-style-format style-name props))))
       ;; - Dump date-styles.
       ;; - Dump date-styles.
-      (when org-odt-use-date-fields
+      (when (plist-get info :odt-use-date-fields)
 	(insert (org-odt--build-date-styles (car custom-time-fmts)
 	(insert (org-odt--build-date-styles (car custom-time-fmts)
 					      "OrgDate1")
 					      "OrgDate1")
 		(org-odt--build-date-styles (cdr custom-time-fmts)
 		(org-odt--build-date-styles (cdr custom-time-fmts)
@@ -1494,7 +1494,8 @@ original parsed data.  INFO is a plist holding export options."
 	 (lambda (x)
 	 (lambda (x)
 	   (format
 	   (format
 	    "<text:sequence-decl text:display-outline-level=\"%d\" text:name=\"%s\"/>"
 	    "<text:sequence-decl text:display-outline-level=\"%d\" text:name=\"%s\"/>"
-	    org-odt-display-outline-level (nth 1 x)))
+	    (plist-get info :odt-display-outline-level)
+	    (nth 1 x)))
 	 org-odt-category-map-alist "\n")))
 	 org-odt-category-map-alist "\n")))
       ;; Position the cursor to document body.
       ;; Position the cursor to document body.
       (goto-char (point-min))
       (goto-char (point-min))
@@ -1550,7 +1551,7 @@ original parsed data.  INFO is a plist holding export options."
 	      (concat
 	      (concat
 	       (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
 	       (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
 		       "OrgSubtitle"
 		       "OrgSubtitle"
-		       (if (and org-odt-use-date-fields timestamp)
+		       (if (and (plist-get info :odt-use-date-fields) timestamp)
 			   (org-odt--format-timestamp (car date))
 			   (org-odt--format-timestamp (car date))
 			 (org-export-data (plist-get info :date) info)))
 			 (org-export-data (plist-get info :date) info)))
 	       ;; Separator
 	       ;; Separator
@@ -1635,7 +1636,7 @@ channel."
 CONTENTS holds the contents of the block.  INFO is a plist
 CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
 holding contextual information."
   (let* ((name (org-element-property :drawer-name drawer))
   (let* ((name (org-element-property :drawer-name drawer))
-	 (output (funcall org-odt-format-drawer-function
+	 (output (funcall (plist-get info :odt-format-drawer-function)
 			  name contents)))
 			  name contents)))
     output))
     output))
 
 
@@ -1680,7 +1681,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 (defun org-odt-fixed-width (fixed-width contents info)
 (defun org-odt-fixed-width (fixed-width contents info)
   "Transcode a FIXED-WIDTH element from Org to ODT.
   "Transcode a FIXED-WIDTH element from Org to ODT.
 CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
-  (org-odt-do-format-code (org-element-property :value fixed-width)))
+  (org-odt-do-format-code (org-element-property :value fixed-width) info))
 
 
 
 
 ;;;; Footnote Definition
 ;;;; Footnote Definition
@@ -1756,33 +1757,6 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 
 
 ;;;; Headline
 ;;;; Headline
 
 
-(defun* org-odt-format-headline
-    (todo todo-type priority text tags
-	  &key level section-number headline-label &allow-other-keys)
-  (concat
-   ;; Todo.
-   (when todo
-     (let ((style (if (member todo org-done-keywords) "OrgDone" "OrgTodo")))
-       (format "<text:span text:style-name=\"%s\">%s</text:span> "
-	       style todo)))
-   (when priority
-     (let* ((style (format "OrgPriority-%s" priority))
-	    (priority (format "[#%c]" priority)))
-       (format "<text:span text:style-name=\"%s\">%s</text:span> "
-	       style priority)))
-   ;; Title.
-   text
-   ;; Tags.
-   (when tags
-     (concat
-      "<text:tab/>"
-      (format "<text:span text:style-name=\"%s\">[%s]</text:span>"
-	      "OrgTags" (mapconcat
-			 (lambda (tag)
-			   (format
-			    "<text:span text:style-name=\"%s\">%s</text:span>"
-			    "OrgTag" tag)) tags " : "))))))
-
 (defun org-odt-format-headline--wrap (headline backend info
 (defun org-odt-format-headline--wrap (headline backend info
 					       &optional format-function
 					       &optional format-function
 					       &rest extra-keys)
 					       &rest extra-keys)
@@ -1807,17 +1781,16 @@ INFO is a plist holding contextual information."
 		    (org-export-get-tags headline info)))
 		    (org-export-get-tags headline info)))
 	 (headline-label (concat "sec-" (mapconcat 'number-to-string
 	 (headline-label (concat "sec-" (mapconcat 'number-to-string
 						   headline-number "-")))
 						   headline-number "-")))
-	 (format-function (cond
-			   ((functionp format-function) format-function)
-			   ((not (eq org-odt-format-headline-function 'ignore))
-			    (function*
-			     (lambda (todo todo-type priority text tags
-					   &allow-other-keys)
-			       (funcall org-odt-format-headline-function
-					todo todo-type priority text tags))))
-			   (t 'org-odt-format-headline))))
+	 (format-function
+	  (if (functionp format-function) format-function
+	    (function*
+	     (lambda (todo todo-type priority text tags
+			   &key level section-number headline-label
+			   &allow-other-keys)
+	       (funcall (plist-get info :odt-format-headline-function)
+			todo todo-type priority text tags))))))
     (apply format-function
     (apply format-function
-	   todo todo-type  priority text tags
+	   todo todo-type priority text tags
 	   :headline-label headline-label :level level
 	   :headline-label headline-label :level level
 	   :section-number section-number extra-keys)))
 	   :section-number section-number extra-keys)))
 
 
@@ -1893,6 +1866,33 @@ holding contextual information."
 	  (concat extra-targets anchored-title))
 	  (concat extra-targets anchored-title))
 	 contents))))))
 	 contents))))))
 
 
+(defun org-odt-format-headline-default-function
+  (todo todo-type priority text tags)
+  "Default format function for a headline.
+See `org-odt-format-headline-function' for details."
+  (concat
+   ;; Todo.
+   (when todo
+     (let ((style (if (eq todo-type 'done) "OrgDone" "OrgTodo")))
+       (format "<text:span text:style-name=\"%s\">%s</text:span> " style todo)))
+   (when priority
+     (let* ((style (format "OrgPriority-%s" priority))
+	    (priority (format "[#%c]" priority)))
+       (format "<text:span text:style-name=\"%s\">%s</text:span> "
+	       style priority)))
+   ;; Title.
+   text
+   ;; Tags.
+   (when tags
+     (concat
+      "<text:tab/>"
+      (format "<text:span text:style-name=\"%s\">[%s]</text:span>"
+	      "OrgTags" (mapconcat
+			 (lambda (tag)
+			   (format
+			    "<text:span text:style-name=\"%s\">%s</text:span>"
+			    "OrgTag" tag)) tags " : "))))))
+
 
 
 ;;;; Horizontal Rule
 ;;;; Horizontal Rule
 
 
@@ -1934,29 +1934,33 @@ contextual information."
   "Transcode an INLINETASK element from Org to ODT.
   "Transcode an INLINETASK element from Org to ODT.
 CONTENTS holds the contents of the block.  INFO is a plist
 CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
 holding contextual information."
-  (cond
-   ;; If `org-odt-format-inlinetask-function' is not 'ignore, call it
-   ;; with appropriate arguments.
-   ((not (eq org-odt-format-inlinetask-function 'ignore))
-    (let ((format-function
-	   (function*
-	    (lambda (todo todo-type priority text tags
-		     &key contents &allow-other-keys)
-	      (funcall org-odt-format-inlinetask-function
-		       todo todo-type priority text tags contents)))))
-      (org-odt-format-headline--wrap
-       inlinetask nil info format-function :contents contents)))
-   ;; Otherwise, use a default template.
-   (t
-    (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
-	    "Text_20_body"
-	    (org-odt--textbox
-	     (concat
-	      (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
-		      "OrgInlineTaskHeading"
-		      (org-odt-format-headline--wrap inlinetask nil info))
-	      contents)
-	     nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\"")))))
+  (let* ((todo
+	  (and (plist-get info :with-todo-keywords)
+	       (let ((todo (org-element-property :todo-keyword inlinetask)))
+		 (and todo (org-export-data todo info)))))
+	 (todo-type (and todo (org-element-property :todo-type inlinetask)))
+	 (priority (and (plist-get info :with-priority)
+			(org-element-property :priority inlinetask)))
+	 (text (org-export-data (org-element-property :title inlinetask) info))
+	 (tags (and (plist-get info :with-tags)
+		    (org-export-get-tags inlinetask info))))
+    (funcall (plist-get info :odt-format-inlinetask-function)
+	     todo todo-type priority text tags contents)))
+
+(defun org-odt-format-inlinetask-default-function
+  (todo todo-type priority name tags contents)
+  "Default format function for a inlinetasks.
+See `org-odt-format-inlinetask-function' for details."
+  (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
+	  "Text_20_body"
+	  (org-odt--textbox
+	   (concat
+	    (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
+		    "OrgInlineTaskHeading"
+		    (org-odt-format-headline-default-function
+		     todo todo-type priority name tags))
+	    contents)
+	   nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\"")))
 
 
 ;;;; Italic
 ;;;; Italic
 
 
@@ -2037,7 +2041,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
 CONTENTS is nil.  INFO is a plist holding contextual information."
   (let* ((latex-frag (org-remove-indentation
   (let* ((latex-frag (org-remove-indentation
 		      (org-element-property :value latex-environment))))
 		      (org-element-property :value latex-environment))))
-    (org-odt-do-format-code latex-frag)))
+    (org-odt-do-format-code latex-frag info)))
 
 
 
 
 ;;;; Latex Fragment
 ;;;; Latex Fragment
@@ -2092,7 +2096,9 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 			counter))
 			counter))
 		 info 'first-match)))))
 		 info 'first-match)))))
 	 (scope (funcall --numbered-parent-headline-at-<=-n
 	 (scope (funcall --numbered-parent-headline-at-<=-n
-			 element (or n org-odt-display-outline-level) info))
+			 element
+			 (or n (plist-get info :odt-display-outline-level))
+			 info))
 	 (ordinal (funcall --enumerate element scope info predicate))
 	 (ordinal (funcall --enumerate element scope info predicate))
 	 (tag
 	 (tag
 	  (concat
 	  (concat
@@ -2212,8 +2218,8 @@ SHORT-CAPTION are strings."
     (org-odt-create-manifest-file-entry media-type target-file)
     (org-odt-create-manifest-file-entry media-type target-file)
     target-file))
     target-file))
 
 
-(defun org-odt--image-size (file &optional user-width
-				   user-height scale dpi embed-as)
+(defun org-odt--image-size
+  (file info &optional user-width user-height scale dpi embed-as)
   (let* ((--pixels-to-cms
   (let* ((--pixels-to-cms
 	  (function (lambda (pixels dpi)
 	  (function (lambda (pixels dpi)
 		      (let ((cms-per-inch 2.54)
 		      (let ((cms-per-inch 2.54)
@@ -2225,7 +2231,7 @@ SHORT-CAPTION are strings."
 	     (and size-in-pixels
 	     (and size-in-pixels
 		  (cons (funcall --pixels-to-cms (car size-in-pixels) dpi)
 		  (cons (funcall --pixels-to-cms (car size-in-pixels) dpi)
 			(funcall --pixels-to-cms (cdr size-in-pixels) dpi))))))
 			(funcall --pixels-to-cms (cdr size-in-pixels) dpi))))))
-	 (dpi (or dpi org-odt-pixels-per-inch))
+	 (dpi (or dpi (plist-get info :odt-pixels-per-inch)))
 	 (anchor-type (or embed-as "paragraph"))
 	 (anchor-type (or embed-as "paragraph"))
 	 (user-width (and (not scale) user-width))
 	 (user-width (and (not scale) user-width))
 	 (user-height (and (not scale) user-height))
 	 (user-height (and (not scale) user-height))
@@ -2314,7 +2320,7 @@ used as a communication channel."
 	 ;; Handle `:width', `:height' and `:scale' properties.  Read
 	 ;; Handle `:width', `:height' and `:scale' properties.  Read
 	 ;; them as numbers since we need them for computations.
 	 ;; them as numbers since we need them for computations.
 	 (size (org-odt--image-size
 	 (size (org-odt--image-size
-		src-expanded
+		src-expanded info
 		(let ((width (plist-get attr-plist :width)))
 		(let ((width (plist-get attr-plist :width)))
 		  (and width (read width)))
 		  (and width (read width)))
 		(let ((length (plist-get attr-plist :length)))
 		(let ((length (plist-get attr-plist :length)))
@@ -2343,7 +2349,7 @@ used as a communication channel."
 	 ;; description.  This quite useful for debugging.
 	 ;; description.  This quite useful for debugging.
 	 (desc (and replaces (org-element-property :value replaces))))
 	 (desc (and replaces (org-element-property :value replaces))))
     (org-odt--render-image/formula entity href width height
     (org-odt--render-image/formula entity href width height
-				     captions user-frame-params title desc)))
+				   captions user-frame-params title desc)))
 
 
 
 
 ;;;; Links :: Math formula
 ;;;; Links :: Math formula
@@ -2545,7 +2551,7 @@ used as a communication channel."
    ;; Link should point to an image file.
    ;; Link should point to an image file.
    (lambda (l)
    (lambda (l)
      (assert (eq (org-element-type l) 'link))
      (assert (eq (org-element-type l) 'link))
-     (org-export-inline-image-p l org-odt-inline-image-rules))))
+     (org-export-inline-image-p l (plist-get info :odt-inline-image-rules)))))
 
 
 (defun org-odt--enumerable-latex-image-p (element info)
 (defun org-odt--enumerable-latex-image-p (element info)
   (org-odt--standalone-link-p
   (org-odt--standalone-link-p
@@ -2560,7 +2566,7 @@ used as a communication channel."
    ;; Link should point to an image file.
    ;; Link should point to an image file.
    (lambda (l)
    (lambda (l)
      (assert (eq (org-element-type l) 'link))
      (assert (eq (org-element-type l) 'link))
-     (org-export-inline-image-p l org-odt-inline-image-rules))))
+     (org-export-inline-image-p l (plist-get info :odt-inline-image-rules)))))
 
 
 (defun org-odt--enumerable-formula-p (element info)
 (defun org-odt--enumerable-formula-p (element info)
   (org-odt--standalone-link-p
   (org-odt--standalone-link-p
@@ -2572,7 +2578,7 @@ used as a communication channel."
    ;; Link should point to a MathML or ODF file.
    ;; Link should point to a MathML or ODF file.
    (lambda (l)
    (lambda (l)
      (assert (eq (org-element-type l) 'link))
      (assert (eq (org-element-type l) 'link))
-     (org-export-inline-image-p l org-odt-inline-formula-rules))))
+     (org-export-inline-image-p l (plist-get info :odt-inline-formula-rules)))))
 
 
 (defun org-odt--standalone-link-p (element info &optional
 (defun org-odt--standalone-link-p (element info &optional
 					     paragraph-predicate
 					     paragraph-predicate
@@ -2712,7 +2718,7 @@ INFO is a plist holding contextual information.  See
 	 ;; Ensure DESC really exists, or set it to nil.
 	 ;; Ensure DESC really exists, or set it to nil.
 	 (desc (and (not (string= desc "")) desc))
 	 (desc (and (not (string= desc "")) desc))
 	 (imagep (org-export-inline-image-p
 	 (imagep (org-export-inline-image-p
-		  link org-odt-inline-image-rules))
+		  link (plist-get info :odt-inline-image-rules)))
 	 (path (cond
 	 (path (cond
 		((member type '("http" "https" "ftp" "mailto"))
 		((member type '("http" "https" "ftp" "mailto"))
 		 (concat type ":" raw-path))
 		 (concat type ":" raw-path))
@@ -2725,11 +2731,11 @@ INFO is a plist holding contextual information.  See
     (cond
     (cond
      ;; Image file.
      ;; Image file.
      ((and (not desc) (org-export-inline-image-p
      ((and (not desc) (org-export-inline-image-p
-		       link org-odt-inline-image-rules))
+		       link (plist-get info :odt-inline-image-rules)))
       (org-odt-link--inline-image link info))
       (org-odt-link--inline-image link info))
      ;; Formula file.
      ;; Formula file.
      ((and (not desc) (org-export-inline-image-p
      ((and (not desc) (org-export-inline-image-p
-		       link org-odt-inline-formula-rules))
+		       link (plist-get info :odt-inline-formula-rules)))
       (org-odt-link--inline-formula link info))
       (org-odt-link--inline-formula link info))
      ;; Radio target: Transcode target's contents and use them as
      ;; Radio target: Transcode target's contents and use them as
      ;; link's description.
      ;; link's description.
@@ -2817,7 +2823,8 @@ INFO is a plist holding contextual information.  See
 		 (let ((desc-element (car link-contents)))
 		 (let ((desc-element (car link-contents)))
 		   (and (eq (org-element-type desc-element) 'link)
 		   (and (eq (org-element-type desc-element) 'link)
 			(org-export-inline-image-p
 			(org-export-inline-image-p
-			 desc-element org-odt-inline-image-rules))))
+			 desc-element
+			 (plist-get info :odt-inline-image-rules)))))
 	    ;; Format link as a clickable image.
 	    ;; Format link as a clickable image.
 	    (format "\n<draw:a xlink:type=\"simple\" xlink:href=\"%s\">\n%s\n</draw:a>"
 	    (format "\n<draw:a xlink:type=\"simple\" xlink:href=\"%s\">\n%s\n</draw:a>"
 		    path desc)
 		    path desc)
@@ -3133,13 +3140,13 @@ and prefix with \"OrgSrc\".  For example,
     (org-no-warnings (htmlfontify-string line))))
     (org-no-warnings (htmlfontify-string line))))
 
 
 (defun org-odt-do-format-code
 (defun org-odt-do-format-code
-  (code &optional lang refs retain-labels num-start)
+  (code info &optional lang refs retain-labels num-start)
   (let* ((lang (or (assoc-default lang org-src-lang-modes) lang))
   (let* ((lang (or (assoc-default lang org-src-lang-modes) lang))
 	 (lang-mode (and lang (intern (format "%s-mode" lang))))
 	 (lang-mode (and lang (intern (format "%s-mode" lang))))
 	 (code-lines (org-split-string code "\n"))
 	 (code-lines (org-split-string code "\n"))
 	 (code-length (length code-lines))
 	 (code-length (length code-lines))
 	 (use-htmlfontify-p (and (functionp lang-mode)
 	 (use-htmlfontify-p (and (functionp lang-mode)
-				 org-odt-fontify-srcblocks
+				 (plist-get info :odt-fontify-srcblocks)
 				 (require 'htmlfontify nil t)
 				 (require 'htmlfontify nil t)
 				 (fboundp 'htmlfontify-string)))
 				 (fboundp 'htmlfontify-string)))
 	 (code (if (not use-htmlfontify-p) code
 	 (code (if (not use-htmlfontify-p) code
@@ -3194,7 +3201,7 @@ and prefix with \"OrgSrc\".  For example,
 	 (num-start (case (org-element-property :number-lines element)
 	 (num-start (case (org-element-property :number-lines element)
 		      (continued (org-export-get-loc element info))
 		      (continued (org-export-get-loc element info))
 		      (new 0))))
 		      (new 0))))
-    (org-odt-do-format-code code lang refs retain-labels num-start)))
+    (org-odt-do-format-code code info lang refs retain-labels num-start)))
 
 
 (defun org-odt-src-block (src-block contents info)
 (defun org-odt-src-block (src-block contents info)
   "Transcode a SRC-BLOCK element from Org to ODT.
   "Transcode a SRC-BLOCK element from Org to ODT.
@@ -3261,13 +3268,13 @@ contextual information."
   (let* ((table (org-export-get-parent-table element))
   (let* ((table (org-export-get-parent-table element))
 	 (table-attributes (org-export-read-attribute :attr_odt table))
 	 (table-attributes (org-export-read-attribute :attr_odt table))
 	 (table-style (plist-get table-attributes :style)))
 	 (table-style (plist-get table-attributes :style)))
-    (assoc table-style org-odt-table-styles)))
+    (assoc table-style (plist-get info :odt-table-styles))))
 
 
 (defun org-odt-get-table-cell-styles (table-cell info)
 (defun org-odt-get-table-cell-styles (table-cell info)
   "Retrieve styles applicable to a table cell.
   "Retrieve styles applicable to a table cell.
 R and C are (zero-based) row and column numbers of the table
 R and C are (zero-based) row and column numbers of the table
 cell.  STYLE-SPEC is an entry in `org-odt-table-styles'
 cell.  STYLE-SPEC is an entry in `org-odt-table-styles'
-applicable to the current table.  It is `nil' if the table is not
+applicable to the current table.  It is nil if the table is not
 associated with any style attributes.
 associated with any style attributes.
 
 
 Return a cons of (TABLE-CELL-STYLE-NAME . PARAGRAPH-STYLE-NAME).
 Return a cons of (TABLE-CELL-STYLE-NAME . PARAGRAPH-STYLE-NAME).
@@ -3656,8 +3663,8 @@ information."
 CONTENTS is nil.  INFO is a plist used as a communication
 CONTENTS is nil.  INFO is a plist used as a communication
 channel."
 channel."
   (let* ((raw-value (org-element-property :raw-value timestamp))
   (let* ((raw-value (org-element-property :raw-value timestamp))
-  	 (type (org-element-property :type timestamp)))
-    (if (not org-odt-use-date-fields)
+	 (type (org-element-property :type timestamp)))
+    (if (not (plist-get info :odt-use-date-fields))
 	(let ((value (org-odt-plain-text
 	(let ((value (org-odt-plain-text
 		      (org-timestamp-translate timestamp) info)))
 		      (org-timestamp-translate timestamp) info)))
 	  (case (org-element-property :type timestamp)
 	  (case (org-element-property :type timestamp)
@@ -3693,7 +3700,7 @@ channel."
 	 (format "<text:span text:style-name=\"%s\">%s</text:span>"
 	 (format "<text:span text:style-name=\"%s\">%s</text:span>"
 		 "OrgDiaryTimestamp"
 		 "OrgDiaryTimestamp"
 		 (org-odt-plain-text (org-timestamp-translate timestamp)
 		 (org-odt-plain-text (org-timestamp-translate timestamp)
-				       info)))))))
+				     info)))))))
 
 
 
 
 ;;;; Underline
 ;;;; Underline