From 9900348e880c3d06109808cb9028ece319e843f4 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 8 Mar 2010 19:43:34 +0100 Subject: [PATCH] Docbook exporter: Fix problems with exporting footnotes and empty lines Patch by Baoqiu Cui --- lisp/ChangeLog | 9 +++++++++ lisp/org-docbook.el | 23 ++++++++++++++++------- lisp/org-exp.el | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c02c7e58a..e72bf6250 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,14 @@ 2010-03-08 Carsten Dominik + * org-docbook.el (org-export-as-docbook): Remove unnecessary + newline. + (org-export-as-docbook): Remove unnecessary newline. + (org-export-as-docbook): Fix problem with double footnote + reference in one place. + + * org-exp.el (org-export-format-source-code-or-example): Remove + unnecessary newline. + * org.el (org-deadline, org-schedule): Allow rescheduling entries with repeaters. diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index ab0a08629..492a6601a 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -624,7 +624,7 @@ publishing directory." ;; End of quote section? (when (and inquote (string-match "^\\*+ " line)) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para) (setq inquote nil)) ;; Inside a quote section? @@ -644,7 +644,7 @@ publishing directory." (not (string-match "^[ \t]*\\(:.*\\)" (car lines)))) (setq infixed nil) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (throw 'nextline nil)) @@ -912,7 +912,8 @@ publishing directory." (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) (if (get-text-property (match-beginning 2) 'org-protected line) (setq start (match-end 2)) - (let ((num (match-string 2 line))) + (let* ((num (match-string 2 line)) + (footnote-def (assoc num footnote-list))) (if (assoc num footref-seen) (setq line (replace-match (format "%s" @@ -924,9 +925,10 @@ publishing directory." (match-string 1 line) org-export-docbook-footnote-id-prefix num - (save-match-data - (org-docbook-expand - (cdr (assoc num footnote-list))))) + (if footnote-def + (save-match-data + (org-docbook-expand (cdr footnote-def))) + (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) t t line)) (push (cons num 1) footref-seen)))))) @@ -1092,7 +1094,7 @@ publishing directory." ;; Properly close all local lists and other lists (when inquote - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (when in-local-list ;; Close any local lists before inserting a new header line @@ -1121,6 +1123,13 @@ publishing directory." "[ \r\n\t]*\\(\\)[ \r\n\t]*[ \r\n\t]*" nil t) (when (not (get-text-property (match-beginning 1) 'org-protected)) (replace-match "\n") + ;; Avoid empty caused by inline tasks. + ;; We should add an empty para to make everything valid. + (when (and (looking-at "") + (save-excursion + (backward-char (length "\n")) + (looking-at ""))) + (insert "")) (backward-char 1))) ;; Fill empty sections with . This is to make sure ;; that the DocBook document generated is valid and well-formed. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index f20b511a2..91feb3cb6 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2423,7 +2423,7 @@ INDENT was the original indentation of the block." (concat "\n#+BEGIN_DOCBOOK\n" (org-add-props (concat "\n\n") + "]]>\n") '(org-protected t)) "#+END_DOCBOOK\n")) ((eq backend 'html)