Skip to content

Commit 4631790

Browse files
committed
ox-ascii: Fix export with broken links
* lisp/ox-ascii.el (org-ascii--describe-links): Skip broken links.
1 parent c779b7a commit 4631790

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lisp/ox-ascii.el

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,12 +948,17 @@ channel."
948948
(when description
949949
(let ((dest (if (equal type "fuzzy")
950950
(org-export-resolve-fuzzy-link link info)
951-
(org-export-resolve-id-link link info))))
952-
(concat
953-
(org-ascii--fill-string
954-
(format "[%s] %s" anchor (org-ascii--describe-datum dest info))
955-
width info)
956-
"\n\n"))))
951+
;; Ignore broken links. On broken link,
952+
;; `org-export-resolve-id-link' will throw an
953+
;; error and `ignore-error' will return nil.
954+
(ignore-error 'org-link-broken
955+
(org-export-resolve-id-link link info)))))
956+
(when dest
957+
(concat
958+
(org-ascii--fill-string
959+
(format "[%s] %s" anchor (org-ascii--describe-datum dest info))
960+
width info)
961+
"\n\n")))))
957962
;; Do not add a link that cannot be resolved and doesn't have
958963
;; any description: destination is already visible in the
959964
;; paragraph.

0 commit comments

Comments
 (0)