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))) (let ((destination (org-export-resolve-radio-link link info)))
(when destination (when destination
(format "\\fI [%s] \\fP" (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 ;; Links pointing to a headline: find destination and build
;; appropriate referencing command. ;; 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.") "List of recursive element types aka Greater Elements.")
(defconst org-element-all-successors (defconst org-element-all-successors
'(export-snippet footnote-reference inline-babel-call inline-src-block '(link export-snippet footnote-reference inline-babel-call
latex-or-entity line-break link macro plain-link radio-target inline-src-block latex-or-entity line-break macro plain-link
statistics-cookie sub/superscript table-cell target radio-target statistics-cookie sub/superscript table-cell target
text-markup timestamp) text-markup timestamp)
"Complete list of successors.") "Complete list of successors.")
(defconst org-element-object-successor-alist (defconst org-element-object-successor-alist
@ -328,13 +328,13 @@ Don't modify it, set `org-element-affiliated-keywords' instead.")
(paragraph ,@standard-set) (paragraph ,@standard-set)
;; Remove any variable object from radio target as it would ;; Remove any variable object from radio target as it would
;; prevent it from being properly recognized. ;; 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) (strike-through ,@standard-set)
(subscript ,@standard-set) (subscript ,@standard-set)
(superscript ,@standard-set) (superscript ,@standard-set)
;; Ignore inline babel call and inline src block as formulas are ;; Ignore inline babel call and inline src block as formulas are
;; possible. Also ignore line breaks and statistics cookies. ;; 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) radio-target sub/superscript target text-markup timestamp)
(table-row table-cell) (table-row table-cell)
(underline ,@standard-set) (underline ,@standard-set)
@ -346,7 +346,8 @@ a list of successors that will be called within an element or
object of such type. object of such type.
For example, in a `radio-target' object, one can only find 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 This alist also applies to secondary string. For example, an
`headline' type element doesn't directly contain objects, but `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)) ((and org-target-link-regexp (looking-at org-target-link-regexp))
(setq type "radio" (setq type "radio"
link-end (match-end 0) 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]] ;; Type 2: Standard link, i.e. [[http://orgmode.org][homepage]]
((looking-at org-bracket-link-regexp) ((looking-at org-bracket-link-regexp)
(setq contents-begin (match-beginning 3) (setq contents-begin (match-beginning 3)

View File

@ -5417,6 +5417,8 @@ The following commands are available:
;; Modify a few syntax entries ;; Modify a few syntax entries
(modify-syntax-entry ?@ "w") (modify-syntax-entry ?@ "w")
(modify-syntax-entry ?\" "\"") (modify-syntax-entry ?\" "\"")
(modify-syntax-entry ?\\ "_")
(modify-syntax-entry ?~ "_")
(if org-startup-truncated (setq truncate-lines t)) (if org-startup-truncated (setq truncate-lines t))
(when org-startup-indented (require 'org-indent) (org-indent-mode 1)) (when org-startup-indented (require 'org-indent) (org-indent-mode 1))
(org-set-local 'font-lock-unfontify-region-function (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." between words."
(and targets (and targets
(concat (concat
"\\<\\(" "\\_<\\("
(mapconcat (mapconcat
(lambda (x) (lambda (x)
(setq x (regexp-quote x)) (setq x (regexp-quote x))
@ -6187,7 +6189,7 @@ between words."
x) x)
targets targets
"\\|") "\\|")
"\\)\\>"))) "\\)\\_>")))
(defun org-activate-tags (limit) (defun org-activate-tags (limit)
(if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t) (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. ;; When at a link, act according to the parent instead.
(link (setq context (org-element-property :parent context)) (link (setq context (org-element-property :parent context))
(setq type (org-element-type 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 ((bold code entity export-snippet inline-babel-call inline-src-block
italic latex-fragment line-break macro strike-through subscript italic latex-fragment line-break macro strike-through subscript
superscript underline verbatim) superscript underline verbatim)
(while (and (setq context (org-element-property :parent context)) (while (and (setq context (org-element-property :parent context))
(not (memq (setq type (org-element-type 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 ;; For convenience: at the first line of a paragraph on the
;; same line as an item, apply function on that item instead. ;; same line as an item, apply function on that item instead.
(when (eq type 'paragraph) (when (eq type 'paragraph)

View File

@ -1388,10 +1388,7 @@ INFO is a plist holding contextual information."
(org-export-resolve-coderef ref info)))) (org-export-resolve-coderef ref info))))
;; Do not apply a special syntax on radio links. Though, use ;; Do not apply a special syntax on radio links. Though, use
;; transcoded target's contents as output. ;; transcoded target's contents as output.
((string= type "radio") ((string= type "radio") desc)
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(org-export-data (org-element-contents destination) info))))
;; Do not apply a special syntax on fuzzy links pointing to ;; Do not apply a special syntax on fuzzy links pointing to
;; targets. ;; targets.
((string= type "fuzzy") ((string= type "fuzzy")

View File

@ -689,8 +689,9 @@ used as a communication channel."
(when destination (when destination
(format "\\hyperlink%s{%s}{%s}" (format "\\hyperlink%s{%s}{%s}"
(or (org-beamer--element-has-overlay-p link) "") (or (org-beamer--element-has-overlay-p link) "")
(org-export-solidify-link-text path) (org-export-solidify-link-text
(org-export-data (org-element-contents destination) info))))) (org-element-property :value destination))
contents))))
((and (member type '("custom-id" "fuzzy" "id")) ((and (member type '("custom-id" "fuzzy" "id"))
(let ((destination (if (string= type "fuzzy") (let ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info) (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))) (let ((destination (org-export-resolve-radio-link link info)))
(when destination (when destination
(format "<a href=\"#%s\"%s>%s</a>" (format "<a href=\"#%s\"%s>%s</a>"
(org-export-solidify-link-text path) (org-export-solidify-link-text
attributes (org-element-property :value destination))
(org-export-data (org-element-contents destination) info))))) attributes desc))))
;; Links pointing to a headline: Find destination and build ;; Links pointing to a headline: Find destination and build
;; appropriate referencing command. ;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id")) ((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))) (let ((destination (org-export-resolve-radio-link link info)))
(when destination (when destination
(format "\\hyperref[%s]{%s}" (format "\\hyperref[%s]{%s}"
(org-export-solidify-link-text path) (org-export-solidify-link-text
(org-export-data (org-element-contents destination) info))))) (org-element-property :value destination))
desc))))
;; Links pointing to a headline: Find destination and build ;; Links pointing to a headline: Find destination and build
;; appropriate referencing command. ;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id")) ((member type '("custom-id" "fuzzy" "id"))

View File

@ -329,9 +329,7 @@ a communication channel."
(let ((ref (org-element-property :path link))) (let ((ref (org-element-property :path link)))
(format (org-export-get-coderef-format ref contents) (format (org-export-get-coderef-format ref contents)
(org-export-resolve-coderef ref info)))) (org-export-resolve-coderef ref info))))
((equal type "radio") ((equal type "radio") contents)
(let ((destination (org-export-resolve-radio-link link info)))
(org-export-data (org-element-contents destination) info)))
((equal type "fuzzy") ((equal type "fuzzy")
(let ((destination (org-export-resolve-fuzzy-link link info))) (let ((destination (org-export-resolve-fuzzy-link link info)))
(if (org-string-nw-p contents) contents (if (org-string-nw-p contents) contents

View File

@ -2735,11 +2735,11 @@ INFO is a plist holding contextual information. See
((string= type "radio") ((string= type "radio")
(let ((destination (org-export-resolve-radio-link link info))) (let ((destination (org-export-resolve-radio-link link info)))
(when destination (when destination
(let ((desc (org-export-data (org-element-contents destination) info)) (format
(href (org-export-solidify-link-text path))) "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
(format (org-export-solidify-link-text
"<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" (org-element-property :value destination))
href desc))))) desc))))
;; Links pointing to a headline: Find destination and build ;; Links pointing to a headline: Find destination and build
;; appropriate referencing command. ;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id")) ((member type '("custom-id" "fuzzy" "id"))

View File

@ -1687,12 +1687,19 @@ Outside list"
"Test `radio-target' parser." "Test `radio-target' parser."
;; Standard test. ;; Standard test.
(should (should
(org-test-with-temp-text "<<<radio>>>" (eq 'radio-target
(org-element-map (org-element-parse-buffer) 'radio-target 'identity))) (org-test-with-temp-text "<<<radio>>>"
(org-element-type (org-element-context)))))
;; Radio targets with objects. ;; Radio targets with objects.
(should (should
(org-test-with-temp-text "<<<radio \\alpha>>>" (eq 'radio-target
(org-element-map (org-element-parse-buffer) 'radio-target 'identity)))) (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 ;;;; Section

View File

@ -2033,6 +2033,15 @@ Another text. (ref:text)
(org-export-resolve-radio-link (org-export-resolve-radio-link
(org-element-map tree 'link 'identity info t) (org-element-map tree 'link 'identity info t)
info)))) 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. ;; Multiple radio targets.
(should (should
(equal '("radio1" "radio2") (equal '("radio1" "radio2")