mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-12 09:28:11 +00:00
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
This commit is contained in:
parent
d2986be076
commit
ea529007d7
@ -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))
|
||||
|
@ -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))))
|
||||
|
Loading…
Reference in New Issue
Block a user