From 52fbfeb04b10aa78f24f339a352fe1161c0b37e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Sun, 13 Jul 2014 13:35:31 +0200 Subject: Imported Upstream version 8.2.4 --- lisp/ox-odt.el | 91 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 44 insertions(+), 47 deletions(-) (limited to 'lisp/ox-odt.el') diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index ae9e473..975dbdb 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -223,7 +223,7 @@ standard Emacs.") (defconst org-odt-table-style-format " - + " "Template for auto-generated Table styles.") @@ -449,7 +449,7 @@ under `org-odt-styles-dir' is used." :type '(choice (const nil) (file)) :group 'org-export-odt - :version "24.1") + :version "24.3") (defcustom org-odt-styles-file nil "Default styles file for use with ODT export. @@ -498,7 +498,8 @@ a per-file basis. For example, (defcustom org-odt-display-outline-level 2 "Outline levels considered for enumerating captioned entities." :group 'org-export-odt - :version "24.2" + :version "24.4" + :package-version '(Org . "8.0") :type 'integer) ;;;; Document conversion @@ -596,7 +597,7 @@ INPUT-FMT-LIST in to a single class. Note that this variable inherently captures how LibreOffice based converters work. LibreOffice maps documents of various formats to classes like Text, Web, Spreadsheet, Presentation etc and -allow document of a given class (irrespective of it's source +allow document of a given class (irrespective of its source format) to be converted to any of the export formats associated with that class. @@ -645,7 +646,8 @@ values. See Info node `(emacs) File Variables'." ;;;; Drawers -(defcustom org-odt-format-drawer-function nil +(defcustom org-odt-format-drawer-function + (lambda (name contents) contents) "Function called to format a drawer in ODT code. The function must accept two parameters: @@ -654,21 +656,16 @@ The function must accept two parameters: The function should return the string to be exported. -For example, the variable could be set to the following function -in order to mimic default behaviour: - -\(defun org-odt-format-drawer-default \(name contents\) - \"Format a drawer element for ODT export.\" - contents\)" +The default value simply returns the value of CONTENTS." :group 'org-export-odt :version "24.4" - :package-version '(Org . "8.0") + :package-version '(Org . "8.3") :type 'function) ;;;; Headline -(defcustom org-odt-format-headline-function nil +(defcustom org-odt-format-headline-function 'ignore "Function to format headline text. This function will be called with 5 arguments: @@ -687,7 +684,7 @@ The function result will be used as headline text." ;;;; Inlinetasks -(defcustom org-odt-format-inlinetask-function nil +(defcustom org-odt-format-inlinetask-function 'ignore "Function called to format an inlinetask in ODT code. The function must accept six parameters: @@ -746,6 +743,8 @@ A rule consists in an association whose key is the type of link to consider, and value is a regexp that will be matched against link's path." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type '(alist :key-type (string :tag "Type") :value-type (regexp :tag "Path"))) @@ -757,6 +756,8 @@ A rule consists in an association whose key is the type of link to consider, and value is a regexp that will be matched against link's path." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type '(alist :key-type (string :tag "Type") :value-type (regexp :tag "Path"))) @@ -919,7 +920,7 @@ Specifically, locale-dependent specifiers like \"%c\", \"%x\" are formatted as canonical Org timestamps. For finer control, avoid these %-specifiers. -Textutal specifiers like \"%b\", \"%h\", \"%B\", \"%a\", \"%A\" +Textual specifiers like \"%b\", \"%h\", \"%B\", \"%a\", \"%A\" etc., are displayed by the application in the default language and country specified in `org-odt-styles-file'. Note that the default styles file uses language \"en\" and country \"GB\". You @@ -929,6 +930,8 @@ the application UI or through a custom styles file. See `org-odt--build-date-styles' for implementation details." :group 'org-export-odt + :version "24.4" + :package-version '(Org . "8.0") :type 'boolean) @@ -1436,7 +1439,7 @@ original parsed data. INFO is a plist holding export options." ;; Update content.xml. (let* ( ;; `org-display-custom-times' should be accessed right - ;; within the context of the Org buffer. So obtain it's + ;; within the context of the Org buffer. So obtain its ;; value before moving on to temp-buffer context down below. (custom-time-fmts (if org-display-custom-times @@ -1456,7 +1459,7 @@ original parsed data. INFO is a plist holding export options." ;; - Dump automatic table styles. (loop for (style-name props) in (plist-get org-odt-automatic-styles 'Table) do - (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)))) ;; - Dump date-styles. (when org-odt-use-date-fields @@ -1619,12 +1622,8 @@ channel." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (let* ((name (org-element-property :drawer-name drawer)) - (output (if (functionp org-odt-format-drawer-function) - (funcall org-odt-format-drawer-function - name contents) - ;; If there's no user defined function: simply - ;; display contents of the drawer. - contents))) + (output (funcall org-odt-format-drawer-function + name contents))) output)) @@ -1721,7 +1720,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (and (eq (org-element-type prev) 'footnote-reference) (format "%s" "OrgSuperscript" ","))) - ;; Trancode footnote reference. + ;; Transcode footnote reference. (let ((n (org-export-get-footnote-number footnote-reference info))) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -1805,10 +1804,10 @@ INFO is a plist holding contextual information." headline-number "-"))) (format-function (cond ((functionp format-function) format-function) - ((functionp org-odt-format-headline-function) + ((not (eq org-odt-format-headline-function 'ignore)) (function* (lambda (todo todo-type priority text tags - &allow-other-keys) + &allow-other-keys) (funcall org-odt-format-headline-function todo todo-type priority text tags)))) (t 'org-odt-format-headline)))) @@ -1931,9 +1930,9 @@ contextual information." CONTENTS holds the contents of the block. INFO is a plist holding contextual information." (cond - ;; If `org-odt-format-inlinetask-function' is provided, call it + ;; If `org-odt-format-inlinetask-function' is not 'ignore, call it ;; with appropriate arguments. - ((functionp org-odt-format-inlinetask-function) + ((not (eq org-odt-format-inlinetask-function 'ignore)) (let ((format-function (function* (lambda (todo todo-type priority text tags @@ -2058,7 +2057,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (defun org-odt-line-break (line-break contents info) "Transcode a LINE-BREAK object from Org to ODT. CONTENTS is nil. INFO is a plist holding contextual information." - "\n") + "") ;;;; Link @@ -2195,7 +2194,7 @@ SHORT-CAPTION are strings." (concat ;; Sneak in a bookmark. The bookmark is used when the ;; labeled element is referenced with a link that - ;; provides it's own description. + ;; provides its own description. (format "\n" label) ;; Label definition: Typically formatted as below: ;; CATEGORY SEQ-NO: LONG CAPTION @@ -2342,7 +2341,6 @@ used as a communication channel." (user-frame-params (list user-frame-style user-frame-attrs user-frame-anchor)) ;; (embed-as (or embed-as user-frame-anchor "paragraph")) - ;; extrac ;; ;; Handle `:width', `:height' and `:scale' properties. Read ;; them as numbers since we need them for computations. @@ -2372,7 +2370,7 @@ used as a communication channel." (title (and replaces (capitalize (symbol-name (org-element-type replaces))))) - ;; If yes, note down it's contents. It will go in to frame + ;; If yes, note down its contents. It will go in to frame ;; description. This quite useful for debugging. (desc (and replaces (org-element-property :value replaces)))) (org-odt--render-image/formula entity href width height @@ -2410,7 +2408,7 @@ used as a communication channel." (title (and replaces (capitalize (symbol-name (org-element-type replaces))))) - ;; If yes, note down it's contents. It will go in to frame + ;; If yes, note down its contents. It will go in to frame ;; description. This quite useful for debugging. (desc (and replaces (org-element-property :value replaces))) width height) @@ -2614,12 +2612,12 @@ used as a communication channel." INFO is a plist holding contextual information. Return non-nil, if ELEMENT is of type paragraph satisfying -PARAGRAPH-PREDICATE and it's sole content, save for whitespaces, +PARAGRAPH-PREDICATE and its sole content, save for whitespaces, is a link that satisfies LINK-PREDICATE. Return non-nil, if ELEMENT is of type link satisfying -LINK-PREDICATE and it's containing paragraph satisfies -PARAGRAPH-PREDICATE inaddtion to having no other content save for +LINK-PREDICATE and its containing paragraph satisfies +PARAGRAPH-PREDICATE in addition to having no other content save for leading and trailing whitespaces. Return nil, otherwise." @@ -2708,7 +2706,7 @@ Return nil, otherwise." (concat (number-to-string n) "."))) item-numbers ""))))) ;; Case 2: Locate a regular and numbered headline in the - ;; hierarchy. Display it's section number. + ;; hierarchy. Display its section number. (let ((headline (loop for el in (cons destination genealogy) when (and (eq (org-element-type el) 'headline) (not (org-export-low-level-p el info)) @@ -2721,7 +2719,7 @@ Return nil, otherwise." (mapconcat 'number-to-string (org-export-get-headline-number headline info) ".")))) ;; Case 4: Locate a regular headline in the hierarchy. Display - ;; it's title. + ;; its title. (let ((headline (loop for el in (cons destination genealogy) when (and (eq (org-element-type el) 'headline) (not (org-export-low-level-p el info))) @@ -2967,7 +2965,7 @@ contextual information." ;; Handle break preservation if required. (when (plist-get info :preserve-breaks) (setq output (replace-regexp-in-string - "\\(\\\\\\\\\\)?[ \t]*\n" "\n" output t))) + "\\(\\\\\\\\\\)?[ \t]*\n" "" output t))) ;; Return value. output)) @@ -3101,9 +3099,9 @@ holding contextual information." (defun org-odt-hfy-face-to-css (fn) "Create custom style for face FN. -When FN is the default face, use it's foreground and background +When FN is the default face, use its foreground and background properties to create \"OrgSrcBlock\" paragraph style. Otherwise -use it's color attribute to create a character style whose name +use its color attribute to create a character style whose name is obtained from FN. Currently all attributes of FN other than color are ignored. @@ -3113,12 +3111,11 @@ and prefix with \"OrgSrc\". For example, `font-lock-function-name-face' is associated with \"OrgSrcFontLockFunctionNameFace\"." (let* ((css-list (hfy-face-to-style fn)) - (style-name ((lambda (fn) - (concat "OrgSrc" - (mapconcat - 'capitalize (split-string - (hfy-face-or-def-to-name fn) "-") - ""))) fn)) + (style-name (concat "OrgSrc" + (mapconcat + 'capitalize (split-string + (hfy-face-or-def-to-name fn) "-") + ""))) (color-val (cdr (assoc "color" css-list))) (background-color-val (cdr (assoc "background" css-list))) (style (and org-odt-create-custom-styles-for-srcblocks -- cgit v1.2.3