Function: org-ascii-inner-template

org-ascii-inner-template is a byte-compiled function defined in ox-ascii.el.gz.

Signature

(org-ascii-inner-template CONTENTS INFO)

Documentation

Return complete document string after ASCII conversion.

CONTENTS is the transcoded contents string. INFO is a plist holding export options.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
(defun org-ascii-inner-template (contents info)
  "Return complete document string after ASCII conversion.
CONTENTS is the transcoded contents string.  INFO is a plist
holding export options."
  (org-element-normalize-string
   (let ((global-margin (plist-get info :ascii-global-margin)))
     (org-ascii--indent-string
      (concat
       ;; 1. Document's body.
       contents
       ;; 2. Footnote definitions.
       (let ((definitions (org-export-collect-footnote-definitions info))
	     ;; Insert full links right inside the footnote definition
	     ;; as they have no chance to be inserted later.
	     (info (org-combine-plists info '(:ascii-links-to-notes nil))))
	 (when definitions
	   (concat
	    "\n\n\n"
	    (let ((title (org-ascii--translate "Footnotes" info)))
	      (concat
	       title "\n"
	       (make-string
		(string-width title)
		(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))))
	    "\n\n"
	    (let ((text-width (- (plist-get info :ascii-text-width)
				 global-margin)))
	      (mapconcat
	       (lambda (ref)
		 (let ((id (format "[%s] " (car ref))))
		   ;; Distinguish between inline definitions and
		   ;; full-fledged definitions.
		   (org-trim
		    (let ((def (nth 2 ref)))
		      (if (org-element-map def org-element-all-elements
			    #'identity info 'first-match)
			  ;; Full-fledged definition: footnote ID is
			  ;; inserted inside the first parsed
			  ;; paragraph (FIRST), if any, to be sure
			  ;; filling will take it into consideration.
			  (let ((first (car (org-element-contents def))))
			    (if (not (eq (org-element-type first) 'paragraph))
				(concat id "\n" (org-export-data def info))
			      (push id (nthcdr 2 first))
			      (org-export-data def info)))
			;; Fill paragraph once footnote ID is inserted
			;; in order to have a correct length for first
			;; line.
			(org-ascii--fill-string
			 (concat id (org-export-data def info))
			 text-width info))))))
	       definitions "\n\n"))))))
      global-margin))))