forked from mirrors/org-mode
ox: Ignore whitespace differences when resolving a radio link
* lisp/ox.el (org-export-resolve-radio-link): Ignore whitespace differences when resolving a radio link. * testing/lisp/test-ox.el: Add test.
This commit is contained in:
parent
e7cd6f1875
commit
48e51fe5d9
|
@ -4079,11 +4079,14 @@ INFO is a plist used as a communication channel.
|
||||||
|
|
||||||
Return value can be a radio-target object or nil. Assume LINK
|
Return value can be a radio-target object or nil. Assume LINK
|
||||||
has type \"radio\"."
|
has type \"radio\"."
|
||||||
(let ((path (org-element-property :path link)))
|
(let ((path (replace-regexp-in-string
|
||||||
|
"[ \r\t\n]+" " " (org-element-property :path link))))
|
||||||
(org-element-map (plist-get info :parse-tree) 'radio-target
|
(org-element-map (plist-get info :parse-tree) 'radio-target
|
||||||
(lambda (radio)
|
(lambda (radio)
|
||||||
(and (eq (compare-strings
|
(and (eq (compare-strings
|
||||||
(org-element-property :value radio) 0 nil path 0 nil t)
|
(replace-regexp-in-string
|
||||||
|
"[ \r\t\n]+" " " (org-element-property :value radio))
|
||||||
|
nil nil path nil nil t)
|
||||||
t)
|
t)
|
||||||
radio))
|
radio))
|
||||||
info 'first-match)))
|
info 'first-match)))
|
||||||
|
|
|
@ -1719,7 +1719,15 @@ Another text. (ref:text)
|
||||||
(lambda (link)
|
(lambda (link)
|
||||||
(org-element-property
|
(org-element-property
|
||||||
:value (org-export-resolve-radio-link link info)))
|
:value (org-export-resolve-radio-link link info)))
|
||||||
info))))))
|
info)))))
|
||||||
|
;; Radio target is whitespace insensitive.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "<<<a radio>>> a\n radio"
|
||||||
|
(org-update-radio-target-regexp)
|
||||||
|
(let* ((tree (org-element-parse-buffer))
|
||||||
|
(info `(:parse-tree ,tree)))
|
||||||
|
(org-element-map tree 'link
|
||||||
|
(lambda (link) (org-export-resolve-radio-link link info)) info t)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue