Function: org-man-headline

org-man-headline is a byte-compiled function defined in ox-man.el.gz.

Signature

(org-man-headline HEADLINE CONTENTS INFO)

Documentation

Transcode a HEADLINE element from Org to Man.

CONTENTS holds the contents of the headline. INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-man.el.gz
;;; Footnote Definition
;;
;; Footnote Definitions are ignored.

;;; Footnote References
;;
;; Footnote References are Ignored


;;; Headline

(defun org-man-headline (headline contents info)
  "Transcode a HEADLINE element from Org to Man.
CONTENTS holds the contents of the headline.  INFO is a plist
holding contextual information."
  (let* ((level (org-export-get-relative-level headline info))
	 ;; Section formatting will set two placeholders: one for the
	 ;; title and the other for the contents.
	 (section-fmt
	  (pcase level
	    (1 ".SH \"%s\"\n%s")
	    (2 ".SS \"%s\"\n%s")
	    (3 ".SS \"%s\"\n%s")
	    (_ nil)))
	 (text (org-export-data (org-element-property :title headline) info)))

    (cond
     ;; Case 1: This is a footnote section: ignore it.
     ((org-element-property :footnote-section-p headline) nil)

     ;; Case 2. This is a deep sub-tree: export it as a list item.
     ;;         Also export as items headlines for which no section
     ;;         format has been found.
     ((or (not section-fmt) (org-export-low-level-p headline info))
      ;; Build the real contents of the sub-tree.
      (let ((low-level-body
	     (concat
	      ;; If the headline is the first sibling, start a list.
	      (when (org-export-first-sibling-p headline info)
		(format "%s\n" ".RS"))
	      ;; Itemize headline
	      ".TP\n.ft I\n" text "\n.ft\n"
	      contents ".RE")))
	;; If headline is not the last sibling simply return
	;; LOW-LEVEL-BODY.  Otherwise, also close the list, before any
	;; blank line.
	(if (not (org-export-last-sibling-p headline info)) low-level-body
	  (replace-regexp-in-string
	   "[ \t\n]*\\'" ""
	   low-level-body))))

     ;; Case 3. Standard headline.  Export it as a section.
     (t (format section-fmt text contents )))))