forked from mirrors/org-mode
Allow radio links after an apostrophe and mid-word
* lisp/org.el (org-make-target-link-regexp): Allow radio links after an apostrophe and mid-word. Small refactoring. * testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add test. See http://permalink.gmane.org/gmane.emacs.orgmode/84108.
This commit is contained in:
parent
bebb7597a7
commit
1c1936fbb1
18
lisp/org.el
18
lisp/org.el
|
@ -6179,17 +6179,13 @@ targets."
|
|||
The regular expression finds the targets also if there is a line break
|
||||
between words."
|
||||
(and targets
|
||||
(concat
|
||||
"\\_<\\("
|
||||
(mapconcat
|
||||
(lambda (x)
|
||||
(setq x (regexp-quote x))
|
||||
(while (string-match " +" x)
|
||||
(setq x (replace-match "\\s-+" t t x)))
|
||||
x)
|
||||
targets
|
||||
"\\|")
|
||||
"\\)\\_>")))
|
||||
(concat "\\("
|
||||
(mapconcat
|
||||
(lambda (x)
|
||||
(replace-regexp-in-string " +" "\\s-+" (regexp-quote x) t t))
|
||||
targets
|
||||
"\\|")
|
||||
"\\)")))
|
||||
|
||||
(defun org-activate-tags (limit)
|
||||
(if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t)
|
||||
|
|
|
@ -2042,6 +2042,15 @@ Another text. (ref:text)
|
|||
(org-export-resolve-radio-link
|
||||
(org-element-map tree 'link 'identity info t)
|
||||
info))))
|
||||
;; Radio link next to an apostrophe.
|
||||
(should
|
||||
(org-test-with-temp-text "<<<radio>>> radio's"
|
||||
(org-update-radio-target-regexp)
|
||||
(let* ((tree (org-element-parse-buffer))
|
||||
(info `(:parse-tree ,tree)))
|
||||
(org-export-resolve-radio-link
|
||||
(org-element-map tree 'link 'identity info t)
|
||||
info))))
|
||||
;; Multiple radio targets.
|
||||
(should
|
||||
(equal '("radio1" "radio2")
|
||||
|
|
Loading…
Reference in a new issue