ox-odt: Prevent internal links to target table of contents

* lisp/ox-odt.el (org-odt-toc): Ignore targets, links and footnote
  references from table of contents.

Reported-by: dbitouze@wanadoo.fr (Denis Bitouzé)
<http://permalink.gmane.org/gmane.emacs.orgmode/101040>
This commit is contained in:
Nicolas Goaziou 2015-09-18 23:58:51 +02:00
parent 823cadafa6
commit c290921a0d
1 changed files with 6 additions and 5 deletions

View File

@ -1175,14 +1175,15 @@ table of contents as a string, or nil."
;; /TOC/, as otherwise there will be duplicated anchors one in TOC
;; and one in the document body.
;;
;; FIXME: Are there any other objects that need to be suppressed
;; within TOC?
;; Likewise, links, footnote references and regular targets are also
;; suppressed.
(let* ((headlines (org-export-collect-headlines info depth scope))
(backend (org-export-create-backend
:parent (org-export-backend-name (plist-get info :back-end))
:transcoders (mapcar
(lambda (type) (cons type (lambda (d c i) c)))
(list 'radio-target)))))
:transcoders '((footnote-reference . ignore)
(link . (lambda (object c i) c))
(radio-target . (lambda (object c i) c))
(target . ignore)))))
(when headlines
(org-odt--format-toc
(and (not scope) (org-export-translate "Table of Contents" :utf-8 info))