Honor special link formatting of custom links for ASCII export
This commit is contained in:
parent
f4143ddf1b
commit
e72fa4dcc5
|
@ -311,7 +311,7 @@ publishing directory."
|
||||||
:add-text (plist-get opt-plist :text))
|
:add-text (plist-get opt-plist :text))
|
||||||
"\n"))
|
"\n"))
|
||||||
thetoc have-headings first-heading-pos
|
thetoc have-headings first-heading-pos
|
||||||
table-open table-buffer link-buffer link desc desc0 rpl wrap)
|
table-open table-buffer link-buffer link desc desc0 rpl wrap fnc)
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(org-unmodified
|
(org-unmodified
|
||||||
(remove-text-properties (point-min) (point-max)
|
(remove-text-properties (point-min) (point-max)
|
||||||
|
@ -446,12 +446,17 @@ publishing directory."
|
||||||
(setq rpl (concat "["
|
(setq rpl (concat "["
|
||||||
(or (match-string 3 line) (match-string 1 line))
|
(or (match-string 3 line) (match-string 1 line))
|
||||||
"]"))
|
"]"))
|
||||||
|
(if (functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
|
||||||
|
(setq rpl (or (save-match-data
|
||||||
|
(funcall fnc (org-link-unescape path)
|
||||||
|
desc0 'ascii))
|
||||||
|
rpl))
|
||||||
(when (and desc0 (not (equal desc0 link)))
|
(when (and desc0 (not (equal desc0 link)))
|
||||||
(if org-export-ascii-links-to-notes
|
(if org-export-ascii-links-to-notes
|
||||||
(push (cons desc0 link) link-buffer)
|
(push (cons desc0 link) link-buffer)
|
||||||
(setq rpl (concat rpl " (" link ")")
|
(setq rpl (concat rpl " (" link ")")
|
||||||
wrap (+ (length line) (- (length (match-string 0 line)))
|
wrap (+ (length line) (- (length (match-string 0 line)))
|
||||||
(length desc)))))
|
(length desc))))))
|
||||||
(setq line (replace-match rpl t t line))))
|
(setq line (replace-match rpl t t line))))
|
||||||
(when custom-times
|
(when custom-times
|
||||||
(setq line (org-translate-time line)))
|
(setq line (org-translate-time line)))
|
||||||
|
@ -482,7 +487,8 @@ publishing directory."
|
||||||
(org-format-table-ascii table-buffer)
|
(org-format-table-ascii table-buffer)
|
||||||
"\n") "\n")))
|
"\n") "\n")))
|
||||||
(t
|
(t
|
||||||
(if (string-match "^\\([ \t]*\\)\\([-+*][ \t]+\\)\\(.*?\\)\\( ::\\)" line)
|
(if (string-match "^\\([ \t]*\\)\\([-+*][ \t]+\\)\\(.*?\\)\\( ::\\)"
|
||||||
|
line)
|
||||||
(setq line (replace-match "\\1\\3:" t nil line)))
|
(setq line (replace-match "\\1\\3:" t nil line)))
|
||||||
(setq line (org-fix-indentation line org-ascii-current-indentation))
|
(setq line (org-fix-indentation line org-ascii-current-indentation))
|
||||||
;; Remove forced line breaks
|
;; Remove forced line breaks
|
||||||
|
|
|
@ -8141,11 +8141,13 @@ It should be a function accepting three arguments:
|
||||||
|
|
||||||
path the path of the link, the text after the prefix (like \"http:\")
|
path the path of the link, the text after the prefix (like \"http:\")
|
||||||
desc the description of the link, if any, nil if there was no description
|
desc the description of the link, if any, nil if there was no description
|
||||||
format the export format, a symbol like `html' or `latex'.
|
format the export format, a symbol like `html' or `latex' or `ascii'..
|
||||||
|
|
||||||
The function may use the FORMAT information to return different values
|
The function may use the FORMAT information to return different values
|
||||||
depending on the format. The return value will be put literally into
|
depending on the format. The return value will be put literally into
|
||||||
the exported file.
|
the exported file. If the return value is nil, this means Org should
|
||||||
|
do what it normally does with links which do not have EXPORT defined.
|
||||||
|
|
||||||
Org-mode has a built-in default for exporting links. If you are happy with
|
Org-mode has a built-in default for exporting links. If you are happy with
|
||||||
this default, there is no need to define an export function for the link
|
this default, there is no need to define an export function for the link
|
||||||
type. For a simple example of an export function, see `org-bbdb.el'."
|
type. For a simple example of an export function, see `org-bbdb.el'."
|
||||||
|
|
Loading…
Reference in New Issue