From ff99056baf2e09244ce24676539e12af6b8eb9a0 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Sat, 10 Dec 2011 20:39:07 +0530 Subject: [PATCH] Makefile (PKG_FILES) : Include etc/ Also fix all byte-compiler warnings in org-lparse.el and org-odt.el. --- Makefile | 3 +- etc/styles/COPYRIGHT-AND-LICENSE | 2 +- lisp/org-lparse.el | 26 ++++++++------ lisp/org-odt.el | 76 +++++++++++++++++++++++----------------- 4 files changed, 62 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index d6b9d34ad..b624291ae 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,8 @@ PKG_FILES = $(LISPFILES0) \ doc/orgguide.pdf \ doc/orgcard.tex \ doc/orgcard.pdf \ - doc/orgcard_letter.pdf + doc/orgcard_letter.pdf \ + etc/ .SUFFIXES: .el .elc .texi SHELL = /bin/sh diff --git a/etc/styles/COPYRIGHT-AND-LICENSE b/etc/styles/COPYRIGHT-AND-LICENSE index 8ad9ba2eb..e4438bb84 100644 --- a/etc/styles/COPYRIGHT-AND-LICENSE +++ b/etc/styles/COPYRIGHT-AND-LICENSE @@ -1,7 +1,7 @@ OrgOdtContentTemplate.xml --- Aux XML file (Org-mode's OpenDocument export) OrgOdtStyles.xml --- Aux XML file (Org-mode's OpenDocument export) -Copyright (C) 2010-2011 Jambunathan +Copyright (C) 2010-2011 Free Software Foundation, Inc. Author: Jambunathan K Keywords: outlines, hypermedia, calendar, wp diff --git a/lisp/org-lparse.el b/lisp/org-lparse.el index fadcbdf1f..8c98ea767 100755 --- a/lisp/org-lparse.el +++ b/lisp/org-lparse.el @@ -1,6 +1,6 @@ ;;; org-lparse.el --- Line-oriented parser-exporter for Org-mode -;; Copyright (C) 2010-2011 Jambunathan +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Jambunathan K ;; Keywords: outlines, hypermedia, calendar, wp @@ -49,9 +49,11 @@ ;; FAQs and more information on using this library. ;;; Code: - +(eval-when-compile + (require 'cl)) (require 'org-exp) (require 'org-list) +(require 'format-spec) ;;;###autoload (defun org-lparse-and-open (target-backend native-backend arg @@ -244,9 +246,10 @@ OPT-PLIST is the export options list." ;; The link protocol has a function for format the link (setq rpl (save-match-data (funcall fnc (org-link-unescape path) - desc1 (case org-lparse-backend - (xhtml 'html) - (t org-lparse-backend)))))) + desc1 (and (boundp 'org-lparse-backend) + (case org-lparse-backend + (xhtml 'html) + (t org-lparse-backend))))))) ((string= type "file") ;; FILE link (save-match-data @@ -471,6 +474,9 @@ This is a helper routine for interactive use." in-fmt)))) (list in-file out-fmt))) +(eval-when-compile + (require 'browse-url)) + (defun org-lparse-do-convert (in-file out-fmt &optional prefix-arg) "Workhorse routine for `org-export-odt-convert'." (require 'browse-url) @@ -1797,17 +1803,15 @@ Stripping happens only when the exported backend is not one of (case style (list-table (setq org-lparse-list-table-p t)) - (t - (setq org-lparse-dyn-current-environment style) - (org-lparse-begin 'ENVIRONMENT style env-options-plist)))) + (t (setq org-lparse-dyn-current-environment style) + (org-lparse-begin 'ENVIRONMENT style env-options-plist)))) (defun org-lparse-end-environment (style &optional env-options-plist) (case style (list-table (setq org-lparse-list-table-p nil)) - (t - (org-lparse-end 'ENVIRONMENT style env-options-plist) - (setq org-lparse-dyn-current-environment nil)))) + (t (org-lparse-end 'ENVIRONMENT style env-options-plist) + (setq org-lparse-dyn-current-environment nil)))) (defun org-lparse-current-environment-p (style) (eq org-lparse-dyn-current-environment style)) diff --git a/lisp/org-odt.el b/lisp/org-odt.el index 6f8ea8e3b..553965cd3 100644 --- a/lisp/org-odt.el +++ b/lisp/org-odt.el @@ -1,6 +1,6 @@ ;;; org-odt.el --- OpenDocumentText export for Org-mode -;; Copyright (C) 2010-2011 Jambunathan +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Jambunathan K ;; Keywords: outlines, hypermedia, calendar, wp @@ -26,7 +26,9 @@ ;;; Commentary: ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile + (require 'cl) + (require 'htmlfontify)) (require 'org-lparse) (defgroup org-export-odt nil @@ -73,13 +75,23 @@ (defconst org-odt-lib-dir (file-name-directory load-file-name)) (defconst org-odt-styles-dir - (let ((styles-dir (expand-file-name "../etc/styles/" org-odt-lib-dir))) - (prog1 styles-dir - (unless (and (file-readable-p (expand-file-name - "OrgOdtContentTemplate.xml" styles-dir)) - (file-readable-p (expand-file-name - "OrgOdtStyles.xml" styles-dir))) - (error "Cannot find factory styles file. Check package dir layout")))) + (let* ((styles-dir1 (expand-file-name "../etc/styles/" org-odt-lib-dir)) + (styles-dir2 (expand-file-name "./etc/styles/" org-odt-lib-dir)) + (styles-dir + (catch 'styles-dir + (mapc (lambda (styles-dir) + (when (and (file-readable-p + (expand-file-name + "OrgOdtContentTemplate.xml" styles-dir)) + (file-readable-p + (expand-file-name + "OrgOdtStyles.xml" styles-dir))) + (throw 'styles-dir styles-dir))) + (list styles-dir1 styles-dir2)) + nil))) + (unless styles-dir + (error "Cannot find factory styles file. Check package dir layout")) + styles-dir) "Directory that holds auxiliary XML files used by the ODT exporter. This directory contains the following XML files - @@ -98,9 +110,7 @@ This directory contains the following XML files - (file-readable-p (expand-file-name "schemas.xml" schema-dir))) schema-dir - (prog1 nil - (message "Unable to locate OpenDocument schema files.") - (message "These files may be needed for enhanced debugging.")))) + (prog1 nil (message "Unable to locate OpenDocument schema files.")))) "Directory that contains OpenDocument schema files. This directory contains rnc files for OpenDocument schema. It @@ -254,6 +264,24 @@ a per-file basis. For example, :type 'float :group 'org-export-odt) +(defcustom org-export-odt-create-custom-styles-for-srcblocks t + "Whether custom styles for colorized source blocks be automatically created. +When this option is turned on, the exporter creates custom styles +for source blocks based on the advice of `htmlfontify'. Creation +of custom styles happen as part of `org-odt-hfy-face-to-css'. + +When this option is turned off exporter does not create such +styles. + +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 +styles.xml already contains needed styles for colorizing to work. + +This variable is effective only if +`org-export-odt-fontify-srcblocks' is turned on." + :group 'org-export-odt + :type 'boolean) + (defvar org-export-odt-default-org-styles-alist '((paragraph . ((default . "Text_20_body") (fixedwidth . "OrgFixedWidthBlock") @@ -1136,24 +1164,6 @@ and prefix with \"OrgSrc\". For example, " style-name color-val)))))) (cons style-name style))) -(defcustom org-export-odt-create-custom-styles-for-srcblocks t - "Whether custom styles for colorized source blocks be automatically created. -When this option is turned on, the exporter creates custom styles -for source blocks based on the advice of `htmlfontify'. Creation -of custom styles happen as part of `org-odt-hfy-face-to-css'. - -When this option is turned off exporter does not create such -styles. - -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 -styles.xml already contains needed styles for colorizing to work. - -This variable is effective only if -`org-export-odt-fontify-srcblocks' is turned on." - :group 'org-export-odt - :type 'boolean) - (defun org-odt-insert-custom-styles-for-srcblocks (styles) "Save STYLES used for colorizing of source blocks. Update styles.xml with styles that were collected as part of @@ -1867,6 +1877,7 @@ CATEGORY-HANDLE is used. See (suffix (when org-lparse-encode-pending "@"))) (apply 'org-lparse-format-tags tag text prefix suffix args))) +(defvar org-odt-manifest-file-entries nil) (defun org-odt-init-outfile (filename) (unless (executable-find "zip") ;; Not at all OSes ship with zip by default @@ -1972,8 +1983,6 @@ visually." " ") -(defvar org-odt-manifest-file-entries nil) - (defun org-odt-create-manifest-file-entry (&rest args) (push args org-odt-manifest-file-entries)) @@ -2197,6 +2206,9 @@ configuration." :value-type (group (string :tag "Output file extension"))))))) +(declare-function org-create-math-formula "org" + (latex-frag &optional mathml-file)) + ;;;###autoload (defun org-export-odt-convert (&optional in-file out-fmt prefix-arg) "Convert IN-FILE to format OUT-FMT using a command line converter. -- 2.11.4.GIT