From 488a2e378caf5d3ab917814d969ab8efee0b0632 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Mon, 12 Sep 2011 17:19:14 +0530 Subject: [PATCH] Replace OrgOdtAutomaticStyles.xml with OrgOdtContentTemplate.xml * contrib/odt/styles/OrgOdtAutomaticStyles.xml: Removed * contrib/odt/styles/OrgOdtContentTemplate.xml: Added. This file is now a fully-formed "content.xml" file but with "empty" content. Note that the original "OrgOdtAutomaticStyles.xml" was just an xml fragment. * contrib/lisp/org-odt.el (org-odt-document-content-header): Removed. (org-export-odt-automatic-styles-file): Removed. (org-export-odt-content-template-file): Renamed from `org-export-odt-automatic-styles-file'. (org-odt-data-dir): Update docstring. (org-odt-begin-office-body, org-odt-begin-document-content): Modified to accomodate changes introduced by the new "OrgOdtContentTemplate.xml" file. --- contrib/lisp/org-odt.el | 74 ++++------------- contrib/odt/styles/OrgOdtContentTemplate.xml | 118 +++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 56 deletions(-) create mode 100644 contrib/odt/styles/OrgOdtContentTemplate.xml diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index 53bd99372..da3fbd571 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -76,9 +76,9 @@ "Directory that holds auxiliary files used by the ODT exporter. The 'styles' subdir contains the following xml files - - 'OrgOdtStyles.xml' and 'OrgOdtAutomaticStyles.xml' - which are + 'OrgOdtStyles.xml' and 'OrgOdtContentTemplate.xml' - which are used as factory settings of `org-export-odt-styles-file' and - `org-export-odt-automatic-styles-file'. + `org-export-odt-content-template-file'. The 'etc/schema' subdir contains rnc files for validating of OpenDocument xml files.") @@ -148,9 +148,13 @@ OpenDocument xml files.") 'org-export-odt-preprocess-latex-fragments) nil) -(defcustom org-export-odt-automatic-styles-file nil - "Automatic styles for use with ODT exporter. -If unspecified, the file under `org-odt-data-dir' is used." +(defcustom org-export-odt-content-template-file nil + "Template file for \"content.xml\". +The exporter embeds the exported content just before +\"\" element. + +If unspecified, the file named \"OrgOdtContentTemplate.xml\" +under `org-odt-data-dir' is used." :type 'file :group 'org-export-odt) @@ -428,16 +432,14 @@ PUB-DIR is set, use this as the publishing directory." ;;;_. control callbacks ;;;_ , document body (defun org-odt-begin-office-body () - (insert " - - - - - - - - - ")) + ;; automatic styles + (insert-file-contents + (or org-export-odt-content-template-file + (expand-file-name "styles/OrgOdtContentTemplate.xml" + org-odt-data-dir))) + (goto-char (point-min)) + (re-search-forward "" nil nil) + (delete-region (match-beginning 0) (point-max))) ;; Following variable is let bound when `org-do-lparse' is in ;; progress. See org-html.el. @@ -460,48 +462,8 @@ PUB-DIR is set, use this as the publishing directory." (org-lparse-insert-tag "") (org-lparse-insert-tag ""))) -(defconst org-odt-document-content-header - " - -") - (defun org-odt-begin-document-content (opt-plist) - ;; document header - (insert org-odt-document-content-header) - - ;; automatic styles - (insert-file-contents - (or org-export-odt-automatic-styles-file - (expand-file-name "styles/OrgOdtAutomaticStyles.xml" - org-odt-data-dir))) - (goto-char (point-max))) + (ignore)) (defun org-odt-end-document-content () (org-lparse-insert-tag "")) diff --git a/contrib/odt/styles/OrgOdtContentTemplate.xml b/contrib/odt/styles/OrgOdtContentTemplate.xml new file mode 100644 index 000000000..980f2646d --- /dev/null +++ b/contrib/odt/styles/OrgOdtContentTemplate.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.11.4.GIT