Function: org-odt--translate-description-lists

org-odt--translate-description-lists is a byte-compiled function defined in ox-odt.el.gz.

Signature

(org-odt--translate-description-lists TREE BACKEND INFO)

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
;;;; Description lists

;; This translator is necessary to handle indented tables in a uniform
;; manner.  See comment in `org-odt--table'.

(defun org-odt--translate-description-lists (tree _backend info)
  ;; OpenDocument has no notion of a description list.  So simulate it
  ;; using plain lists.  Description lists in the exported document
  ;; are typeset in the same manner as they are in a typical HTML
  ;; document.
  ;;
  ;; Specifically, a description list like this:
  ;;
  ;;     ,----
  ;;     | - term-1 :: definition-1
  ;;     | - term-2 :: definition-2
  ;;     `----
  ;;
  ;; gets translated in to the following form:
  ;;
  ;;     ,----
  ;;     | - term-1
  ;;     |   - definition-1
  ;;     | - term-2
  ;;     |   - definition-2
  ;;     `----
  ;;
  ;; Further effect is achieved by fixing the OD styles as below:
  ;;
  ;; 1. Set the :type property of the simulated lists to
  ;;    `descriptive-1' and `descriptive-2'.  Map these to list-styles
  ;;    that has *no* bullets whatsoever.
  ;;
  ;; 2. The paragraph containing the definition term is styled to be
  ;;    in bold.
  ;;
  (org-element-map tree 'plain-list
    (lambda (el)
      (when (eq (org-element-property :type el) 'descriptive)
	(org-element-set
	 el
	 (apply 'org-element-adopt
		(list 'plain-list (list :type 'descriptive-1))
		(mapcar
		 (lambda (item)
		   (org-element-adopt
		       (list 'item (list :checkbox (org-element-property
						    :checkbox item)))
		     (list 'paragraph (list :style "Text_20_body_20_bold")
			   (or (org-element-property :tag item) "(no term)"))
		     (org-element-adopt
                         (list 'plain-list (list :type 'descriptive-2))
		       (apply 'org-element-adopt
			      (list 'item nil)
			      (org-element-contents item)))))
		 (org-element-contents el)))))
      nil)
    info)
  tree)