Function: org-ascii-item
org-ascii-item is a byte-compiled function defined in ox-ascii.el.gz.
Signature
(org-ascii-item ITEM CONTENTS INFO)
Documentation
Transcode an ITEM element from Org to ASCII.
CONTENTS holds the contents of the item. INFO is a plist holding contextual information.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
;;;; Item
(defun org-ascii-item (item contents info)
"Transcode an ITEM element from Org to ASCII.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))
(checkbox (org-ascii--checkbox item info))
(list-type (org-element-property :type (org-export-get-parent item)))
(bullet
;; First parent of ITEM is always the plain-list. Get
;; `:type' property from it.
(pcase list-type
(`descriptive
(concat checkbox
(org-export-data (org-element-property :tag item)
info)))
(`ordered
;; Return correct number for ITEM, paying attention to
;; counters.
(let* ((struct (org-element-property :structure item))
(bul (org-list-bullet-string
(org-element-property :bullet item)))
(num (number-to-string
(car (last (org-list-get-item-number
(org-element-property :begin item)
struct
(org-list-prevs-alist struct)
(org-list-parents-alist struct)))))))
(replace-regexp-in-string "[0-9]+" num bul)))
(_ (let ((bul (org-list-bullet-string
(org-element-property :bullet item))))
;; Change bullets into more visible form if UTF-8 is active.
(if (not utf8p) bul
(replace-regexp-in-string
"-" "•"
(replace-regexp-in-string
"\\+" "⁃"
(replace-regexp-in-string "\\*" "‣" bul))))))))
(indentation (if (eq list-type 'descriptive) org-ascii-quote-margin
(string-width bullet))))
(concat
bullet
checkbox
;; Contents: Pay attention to indentation. Note: check-boxes are
;; already taken care of at the paragraph level so they don't
;; interfere with indentation.
(let ((contents (org-ascii--indent-string contents indentation)))
;; Determine if contents should follow the bullet or start
;; a new line. Do the former when the first contributing
;; element to contents is a paragraph. In descriptive lists
;; however, contents always start a new line.
(if (and (not (eq list-type 'descriptive))
(org-string-nw-p contents)
(eq 'paragraph
(org-element-type
(cl-some (lambda (e)
(and (org-string-nw-p (org-export-data e info))
e))
(org-element-contents item)))))
(org-trim contents)
(concat "\n" contents))))))