With #+OPTIONS: broken-links:t I could still get the 'Unable to resolve link; aborting: "4b133a7a-a81c-44d4-9bea-8e1c72ed5847"' in spite of all the work related to #587 -- if that broken link was in one of the org-id-location files.
Expected Behavior
With #+OPTIONS: broken-links:t an ox-hugo export should ignore any broken links, and run to completion.
Prposed fix
It looks like the handling of the org-link-broken signal was only on the fuzzy-type link. When I change the code like the diff below to broaden the org-link-broken handling to span all link types (note that I've only moved the link type check to inside the condition-case), I am able to export successfully.
This could have been an oversight be the original implementor?
diff -u /Users/charlbotha/.emacs.d/elpa/ox-hugo-20221028.1631/ox-hugo.el.orig /Users/charlbotha/.emacs.d/elpa/ox-hugo-20221028.1631/ox-hugo.el
--- /Users/charlbotha/.emacs.d/elpa/ox-hugo-20221028.1631/ox-hugo.el.orig 2023-06-29 14:34:42
+++ /Users/charlbotha/.emacs.d/elpa/ox-hugo-20221028.1631/ox-hugo.el 2023-06-29 21:02:53
@@ -4619,25 +4619,25 @@
(let ((type (org-element-property :type el)))
(when (member type '("custom-id" "id" "fuzzy"))
(let* ((raw-link (org-element-property :raw-link el))
- (destination (if (string= type "fuzzy")
- (progn
- ;; Derived from ox.el -> `org-export-data'. If a broken link is seen
- ;; and if `broken-links' option is not nil, ignore the error.
- (condition-case err
- (org-export-resolve-fuzzy-link el info)
- (org-link-broken
- (unless (or (plist-get info :with-broken-links)
- ;; Parse the `:EXPORT_OPTIONS' property if set
- ;; in a parent heading.
- (plist-get
- (org-export--parse-option-keyword
- (or (cdr (org-hugo--get-elem-with-prop
- :EXPORT_OPTIONS
- (org-element-property :begin el)))
- ""))
- :with-broken-links))
- (user-error "Unable to resolve link: %S" (nth 1 err))))))
- (org-export-resolve-id-link el (org-export--collect-tree-properties ast info))))
+ (destination
+ ;; Derived from ox.el -> `org-export-data'. If a broken link is seen
+ ;; and if `broken-links' option is not nil, ignore the error.
+ (condition-case err
+ (if (string= type "fuzzy")
+ (org-export-resolve-fuzzy-link el info)
+ (org-export-resolve-id-link el (org-export--collect-tree-properties ast info)))
+ (org-link-broken
+ (unless (or (plist-get info :with-broken-links)
+ ;; Parse the `:EXPORT_OPTIONS' property if set
+ ;; in a parent heading.
+ (plist-get
+ (org-export--parse-option-keyword
+ (or (cdr (org-hugo--get-elem-with-prop
+ :EXPORT_OPTIONS
+ (org-element-property :begin el)))
+ ""))
+ :with-broken-links))
+ (user-error "Unable to resolve link: %S" (nth 1 err))))))
(source-path (org-hugo--heading-get-slug el info :inherit-export-file-name))
(destination-path (org-hugo--heading-get-slug destination info :inherit-export-file-name))
(destination-type (org-element-type destination)))
Diff finished. Thu Jun 29 21:04:21 2023
Actual Behavior
With
#+OPTIONS: broken-links:t
I could still get the 'Unable to resolve link; aborting: "4b133a7a-a81c-44d4-9bea-8e1c72ed5847"' in spite of all the work related to #587 -- if that broken link was in one of the org-id-location files.Expected Behavior
With
#+OPTIONS: broken-links:t
an ox-hugo export should ignore any broken links, and run to completion.Prposed fix
It looks like the handling of the
org-link-broken
signal was only on the fuzzy-type link. When I change the code like the diff below to broaden theorg-link-broken
handling to span all link types (note that I've only moved the link type check to inside thecondition-case
), I am able to export successfully.This could have been an oversight be the original implementor?
Ox-Hugo Debug Information
Backtrace: