0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-22 00:48:37 +00:00

Docbook exporter: Fix problems with exporting footnotes and empty lines

Patch by Baoqiu Cui
This commit is contained in:
Carsten Dominik 2010-03-08 19:43:34 +01:00
parent 6518396b4e
commit 9900348e88
3 changed files with 26 additions and 8 deletions

View file

@ -1,5 +1,14 @@
2010-03-08 Carsten Dominik <carsten.dominik@gmail.com> 2010-03-08 Carsten Dominik <carsten.dominik@gmail.com>
* 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 * org.el (org-deadline, org-schedule): Allow rescheduling entries
with repeaters. with repeaters.

View file

@ -624,7 +624,7 @@ publishing directory."
;; End of quote section? ;; End of quote section?
(when (and inquote (string-match "^\\*+ " line)) (when (and inquote (string-match "^\\*+ " line))
(insert "]]>\n</programlisting>\n") (insert "]]></programlisting>\n")
(org-export-docbook-open-para) (org-export-docbook-open-para)
(setq inquote nil)) (setq inquote nil))
;; Inside a quote section? ;; Inside a quote section?
@ -644,7 +644,7 @@ publishing directory."
(not (string-match "^[ \t]*\\(:.*\\)" (not (string-match "^[ \t]*\\(:.*\\)"
(car lines)))) (car lines))))
(setq infixed nil) (setq infixed nil)
(insert "]]>\n</programlisting>\n") (insert "]]></programlisting>\n")
(org-export-docbook-open-para)) (org-export-docbook-open-para))
(throw 'nextline nil)) (throw 'nextline nil))
@ -912,7 +912,8 @@ publishing directory."
(while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
(if (get-text-property (match-beginning 2) 'org-protected line) (if (get-text-property (match-beginning 2) 'org-protected line)
(setq start (match-end 2)) (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) (if (assoc num footref-seen)
(setq line (replace-match (setq line (replace-match
(format "%s<footnoteref linkend=\"%s%s\"/>" (format "%s<footnoteref linkend=\"%s%s\"/>"
@ -924,9 +925,10 @@ publishing directory."
(match-string 1 line) (match-string 1 line)
org-export-docbook-footnote-id-prefix org-export-docbook-footnote-id-prefix
num num
(save-match-data (if footnote-def
(org-docbook-expand (save-match-data
(cdr (assoc num footnote-list))))) (org-docbook-expand (cdr footnote-def)))
(format "FOOTNOTE DEFINITION NOT FOUND: %s" num)))
t t line)) t t line))
(push (cons num 1) footref-seen)))))) (push (cons num 1) footref-seen))))))
@ -1092,7 +1094,7 @@ publishing directory."
;; Properly close all local lists and other lists ;; Properly close all local lists and other lists
(when inquote (when inquote
(insert "]]>\n</programlisting>\n") (insert "]]></programlisting>\n")
(org-export-docbook-open-para)) (org-export-docbook-open-para))
(when in-local-list (when in-local-list
;; Close any local lists before inserting a new header line ;; Close any local lists before inserting a new header line
@ -1121,6 +1123,13 @@ publishing directory."
"[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t) "[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
(when (not (get-text-property (match-beginning 1) 'org-protected)) (when (not (get-text-property (match-beginning 1) 'org-protected))
(replace-match "\n") (replace-match "\n")
;; Avoid empty <listitem></listitem> caused by inline tasks.
;; We should add an empty para to make everything valid.
(when (and (looking-at "</listitem>")
(save-excursion
(backward-char (length "<listitem>\n"))
(looking-at "<listitem>")))
(insert "<para></para>"))
(backward-char 1))) (backward-char 1)))
;; Fill empty sections with <para></para>. This is to make sure ;; Fill empty sections with <para></para>. This is to make sure
;; that the DocBook document generated is valid and well-formed. ;; that the DocBook document generated is valid and well-formed.

View file

@ -2423,7 +2423,7 @@ INDENT was the original indentation of the block."
(concat "\n#+BEGIN_DOCBOOK\n" (concat "\n#+BEGIN_DOCBOOK\n"
(org-add-props (concat "<programlisting><![CDATA[" (org-add-props (concat "<programlisting><![CDATA["
rtn rtn
"]]>\n</programlisting>\n") "]]></programlisting>\n")
'(org-protected t)) '(org-protected t))
"#+END_DOCBOOK\n")) "#+END_DOCBOOK\n"))
((eq backend 'html) ((eq backend 'html)