From 4631790fb90cc46bc205ccbf53689ced3fa33f0a Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 23 Jul 2022 14:07:20 +0800 Subject: [PATCH] ox-ascii: Fix export with broken links * lisp/ox-ascii.el (org-ascii--describe-links): Skip broken links. --- lisp/ox-ascii.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 38b2a5772..88a75a815 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -948,12 +948,17 @@ channel." (when description (let ((dest (if (equal type "fuzzy") (org-export-resolve-fuzzy-link link info) - (org-export-resolve-id-link link info)))) - (concat - (org-ascii--fill-string - (format "[%s] %s" anchor (org-ascii--describe-datum dest info)) - width info) - "\n\n")))) + ;; Ignore broken links. On broken link, + ;; `org-export-resolve-id-link' will throw an + ;; error and `ignore-error' will return nil. + (ignore-error 'org-link-broken + (org-export-resolve-id-link link info))))) + (when dest + (concat + (org-ascii--fill-string + (format "[%s] %s" anchor (org-ascii--describe-datum dest info)) + width info) + "\n\n"))))) ;; Do not add a link that cannot be resolved and doesn't have ;; any description: destination is already visible in the ;; paragraph.