Function: org-ascii--unique-links

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

Signature

(org-ascii--unique-links ELEMENT INFO)

Documentation

Return a list of unique link references in ELEMENT.

ELEMENT is either a headline element or a section element. 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--unique-links (element info)
  "Return a list of unique link references in ELEMENT.
ELEMENT is either a headline element or a section element.  INFO
is a plist used as a communication channel."
  (let* (seen
	 (unique-link-p
	  ;; Return LINK if it wasn't referenced so far, or nil.
	  ;; Update SEEN links along the way.
	  (lambda (link)
	    (let ((footprint
		   ;; Normalize description in footprints.
		   (cons (org-element-property :raw-link link)
			 (let ((contents (org-element-contents link)))
			   (and contents
				(replace-regexp-in-string
				 "[ \r\t\n]+" " "
				 (org-trim
				  (org-element-interpret-data contents))))))))
	      ;; 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)))))
    (org-element-map (if (eq (org-element-type element) 'section)
			 element
		       ;; In a headline, only retrieve links in title
		       ;; and relative section, not in children.
		       (list (org-element-property :title element)
			     (car (org-element-contents element))))
	'link unique-link-p info nil 'headline t)))