Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2014-03-24 14:20:23 +01:00
commit 230d09aeb0
11 changed files with 57 additions and 36 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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)

View File

@ -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")

View File

@ -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)

View File

@ -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"))

View File

@ -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"))

View File

@ -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

View File

@ -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"))

View File

@ -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

View File

@ -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")