forked from mirrors/org-mode
Merge branch 'maint'
Conflicts: lisp/org-element.el lisp/ox-html.el
This commit is contained in:
commit
fffd055ac5
|
@ -378,7 +378,7 @@ the \"slide\" class will be added to the to the list element,
|
|||
|
||||
(defun org-deck-link (link desc info)
|
||||
(replace-regexp-in-string "href=\"#" "href=\"#outline-container-"
|
||||
(org-html-link link desc info)))
|
||||
(org-export-with-backend 'html link desc info)))
|
||||
|
||||
(defun org-deck-template (contents info)
|
||||
"Return complete document string after HTML conversion.
|
||||
|
|
|
@ -1251,13 +1251,10 @@ INFO is a plist holding contextual information. See
|
|||
(imagep (org-export-inline-image-p
|
||||
link org-groff-inline-image-rules))
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((string= type "mailto") (concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(if (file-name-absolute-p raw-path)
|
||||
(concat "file://" (expand-file-name raw-path))
|
||||
(concat "file://" raw-path)))
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(concat type ":" raw-path))
|
||||
((and (string= type "file") (file-name-absolute-p raw-path))
|
||||
(concat "file://" raw-path))
|
||||
(t raw-path)))
|
||||
protocol)
|
||||
(cond
|
||||
|
|
|
@ -3002,18 +3002,20 @@ Assume point is at the beginning of the link."
|
|||
(save-excursion
|
||||
(setq post-blank (progn (goto-char link-end) (skip-chars-forward " \t"))
|
||||
end (point))
|
||||
;; Extract search option and opening application out of
|
||||
;; "file"-type links.
|
||||
;; Special "file" type link processing.
|
||||
(when (member type org-element-link-type-is-file)
|
||||
;; Application.
|
||||
;; Extract opening application and search option.
|
||||
(cond ((string-match "^file\\+\\(.*\\)$" type)
|
||||
(setq application (match-string 1 type)))
|
||||
((not (string-match "^file" type))
|
||||
(setq application type)))
|
||||
;; Extract search option from PATH.
|
||||
(when (string-match "::\\(.*\\)$" path)
|
||||
(when (string-match "::\\(.*\\)\\'" path)
|
||||
(setq search-option (match-string 1 path)
|
||||
path (replace-match "" nil nil path)))
|
||||
;; Normalize URI.
|
||||
(when (and (not (org-string-match-p "\\`//" path))
|
||||
(file-name-absolute-p path))
|
||||
(setq path (concat "//" (expand-file-name path))))
|
||||
;; Make sure TYPE always reports "file".
|
||||
(setq type "file"))
|
||||
(list 'link
|
||||
|
|
97
lisp/org.el
97
lisp/org.el
|
@ -5669,54 +5669,55 @@ stacked delimiters is N. Escaping delimiters is not possible."
|
|||
(defun org-make-link-regexps ()
|
||||
"Update the link regular expressions.
|
||||
This should be called after the variable `org-link-types' has changed."
|
||||
(setq org-link-types-re
|
||||
(concat "\\`" (regexp-opt org-link-types t) ":\\(?://\\)")
|
||||
org-link-re-with-space
|
||||
(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^" org-non-link-chars "]*"
|
||||
"[^" org-non-link-chars " ]\\)>?")
|
||||
org-link-re-with-space2
|
||||
(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)?"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^\t\n\r]*"
|
||||
"[^" org-non-link-chars " ]\\)>?")
|
||||
org-link-re-with-space3
|
||||
(concat "<?" (regexp-opt org-link-types t) ":\\(?://\\)?"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^\t\n\r]*\\)")
|
||||
org-angle-link-re
|
||||
(concat "<" (regexp-opt org-link-types t) ":\\(?://\\)?"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^" org-non-link-chars "]*"
|
||||
"\\)>")
|
||||
org-plain-link-re
|
||||
(concat
|
||||
"\\<" (regexp-opt org-link-types t) ":\\(?://\\)?"
|
||||
(org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)"))
|
||||
;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
|
||||
org-bracket-link-regexp
|
||||
"\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
|
||||
org-bracket-link-analytic-regexp
|
||||
(concat
|
||||
"\\[\\["
|
||||
"\\(" (regexp-opt org-link-types t) ":\\(?://\\)?\\)?"
|
||||
"\\([^]]+\\)"
|
||||
"\\]"
|
||||
"\\(\\[" "\\([^]]+\\)" "\\]\\)?"
|
||||
"\\]")
|
||||
org-bracket-link-analytic-regexp++
|
||||
(concat
|
||||
"\\[\\["
|
||||
"\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\(?://\\)?\\)?"
|
||||
"\\([^]]+\\)"
|
||||
"\\]"
|
||||
"\\(\\[" "\\([^]]+\\)" "\\]\\)?"
|
||||
"\\]")
|
||||
org-any-link-re
|
||||
(concat "\\(" org-bracket-link-regexp "\\)\\|\\("
|
||||
org-angle-link-re "\\)\\|\\("
|
||||
org-plain-link-re "\\)")))
|
||||
(let ((types-re (regexp-opt org-link-types t)))
|
||||
(setq org-link-types-re
|
||||
(concat "\\`" types-re ":")
|
||||
org-link-re-with-space
|
||||
(concat "<?" types-re ":"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^" org-non-link-chars "]*"
|
||||
"[^" org-non-link-chars " ]\\)>?")
|
||||
org-link-re-with-space2
|
||||
(concat "<?" types-re ":"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^\t\n\r]*"
|
||||
"[^" org-non-link-chars " ]\\)>?")
|
||||
org-link-re-with-space3
|
||||
(concat "<?" types-re ":"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^\t\n\r]*\\)")
|
||||
org-angle-link-re
|
||||
(concat "<" types-re ":"
|
||||
"\\([^" org-non-link-chars " ]"
|
||||
"[^" org-non-link-chars "]*"
|
||||
"\\)>")
|
||||
org-plain-link-re
|
||||
(concat
|
||||
"\\<" types-re ":"
|
||||
(org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)"))
|
||||
;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
|
||||
org-bracket-link-regexp
|
||||
"\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
|
||||
org-bracket-link-analytic-regexp
|
||||
(concat
|
||||
"\\[\\["
|
||||
"\\(" types-re ":\\)?"
|
||||
"\\([^]]+\\)"
|
||||
"\\]"
|
||||
"\\(\\[" "\\([^]]+\\)" "\\]\\)?"
|
||||
"\\]")
|
||||
org-bracket-link-analytic-regexp++
|
||||
(concat
|
||||
"\\[\\["
|
||||
"\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\)?"
|
||||
"\\([^]]+\\)"
|
||||
"\\]"
|
||||
"\\(\\[" "\\([^]]+\\)" "\\]\\)?"
|
||||
"\\]")
|
||||
org-any-link-re
|
||||
(concat "\\(" org-bracket-link-regexp "\\)\\|\\("
|
||||
org-angle-link-re "\\)\\|\\("
|
||||
org-plain-link-re "\\)"))))
|
||||
|
||||
(org-make-link-regexps)
|
||||
|
||||
|
|
|
@ -2721,24 +2721,21 @@ INFO is a plist holding contextual information. See
|
|||
(desc (org-string-nw-p desc))
|
||||
(path
|
||||
(cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(org-link-escape-browser
|
||||
(org-link-unescape (concat type "://" raw-path))))
|
||||
((string= type "mailto")
|
||||
(org-link-escape-browser
|
||||
(org-link-unescape (concat type ":" raw-path))))
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(org-link-escape
|
||||
(org-link-unescape
|
||||
(concat type ":" raw-path)) org-link-escape-chars-browser))
|
||||
((string= type "file")
|
||||
;; Treat links to ".org" files as ".html", if needed.
|
||||
(setq raw-path
|
||||
(funcall link-org-files-as-html-maybe raw-path info))
|
||||
;; If file path is absolute, prepend it with protocol
|
||||
;; component - "file://".
|
||||
(cond ((file-name-absolute-p raw-path)
|
||||
(setq raw-path
|
||||
(concat "file://" (expand-file-name
|
||||
raw-path))))
|
||||
((and home use-abs-url)
|
||||
(setq raw-path (concat (file-name-as-directory home) raw-path))))
|
||||
;; component - "file:".
|
||||
(cond
|
||||
((file-name-absolute-p raw-path)
|
||||
(setq raw-path (concat "file:" raw-path)))
|
||||
((and home use-abs-url)
|
||||
(setq raw-path (concat (file-name-as-directory home) raw-path))))
|
||||
;; Add search option, if any. A search option can be
|
||||
;; relative to a custom-id or a headline title. Append
|
||||
;; a hash sign to any unresolved option, as it might point
|
||||
|
|
|
@ -1906,12 +1906,10 @@ INFO is a plist holding contextual information. See
|
|||
(imagep (org-export-inline-image-p
|
||||
link org-latex-inline-image-rules))
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((string= type "mailto") (concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(if (not (file-name-absolute-p raw-path)) raw-path
|
||||
(concat "file://" (expand-file-name raw-path))))
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(concat type ":" raw-path))
|
||||
((and (string= type "file") (file-name-absolute-p raw-path))
|
||||
(concat "file:" raw-path))
|
||||
(t raw-path)))
|
||||
protocol)
|
||||
(cond
|
||||
|
|
|
@ -638,20 +638,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
DESC is the description part of the link, or the empty string.
|
||||
INFO is a plist holding contextual information. See
|
||||
`org-export-data'."
|
||||
|
||||
(let* ((type (org-element-property :type link))
|
||||
(raw-path (org-element-property :path link))
|
||||
;; Ensure DESC really exists, or set it to nil.
|
||||
(desc (and (not (string= desc "")) desc))
|
||||
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((string= type "mailto") (concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(if (file-name-absolute-p raw-path)
|
||||
(concat "file://" (expand-file-name raw-path))
|
||||
(concat "file://" raw-path)))
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(concat type ":" raw-path))
|
||||
((and (string= type "file") (file-name-absolute-p raw-path))
|
||||
(concat "file:" raw-path))
|
||||
(t raw-path)))
|
||||
protocol)
|
||||
(cond
|
||||
|
|
|
@ -342,13 +342,13 @@ a communication channel."
|
|||
(path
|
||||
(cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((equal type "file")
|
||||
(concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(let ((path (funcall link-org-files-as-md raw-path)))
|
||||
(if (not (file-name-absolute-p path)) path
|
||||
;; If file path is absolute, prepend it
|
||||
;; with "file://" component.
|
||||
(concat "file://" (expand-file-name raw-path)))))
|
||||
;; with "file:" component.
|
||||
(concat "file:" path))))
|
||||
(t raw-path))))
|
||||
(if (not contents) (format "<%s>" path)
|
||||
(format "[%s](%s)" contents path)))))))
|
||||
|
|
|
@ -2711,13 +2711,10 @@ INFO is a plist holding contextual information. See
|
|||
(imagep (org-export-inline-image-p
|
||||
link org-odt-inline-image-rules))
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((string= type "mailto") (concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(if (file-name-absolute-p raw-path)
|
||||
(concat "file://" (expand-file-name raw-path))
|
||||
(concat "file://" raw-path)))
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(concat type ":" raw-path))
|
||||
((and (string= type "file") (file-name-absolute-p raw-path))
|
||||
(concat "file:" raw-path))
|
||||
(t raw-path)))
|
||||
;; Convert & to & for correct XML representation
|
||||
(path (replace-regexp-in-string "&" "&" path))
|
||||
|
|
|
@ -1221,11 +1221,9 @@ INFO is a plist holding contextual information. See
|
|||
(desc (and (not (string= desc "")) desc))
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp"))
|
||||
(concat type "://" raw-path))
|
||||
((string= type "file")
|
||||
(if (file-name-absolute-p raw-path)
|
||||
(concat "file://" (expand-file-name raw-path))
|
||||
(concat "file://" raw-path)))
|
||||
(concat type ":" raw-path))
|
||||
((and (string= type "file") (file-name-absolute-p raw-path))
|
||||
(concat "file:" raw-path))
|
||||
(t raw-path)))
|
||||
(email (if (string= type "mailto")
|
||||
(let ((text (replace-regexp-in-string
|
||||
|
|
|
@ -1361,10 +1361,12 @@ e^{i\\pi}+1=0
|
|||
;; ... with expansion.
|
||||
(should
|
||||
(equal
|
||||
"orgmode.org/worg"
|
||||
"//orgmode.org/worg"
|
||||
(org-test-with-temp-text "[[Org:worg]]"
|
||||
(let ((org-link-abbrev-alist '(("Org" . "http://orgmode.org/"))))
|
||||
(org-element-property :path (org-element-context))))))
|
||||
(org-element-property
|
||||
:path
|
||||
(org-element-map (org-element-parse-buffer) 'link 'identity nil t))))))
|
||||
;; ... with translation.
|
||||
(should
|
||||
(equal
|
||||
|
|
Loading…
Reference in New Issue