summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-03-24 14:20:23 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2014-03-24 14:20:23 +0100
commit230d09aeb0a9914ed1c5e377b0b84b7064370c6d (patch)
treec761a1c074b31e6b3f1e1db733417b581ba84079
parent09ee2336efd053b06dfc116379167b4ccd04387e (diff)
parent2e79bd8119a0c8ec1141873706b04aa6fe3d932f (diff)
downloadorg-mode-230d09aeb0a9914ed1c5e377b0b84b7064370c6d.tar.gz
Merge branch 'maint'
-rw-r--r--contrib/lisp/ox-groff.el3
-rw-r--r--lisp/org-element.el19
-rw-r--r--lisp/org.el12
-rw-r--r--lisp/ox-ascii.el5
-rw-r--r--lisp/ox-beamer.el5
-rw-r--r--lisp/ox-html.el6
-rw-r--r--lisp/ox-latex.el5
-rw-r--r--lisp/ox-md.el4
-rw-r--r--lisp/ox-odt.el10
-rw-r--r--testing/lisp/test-org-element.el15
-rw-r--r--testing/lisp/test-ox.el9
11 files changed, 57 insertions, 36 deletions
diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el
index f74bb14..f1f0dd1 100644
--- a/contrib/lisp/ox-groff.el
+++ b/contrib/lisp/ox-groff.el
@@ -1274,7 +1274,8 @@ INFO is a plist holding contextual information. See
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "\\fI [%s] \\fP"
- (org-export-solidify-link-text path)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))))))
;; Links pointing to a headline: find destination and build
;; appropriate referencing command.
diff --git a/lisp/org-element.el b/lisp/org-element.el
index e2aee7c..fa11251 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -187,10 +187,10 @@ is not sufficient to know if point is at a paragraph ending. See
"List of recursive element types aka Greater Elements.")
(defconst org-element-all-successors
- '(export-snippet footnote-reference inline-babel-call inline-src-block
- latex-or-entity line-break link macro plain-link radio-target
- statistics-cookie sub/superscript table-cell target
- text-markup timestamp)
+ '(link export-snippet footnote-reference inline-babel-call
+ inline-src-block latex-or-entity line-break macro plain-link
+ radio-target statistics-cookie sub/superscript table-cell target
+ text-markup timestamp)
"Complete list of successors.")
(defconst org-element-object-successor-alist
@@ -328,13 +328,13 @@ Don't modify it, set `org-element-affiliated-keywords' instead.")
(paragraph ,@standard-set)
;; Remove any variable object from radio target as it would
;; prevent it from being properly recognized.
- (radio-target latex-or-entity sub/superscript)
+ (radio-target latex-or-entity sub/superscript text-markup)
(strike-through ,@standard-set)
(subscript ,@standard-set)
(superscript ,@standard-set)
;; Ignore inline babel call and inline src block as formulas are
;; possible. Also ignore line breaks and statistics cookies.
- (table-cell export-snippet footnote-reference latex-or-entity link macro
+ (table-cell link export-snippet footnote-reference latex-or-entity macro
radio-target sub/superscript target text-markup timestamp)
(table-row table-cell)
(underline ,@standard-set)
@@ -346,7 +346,8 @@ a list of successors that will be called within an element or
object of such type.
For example, in a `radio-target' object, one can only find
-entities, latex-fragments, subscript and superscript.
+entities, latex-fragments, subscript, superscript and text
+markup.
This alist also applies to secondary string. For example, an
`headline' type element doesn't directly contain objects, but
@@ -3060,7 +3061,9 @@ Assume point is at the beginning of the link."
((and org-target-link-regexp (looking-at org-target-link-regexp))
(setq type "radio"
link-end (match-end 0)
- path (org-match-string-no-properties 0)))
+ path (org-match-string-no-properties 0)
+ contents-begin (match-beginning 0)
+ contents-end (match-end 0)))
;; Type 2: Standard link, i.e. [[http://orgmode.org][homepage]]
((looking-at org-bracket-link-regexp)
(setq contents-begin (match-beginning 3)
diff --git a/lisp/org.el b/lisp/org.el
index 2608fc8..727f646 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5417,6 +5417,8 @@ The following commands are available:
;; Modify a few syntax entries
(modify-syntax-entry ?@ "w")
(modify-syntax-entry ?\" "\"")
+ (modify-syntax-entry ?\\ "_")
+ (modify-syntax-entry ?~ "_")
(if org-startup-truncated (setq truncate-lines t))
(when org-startup-indented (require 'org-indent) (org-indent-mode 1))
(org-set-local 'font-lock-unfontify-region-function
@@ -6178,7 +6180,7 @@ 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))
@@ -6187,7 +6189,7 @@ between words."
x)
targets
"\\|")
- "\\)\\>")))
+ "\\)\\_>")))
(defun org-activate-tags (limit)
(if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t)
@@ -20392,13 +20394,15 @@ This command does many different things, depending on context:
;; When at a link, act according to the parent instead.
(link (setq context (org-element-property :parent context))
(setq type (org-element-type context)))
- ;; Unsupported object types: check parent element instead.
+ ;; Unsupported object types: refer to the first supported
+ ;; element or object containing it.
((bold code entity export-snippet inline-babel-call inline-src-block
italic latex-fragment line-break macro strike-through subscript
superscript underline verbatim)
(while (and (setq context (org-element-property :parent context))
(not (memq (setq type (org-element-type context))
- '(paragraph verse-block table-cell)))))))
+ '(radio-target paragraph verse-block
+ table-cell)))))))
;; For convenience: at the first line of a paragraph on the
;; same line as an item, apply function on that item instead.
(when (eq type 'paragraph)
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index 2c62bb8..3207acf 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -1388,10 +1388,7 @@ INFO is a plist holding contextual information."
(org-export-resolve-coderef ref info))))
;; Do not apply a special syntax on radio links. Though, use
;; transcoded target's contents as output.
- ((string= type "radio")
- (let ((destination (org-export-resolve-radio-link link info)))
- (when destination
- (org-export-data (org-element-contents destination) info))))
+ ((string= type "radio") desc)
;; Do not apply a special syntax on fuzzy links pointing to
;; targets.
((string= type "fuzzy")
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 569a775..02c0c49 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -689,8 +689,9 @@ used as a communication channel."
(when destination
(format "\\hyperlink%s{%s}{%s}"
(or (org-beamer--element-has-overlay-p link) "")
- (org-export-solidify-link-text path)
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ contents))))
((and (member type '("custom-id" "fuzzy" "id"))
(let ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index ce2b26c..52795a3 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2775,9 +2775,9 @@ INFO is a plist holding contextual information. See
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "<a href=\"#%s\"%s>%s</a>"
- (org-export-solidify-link-text path)
- attributes
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ attributes desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ecbba1e..4616574 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1902,8 +1902,9 @@ INFO is a plist holding contextual information. See
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "\\hyperref[%s]{%s}"
- (org-export-solidify-link-text path)
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index b8316dd..b69733c 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -329,9 +329,7 @@ a communication channel."
(let ((ref (org-element-property :path link)))
(format (org-export-get-coderef-format ref contents)
(org-export-resolve-coderef ref info))))
- ((equal type "radio")
- (let ((destination (org-export-resolve-radio-link link info)))
- (org-export-data (org-element-contents destination) info)))
+ ((equal type "radio") contents)
((equal type "fuzzy")
(let ((destination (org-export-resolve-fuzzy-link link info)))
(if (org-string-nw-p contents) contents
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 9b28168..48f0f92 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2735,11 +2735,11 @@ INFO is a plist holding contextual information. See
((string= type "radio")
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
- (let ((desc (org-export-data (org-element-contents destination) info))
- (href (org-export-solidify-link-text path)))
- (format
- "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
- href desc)))))
+ (format
+ "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 650ac06..def1659 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1687,12 +1687,19 @@ Outside list"
"Test `radio-target' parser."
;; Standard test.
(should
- (org-test-with-temp-text "<<<radio>>>"
- (org-element-map (org-element-parse-buffer) 'radio-target 'identity)))
+ (eq 'radio-target
+ (org-test-with-temp-text "<<<radio>>>"
+ (org-element-type (org-element-context)))))
;; Radio targets with objects.
(should
- (org-test-with-temp-text "<<<radio \\alpha>>>"
- (org-element-map (org-element-parse-buffer) 'radio-target 'identity))))
+ (eq 'radio-target
+ (org-test-with-temp-text "<<<radio \\alpha>>>"
+ (org-element-type (org-element-context)))))
+ ;; Radio targets starting with an object.
+ (should
+ (eq 'radio-target
+ (org-test-with-temp-text "<<<\\alpha radio>>>"
+ (org-element-type (org-element-context))))))
;;;; Section
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 78347af..b0778ff 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2033,6 +2033,15 @@ Another text. (ref:text)
(org-export-resolve-radio-link
(org-element-map tree 'link 'identity info t)
info))))
+ ;; Radio target with objects at its beginning.
+ (should
+ (org-test-with-temp-text "<<<\\alpha radio>>> \\alpha radio"
+ (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")