[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org ea529007d7 1/4: ox-html: Fix links to targets that
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org ea529007d7 1/4: ox-html: Fix links to targets that do not have a number |
Date: |
Thu, 25 Jan 2024 09:58:20 -0500 (EST) |
branch: externals/org
commit ea529007d7c61d0ced48b4f56ff183640b29314e
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
ox-html: Fix links to targets that do not have a number
* lisp/ox.el (org-export-get-ordinal): Return nil when ELEMENT does
not match PREDICATE. `ox-html-link' expects this behavior when a link
refers to target that does not have a caption.
* testing/lisp/test-ox.el (test-org-export/get-ordinal): Fix tests.
Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/7bf1f79071a714750634e76130fe5963@posteo.net
---
lisp/ox.el | 5 ++++-
testing/lisp/test-ox.el | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 744977b802..0ff8458933 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4795,7 +4795,10 @@ objects of the same type."
(lambda (el)
(let ((cached (org-element-property :org-export--counter el)))
(cond
- ((eq element el) (1+ counter))
+ ((and (eq element el)
+ (or (not predicate)
+ (funcall predicate el info)))
+ (1+ counter))
;; Use cached result.
((and cached
(equal predicate (car cached))
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 63babe8cdf..01e082c9bf 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -445,12 +445,12 @@ Paragraph"
(should (= 1 (org-export-get-ordinal table info)))
(should (= 2 (org-export-get-ordinal table info '(section))))
(should (= 1 (org-export-get-ordinal table info nil
#'org-ascii--has-caption-p)))
- (should (= 1 (org-export-get-ordinal table info nil
from-third))))
+ (should-not (org-export-get-ordinal table info nil
from-third)))
("Should be Table 2"
(should (= 2 (org-export-get-ordinal table info)))
(should (= 3 (org-export-get-ordinal table info '(section))))
(should (= 2 (org-export-get-ordinal table info nil
#'org-ascii--has-caption-p)))
- (should (= 1 (org-export-get-ordinal table info nil
from-third))))
+ (should-not (org-export-get-ordinal table info nil
from-third)))
("Should be Table 3"
(should (= 3 (org-export-get-ordinal table info)))
(should (= 4 (org-export-get-ordinal table info '(section))))