Function: org-ascii--describe-links

org-ascii--describe-links is a byte-compiled function defined in ox-ascii.el.gz.

Signature

(org-ascii--describe-links LINKS WIDTH INFO)

Documentation

Return a string describing a list of links.

LINKS is a list of link type objects, as returned by org-ascii--unique-links. WIDTH is the text width allowed for the output string. INFO is a plist used as a communication channel.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
(defun org-ascii--describe-links (links width info)
  "Return a string describing a list of links.
LINKS is a list of link type objects, as returned by
`org-ascii--unique-links'.  WIDTH is the text width allowed for
the output string.  INFO is a plist used as a communication
channel."
  (mapconcat
   (lambda (link)
     (let* ((type (org-element-property :type link))
	    (description (org-element-contents link))
	    (anchor (org-export-data
		     (or description (org-element-property :raw-link link))
		     info)))
       (cond
	((member type '("coderef" "radio")) nil)
	((member type '("custom-id" "fuzzy" "id"))
	 ;; Only links with a description need an entry.  Other are
	 ;; already handled in `org-ascii-link'.
	 (when description
	   (let ((dest (if (equal type "fuzzy")
			   (org-export-resolve-fuzzy-link link info)
                         ;; Ignore broken links.  On broken link,
                         ;; `org-export-resolve-id-link' will throw an
                         ;; error and we will return nil.
			 (condition-case nil
                             (org-export-resolve-id-link link info)
                           (org-link-broken nil)))))
             (when dest
	       (concat
                (org-ascii--fill-string
                 (format "[%s] %s" anchor (org-ascii--describe-datum dest info))
                 width info)
                "\n\n")))))
	;; Do not add a link that cannot be resolved and doesn't have
	;; any description: destination is already visible in the
	;; paragraph.
	((not (org-element-contents link)) nil)
	;; Do not add a link already handled by custom export
	;; functions.
	((org-export-custom-protocol-maybe link anchor 'ascii info) nil)
	(t
	 (concat
	  (org-ascii--fill-string
	   (format "[%s] <%s>" anchor (org-element-property :raw-link link))
	   width info)
	  "\n\n")))))
   links ""))