ox: Fix radio target resolution

* lisp/ox.el (org-export-resolve-radio-link): Fix radio target
  resolution.
* testing/lisp/test-ox.el: Add test.
This commit is contained in:
Nicolas Goaziou 2013-05-12 17:49:51 +02:00
parent 7d37898371
commit e7cd6f1875
2 changed files with 16 additions and 3 deletions

View File

@ -4082,8 +4082,9 @@ has type \"radio\"."
(let ((path (org-element-property :path link)))
(org-element-map (plist-get info :parse-tree) 'radio-target
(lambda (radio)
(and (compare-strings
(org-element-property :value radio) 0 nil path 0 nil t)
(and (eq (compare-strings
(org-element-property :value radio) 0 nil path 0 nil t)
t)
radio))
info 'first-match)))

View File

@ -1707,7 +1707,19 @@ Another text. (ref:text)
(info `(:parse-tree ,tree)))
(org-export-resolve-radio-link
(org-element-map tree 'link 'identity info t)
info)))))
info))))
;; Multiple radio targets.
(should
(equal '("radio1" "radio2")
(org-test-with-temp-text "<<<radio1>>> <<<radio2>>> radio1 radio2"
(org-update-radio-target-regexp)
(let* ((tree (org-element-parse-buffer))
(info `(:parse-tree ,tree)))
(org-element-map tree 'link
(lambda (link)
(org-element-property
:value (org-export-resolve-radio-link link info)))
info))))))