Просмотр исходного кода

Add a new option #+ODT_STYLES_FILE:...

* contrib/lisp/org-odt.el: Introduce a new option
"#+ODT_STYLES_FILE: ..." for per-file setting of
`org-export-odt-styles-file'.
(org-export-odt-styles-file): Mention above option in
docstring.
(org-odt-save-as-outfile): Honor above option.
Jambunathan K 14 лет назад
Родитель
Сommit
757453b98e
1 измененных файлов с 14 добавлено и 2 удалено
  1. 14 2
      contrib/lisp/org-odt.el

+ 14 - 2
contrib/lisp/org-odt.el

@@ -184,7 +184,13 @@ FILE-MEMBERS.
 Use options 1, 2 or 3 only if styles.xml alone suffices for
 Use options 1, 2 or 3 only if styles.xml alone suffices for
 achieving the desired formatting.  Use option 4, if the styles.xml
 achieving the desired formatting.  Use option 4, if the styles.xml
 references additional files like header and footer images for
 references additional files like header and footer images for
-achieving the desired formattting."
+achieving the desired formattting.
+
+Use \"#+ODT_STYLES_FILE: ...\" directive to set this variable on
+a per-file basis.  For example,
+
+#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
+#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
   :group 'org-export-odt
   :group 'org-export-odt
   :type
   :type
   '(choice
   '(choice
@@ -197,6 +203,10 @@ achieving the desired formattting."
 		(file :tag "	Member" "styles.xml")
 		(file :tag "	Member" "styles.xml")
 		(repeat (file :tag "Member"))))))
 		(repeat (file :tag "Member"))))))
 
 
+(eval-after-load 'org-exp
+  '(add-to-list 'org-export-inbuffer-options-extra
+		'("ODT_STYLES_FILE" :odt-styles-file)))
+
 (defconst org-export-odt-tmpdir-prefix "odt-")
 (defconst org-export-odt-tmpdir-prefix "odt-")
 (defconst org-export-odt-bookmark-prefix "OrgXref.")
 (defconst org-export-odt-bookmark-prefix "OrgXref.")
 (defcustom org-export-odt-use-bookmarks-for-internal-links t
 (defcustom org-export-odt-use-bookmarks-for-internal-links t
@@ -1751,7 +1761,9 @@ visually."
   (org-odt-update-meta-file opt-plist)
   (org-odt-update-meta-file opt-plist)
 
 
   ;; write styles file
   ;; write styles file
-  (org-odt-copy-styles-file)
+  (let ((styles-file (plist-get opt-plist :odt-styles-file)))
+    (org-odt-copy-styles-file (and styles-file
+				   (read (org-trim styles-file)))))
 
 
   ;; Update styles.xml - take care of outline numbering
   ;; Update styles.xml - take care of outline numbering
   (with-current-buffer
   (with-current-buffer