summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-03-25 10:15:25 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2014-03-25 10:21:26 +0100
commit1c1936fbb1f0c42e5c7e1d3c903626aa5993a357 (patch)
tree6b22347ad8e9e7da2583e6e88096d303ef8d6291
parentbebb7597a79df0c1d93cafcc6cccfacddd40d6be (diff)
downloadorg-mode-1c1936fbb1f0c42e5c7e1d3c903626aa5993a357.tar.gz
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.
-rw-r--r--lisp/org.el18
-rw-r--r--testing/lisp/test-ox.el9
2 files changed, 16 insertions, 11 deletions
diff --git a/lisp/org.el b/lisp/org.el
index ef0bc3f..a1b9b0b 100644
--- a/lisp/org.el
+++ b/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)
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index b0778ff..fe20496 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -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")