Browse Source

Makefile (PKG_FILES) : Include etc/

Also fix all byte-compiler warnings in org-lparse.el and org-odt.el.
Jambunathan K 13 years ago
parent
commit
ff99056baf
4 changed files with 62 additions and 45 deletions
  1. 2 1
      Makefile
  2. 1 1
      etc/styles/COPYRIGHT-AND-LICENSE
  3. 15 11
      lisp/org-lparse.el
  4. 44 32
      lisp/org-odt.el

+ 2 - 1
Makefile

@@ -188,7 +188,8 @@ PKG_FILES = $(LISPFILES0)		\
             doc/orgguide.pdf		\
             doc/orgguide.pdf		\
             doc/orgcard.tex		\
             doc/orgcard.tex		\
             doc/orgcard.pdf		\
             doc/orgcard.pdf		\
-            doc/orgcard_letter.pdf
+            doc/orgcard_letter.pdf	\
+            etc/
 
 
 .SUFFIXES: .el .elc .texi
 .SUFFIXES: .el .elc .texi
 SHELL = /bin/sh
 SHELL = /bin/sh

+ 1 - 1
etc/styles/COPYRIGHT-AND-LICENSE

@@ -1,7 +1,7 @@
 OrgOdtContentTemplate.xml --- Aux XML file (Org-mode's OpenDocument export)
 OrgOdtContentTemplate.xml --- Aux XML file (Org-mode's OpenDocument export)
 OrgOdtStyles.xml	  --- Aux XML file (Org-mode's OpenDocument export)
 OrgOdtStyles.xml	  --- Aux XML file (Org-mode's OpenDocument export)
 
 
-Copyright (C) 2010-2011 Jambunathan <kjambunathan at gmail dot com>
+Copyright (C) 2010-2011 Free Software Foundation, Inc.
 
 
 Author: Jambunathan K <kjambunathan at gmail dot com>
 Author: Jambunathan K <kjambunathan at gmail dot com>
 Keywords: outlines, hypermedia, calendar, wp
 Keywords: outlines, hypermedia, calendar, wp

+ 15 - 11
lisp/org-lparse.el

@@ -1,6 +1,6 @@
 ;;; org-lparse.el --- Line-oriented parser-exporter for Org-mode
 ;;; org-lparse.el --- Line-oriented parser-exporter for Org-mode
 
 
-;; Copyright (C) 2010-2011 Jambunathan <kjambunathan at gmail dot com>
+;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
 
 
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -49,9 +49,11 @@
 ;; FAQs and more information on using this library.
 ;; FAQs and more information on using this library.
 
 
 ;;; Code:
 ;;; Code:
-
+(eval-when-compile
+  (require 'cl))
 (require 'org-exp)
 (require 'org-exp)
 (require 'org-list)
 (require 'org-list)
+(require 'format-spec)
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-lparse-and-open (target-backend native-backend arg
 (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
 	;; The link protocol has a function for format the link
 	(setq rpl (save-match-data
 	(setq rpl (save-match-data
 		    (funcall fnc (org-link-unescape path)
 		    (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")
        ((string= type "file")
 	;; FILE link
 	;; FILE link
 	(save-match-data
 	(save-match-data
@@ -471,6 +474,9 @@ This is a helper routine for interactive use."
 	       in-fmt))))
 	       in-fmt))))
     (list in-file out-fmt)))
     (list in-file out-fmt)))
 
 
+(eval-when-compile
+  (require 'browse-url))
+
 (defun org-lparse-do-convert (in-file out-fmt &optional prefix-arg)
 (defun org-lparse-do-convert (in-file out-fmt &optional prefix-arg)
   "Workhorse routine for `org-export-odt-convert'."
   "Workhorse routine for `org-export-odt-convert'."
   (require 'browse-url)
   (require 'browse-url)
@@ -1797,17 +1803,15 @@ Stripping happens only when the exported backend is not one of
   (case style
   (case style
     (list-table
     (list-table
      (setq org-lparse-list-table-p t))
      (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)
 (defun org-lparse-end-environment (style &optional env-options-plist)
   (case style
   (case style
     (list-table
     (list-table
      (setq org-lparse-list-table-p nil))
      (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)
 (defun org-lparse-current-environment-p (style)
   (eq org-lparse-dyn-current-environment style))
   (eq org-lparse-dyn-current-environment style))

+ 44 - 32
lisp/org-odt.el

@@ -1,6 +1,6 @@
 ;;; org-odt.el --- OpenDocumentText export for Org-mode
 ;;; org-odt.el --- OpenDocumentText export for Org-mode
 
 
-;; Copyright (C) 2010-2011 Jambunathan <kjambunathan at gmail dot com>
+;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
 
 
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -26,7 +26,9 @@
 ;;; Commentary:
 ;;; Commentary:
 
 
 ;;; Code:
 ;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile
+  (require 'cl)
+  (require 'htmlfontify))
 (require 'org-lparse)
 (require 'org-lparse)
 
 
 (defgroup org-export-odt nil
 (defgroup org-export-odt nil
@@ -73,13 +75,23 @@
 
 
 (defconst org-odt-lib-dir (file-name-directory load-file-name))
 (defconst org-odt-lib-dir (file-name-directory load-file-name))
 (defconst org-odt-styles-dir
 (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.
   "Directory that holds auxiliary XML files used by the ODT exporter.
 
 
 This directory contains the following XML files -
 This directory contains the following XML files -
@@ -98,9 +110,7 @@ This directory contains the following XML files -
 	     (file-readable-p
 	     (file-readable-p
 	      (expand-file-name "schemas.xml" schema-dir)))
 	      (expand-file-name "schemas.xml" schema-dir)))
 	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.
   "Directory that contains OpenDocument schema files.
 
 
 This directory contains rnc files for OpenDocument schema.  It
 This directory contains rnc files for OpenDocument schema.  It
@@ -254,6 +264,24 @@ a per-file basis.  For example,
   :type 'float
   :type 'float
   :group 'org-export-odt)
   :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
 (defvar org-export-odt-default-org-styles-alist
   '((paragraph . ((default . "Text_20_body")
   '((paragraph . ((default . "Text_20_body")
 		  (fixedwidth . "OrgFixedWidthBlock")
 		  (fixedwidth . "OrgFixedWidthBlock")
@@ -1136,24 +1164,6 @@ and prefix with \"OrgSrc\".  For example,
  </style:style>" style-name color-val))))))
  </style:style>" style-name color-val))))))
     (cons style-name style)))
     (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)
 (defun org-odt-insert-custom-styles-for-srcblocks (styles)
   "Save STYLES used for colorizing of source blocks.
   "Save STYLES used for colorizing of source blocks.
 Update styles.xml with styles that were collected as part of
 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 "@")))
 	(suffix (when org-lparse-encode-pending "@")))
     (apply 'org-lparse-format-tags tag text prefix suffix args)))
     (apply 'org-lparse-format-tags tag text prefix suffix args)))
 
 
+(defvar org-odt-manifest-file-entries nil)
 (defun org-odt-init-outfile (filename)
 (defun org-odt-init-outfile (filename)
   (unless (executable-find "zip")
   (unless (executable-find "zip")
     ;; Not at all OSes ship with zip by default
     ;; Not at all OSes ship with zip by default
@@ -1972,8 +1983,6 @@ visually."
   "
   "
 <manifest:file-entry manifest:media-type=\"%s\" manifest:full-path=\"%s\"%s/>")
 <manifest:file-entry manifest:media-type=\"%s\" manifest:full-path=\"%s\"%s/>")
 
 
-(defvar org-odt-manifest-file-entries nil)
-
 (defun org-odt-create-manifest-file-entry (&rest args)
 (defun org-odt-create-manifest-file-entry (&rest args)
   (push args org-odt-manifest-file-entries))
   (push args org-odt-manifest-file-entries))
 
 
@@ -2197,6 +2206,9 @@ configuration."
 			 :value-type
 			 :value-type
 			 (group (string :tag "Output file extension")))))))
 			 (group (string :tag "Output file extension")))))))
 
 
+(declare-function org-create-math-formula "org"
+		  (latex-frag &optional mathml-file))
+
 ;;;###autoload
 ;;;###autoload
 (defun org-export-odt-convert (&optional in-file out-fmt prefix-arg)
 (defun org-export-odt-convert (&optional in-file out-fmt prefix-arg)
   "Convert IN-FILE to format OUT-FMT using a command line converter.
   "Convert IN-FILE to format OUT-FMT using a command line converter.