forked from mirrors/org-mode
org-element: Allow links in captions
* lisp/org-element.el (org-element-object-restrictions): Allow links in caption. Also allow inline-src-blocks and inline-babel-calls. * contrib/lisp/org-e-ascii.el (org-e-ascii--unique-links): Handle links in captions. (org-e-ascii--describe-links): Small refactoring. (org-e-ascii-template--document-title): Handle links in document properties.
This commit is contained in:
parent
3245619445
commit
934208ece1
|
@ -734,7 +734,12 @@ is a plist used as a communication channel."
|
||||||
(let ((footprint
|
(let ((footprint
|
||||||
(cons (org-element-property :raw-link link)
|
(cons (org-element-property :raw-link link)
|
||||||
(org-element-contents link))))
|
(org-element-contents link))))
|
||||||
(unless (member footprint seen)
|
;; Ignore LINK if it hasn't been translated already.
|
||||||
|
;; It can happen if it is located in an affiliated
|
||||||
|
;; keyword that was ignored.
|
||||||
|
(when (and (org-string-nw-p
|
||||||
|
(gethash link (plist-get info :exported-data)))
|
||||||
|
(not (member footprint seen)))
|
||||||
(push footprint seen) link)))))
|
(push footprint seen) link)))))
|
||||||
;; If at a section, find parent headline, if any, in order to
|
;; If at a section, find parent headline, if any, in order to
|
||||||
;; count links that might be in the title.
|
;; count links that might be in the title.
|
||||||
|
@ -743,7 +748,7 @@ is a plist used as a communication channel."
|
||||||
(or (org-export-get-parent-headline element) element))))
|
(or (org-export-get-parent-headline element) element))))
|
||||||
;; Get all links in HEADLINE.
|
;; Get all links in HEADLINE.
|
||||||
(org-element-map
|
(org-element-map
|
||||||
headline 'link (lambda (link) (funcall unique-link-p link)) info)))
|
headline 'link (lambda (l) (funcall unique-link-p l)) info nil nil t)))
|
||||||
|
|
||||||
(defun org-e-ascii--describe-links (links width info)
|
(defun org-e-ascii--describe-links (links width info)
|
||||||
"Return a string describing a list of links.
|
"Return a string describing a list of links.
|
||||||
|
@ -756,8 +761,8 @@ channel."
|
||||||
(lambda (link)
|
(lambda (link)
|
||||||
(let ((type (org-element-property :type link))
|
(let ((type (org-element-property :type link))
|
||||||
(anchor (let ((desc (org-element-contents link)))
|
(anchor (let ((desc (org-element-contents link)))
|
||||||
(if (not desc) (org-element-property :raw-link link)
|
(if desc (org-export-data desc info)
|
||||||
(org-export-data desc info)))))
|
(org-element-property :raw-link link)))))
|
||||||
(cond
|
(cond
|
||||||
;; Coderefs, radio links and fuzzy links are ignored.
|
;; Coderefs, radio links and fuzzy links are ignored.
|
||||||
((member type '("coderef" "radio" "fuzzy")) nil)
|
((member type '("coderef" "radio" "fuzzy")) nil)
|
||||||
|
@ -803,7 +808,10 @@ INFO is a plist used as a communication channel."
|
||||||
(defun org-e-ascii-template--document-title (info)
|
(defun org-e-ascii-template--document-title (info)
|
||||||
"Return document title, as a string.
|
"Return document title, as a string.
|
||||||
INFO is a plist used as a communication channel."
|
INFO is a plist used as a communication channel."
|
||||||
(let ((text-width org-e-ascii-text-width)
|
(let* ((text-width org-e-ascii-text-width)
|
||||||
|
;; Links in the title will not be resolved later, so we make
|
||||||
|
;; sure their path is located right after them.
|
||||||
|
(org-e-ascii-links-to-notes nil)
|
||||||
(title (org-export-data (plist-get info :title) info))
|
(title (org-export-data (plist-get info :title) info))
|
||||||
(author (and (plist-get info :with-author)
|
(author (and (plist-get info :with-author)
|
||||||
(let ((auth (plist-get info :author)))
|
(let ((auth (plist-get info :author)))
|
||||||
|
|
|
@ -304,7 +304,8 @@ a secondary string.")
|
||||||
link radio-target sub/superscript target text-markup timestamp)
|
link radio-target sub/superscript target text-markup timestamp)
|
||||||
(item export-snippet footnote-reference inline-babel-call latex-or-entity
|
(item export-snippet footnote-reference inline-babel-call latex-or-entity
|
||||||
link macro radio-target sub/superscript target text-markup)
|
link macro radio-target sub/superscript target text-markup)
|
||||||
(keyword latex-or-entity macro sub/superscript text-markup)
|
(keyword inline-babel-call inline-src-block latex-or-entity link macro
|
||||||
|
sub/superscript text-markup)
|
||||||
(link export-snippet inline-babel-call inline-src-block latex-or-entity link
|
(link export-snippet inline-babel-call inline-src-block latex-or-entity link
|
||||||
sub/superscript text-markup)
|
sub/superscript text-markup)
|
||||||
(paragraph export-snippet footnote-reference inline-babel-call
|
(paragraph export-snippet footnote-reference inline-babel-call
|
||||||
|
|
Loading…
Reference in New Issue