Function: org-man-template

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

Signature

(org-man-template CONTENTS INFO)

Documentation

Return complete document string after Man conversion.

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

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-man.el.gz
;;; Template

(defun org-man-template (contents info)
  "Return complete document string after Man conversion.
CONTENTS is the transcoded contents string.  INFO is a plist
holding export options."
  (let* ((title (when (plist-get info :with-title)
		  (org-export-data (plist-get info :title) info)))
         (attr (read (format "(%s)"
                             (mapconcat
                              #'identity
                              (list (plist-get info :man-class-options))
                              " "))))
         (section-item (plist-get attr :section-id))
         (release (plist-get attr :release))
         (header (plist-get attr :header))
         ;; Note: groff linter suggests date to be the third argument
         ;; of .TH
         (date (and (plist-get info :with-date)
		    (org-export-data (org-export-get-date info) info))))
    (concat
     (format ".TH \"%s\" \"%s\"" ;; only two required by groff_man(7).
             (if title title " ")
             (if (stringp section-item) section-item "1"))
     (if date (format " \"%s\""  date)
       " \"\"") ;; in case later options are present.
     (if release (format " \"%s\"" release)
       " \"\"") ;; in case later options are present.
     ;; Do not write an empty footer-outside, otherwise man(1) will
     ;; no longer generate its content, see groff_man(7).
     (if header (format " \"%s\"" header))
     " \n"
     contents)))