Function: org-ascii-headline
org-ascii-headline is a byte-compiled function defined in
ox-ascii.el.gz.
Signature
(org-ascii-headline HEADLINE CONTENTS INFO)
Documentation
Transcode a HEADLINE element from Org to ASCII.
CONTENTS holds the contents of the headline. INFO is a plist holding contextual information.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
;;;; Headline
(defun org-ascii-headline (headline contents info)
"Transcode a HEADLINE element from Org to ASCII.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
;; Don't export footnote section, which will be handled at the end
;; of the template.
(unless (org-element-property :footnote-section-p headline)
(let* ((low-level (org-export-low-level-p headline info))
(width (org-ascii--current-text-width headline info))
;; Export title early so that any link in it can be
;; exported and seen in `org-ascii--unique-links'.
(title (org-ascii--build-title headline info width (not low-level)))
;; Blank lines between headline and its contents.
;; `org-ascii-headline-spacing', when set, overwrites
;; original buffer's spacing.
(pre-blanks
(make-string (or (car (plist-get info :ascii-headline-spacing))
(org-element-property :pre-blank headline)
0)
?\n))
(links (and (plist-get info :ascii-links-to-notes)
(org-ascii--describe-links
(org-ascii--unique-links headline info) width info)))
;; Re-build contents, inserting section links at the right
;; place. The cost is low since build results are cached.
(body
(if (not (org-string-nw-p links)) contents
(let* ((contents (org-element-contents headline))
(section (let ((first (car contents)))
(and (eq (org-element-type first) 'section)
first))))
(concat (and section
(concat (org-element-normalize-string
(org-export-data section info))
"\n\n"))
links
(mapconcat (lambda (e) (org-export-data e info))
(if section (cdr contents) contents)
""))))))
;; Deep subtree: export it as a list item.
(if low-level
(let* ((bullets (cdr (assq (plist-get info :ascii-charset)
(plist-get info :ascii-bullets))))
(bullet
(format "%c "
(nth (mod (1- low-level) (length bullets)) bullets))))
(concat bullet title "\n" pre-blanks
;; Contents, indented by length of bullet.
(org-ascii--indent-string body (length bullet))))
;; Else: Standard headline.
(concat title "\n" pre-blanks body)))))