Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broaden org-link-broken handling over id and fuzzy #724

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions ox-hugo.el
Original file line number Diff line number Diff line change
Expand Up @@ -4619,25 +4619,25 @@ links."
(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)))
Expand Down