2023-04-20 12:11:19 +00:00
|
|
|
|
;;; ox-man.el --- Man Backend for Org Export Engine -*- lexical-binding: t; -*-
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
|
;; Copyright (C) 2011-2024 Free Software Foundation, Inc.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
2013-02-23 08:56:24 +00:00
|
|
|
|
;; Luis R Anaya <papoanaya aroba hot mail punto com>
|
2023-12-30 17:01:48 +00:00
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, text
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-02-23 08:56:24 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
2013-02-23 08:56:24 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
2023-04-20 12:11:19 +00:00
|
|
|
|
;; This library implements a Man backend for Org generic exporter.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; To test it, run
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; M-: (org-export-to-buffer 'man "*Test Man*") RET
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
2016-08-23 20:13:56 +00:00
|
|
|
|
;; in an Org buffer then switch to the buffer to see the Man export.
|
|
|
|
|
;; See ox.el for more details on how this exporter works.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
;; It introduces one new buffer keywords:
|
|
|
|
|
;; "MAN_CLASS_OPTIONS".
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Code:
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2022-08-04 13:53:05 +00:00
|
|
|
|
(require 'org-macs)
|
|
|
|
|
(org-assert-version)
|
|
|
|
|
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(require 'cl-lib)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(require 'ox)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2020-01-14 02:07:53 +00:00
|
|
|
|
;;; Function Declarations
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(defvar org-export-man-default-packages-alist)
|
|
|
|
|
(defvar org-export-man-packages-alist)
|
2012-10-04 12:45:28 +00:00
|
|
|
|
(defvar orgtbl-exp-regexp)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-20 12:11:19 +00:00
|
|
|
|
;;; Define Backend
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-03-19 15:24:40 +00:00
|
|
|
|
(org-export-define-backend 'man
|
|
|
|
|
'((babel-call . org-man-babel-call)
|
|
|
|
|
(bold . org-man-bold)
|
|
|
|
|
(center-block . org-man-center-block)
|
|
|
|
|
(code . org-man-code)
|
|
|
|
|
(drawer . org-man-drawer)
|
|
|
|
|
(dynamic-block . org-man-dynamic-block)
|
|
|
|
|
(entity . org-man-entity)
|
|
|
|
|
(example-block . org-man-example-block)
|
2014-09-08 09:57:27 +00:00
|
|
|
|
(export-block . org-man-export-block)
|
2013-03-19 15:24:40 +00:00
|
|
|
|
(export-snippet . org-man-export-snippet)
|
|
|
|
|
(fixed-width . org-man-fixed-width)
|
|
|
|
|
(footnote-definition . org-man-footnote-definition)
|
|
|
|
|
(footnote-reference . org-man-footnote-reference)
|
|
|
|
|
(headline . org-man-headline)
|
|
|
|
|
(horizontal-rule . org-man-horizontal-rule)
|
|
|
|
|
(inline-babel-call . org-man-inline-babel-call)
|
|
|
|
|
(inline-src-block . org-man-inline-src-block)
|
|
|
|
|
(inlinetask . org-man-inlinetask)
|
|
|
|
|
(italic . org-man-italic)
|
|
|
|
|
(item . org-man-item)
|
|
|
|
|
(keyword . org-man-keyword)
|
|
|
|
|
(line-break . org-man-line-break)
|
|
|
|
|
(link . org-man-link)
|
2013-09-25 19:27:29 +00:00
|
|
|
|
(node-property . org-man-node-property)
|
2013-03-19 15:24:40 +00:00
|
|
|
|
(paragraph . org-man-paragraph)
|
|
|
|
|
(plain-list . org-man-plain-list)
|
|
|
|
|
(plain-text . org-man-plain-text)
|
|
|
|
|
(planning . org-man-planning)
|
2013-09-25 19:27:29 +00:00
|
|
|
|
(property-drawer . org-man-property-drawer)
|
2013-03-19 15:24:40 +00:00
|
|
|
|
(quote-block . org-man-quote-block)
|
|
|
|
|
(radio-target . org-man-radio-target)
|
|
|
|
|
(section . org-man-section)
|
|
|
|
|
(special-block . org-man-special-block)
|
|
|
|
|
(src-block . org-man-src-block)
|
|
|
|
|
(statistics-cookie . org-man-statistics-cookie)
|
|
|
|
|
(strike-through . org-man-strike-through)
|
|
|
|
|
(subscript . org-man-subscript)
|
|
|
|
|
(superscript . org-man-superscript)
|
|
|
|
|
(table . org-man-table)
|
|
|
|
|
(table-cell . org-man-table-cell)
|
|
|
|
|
(table-row . org-man-table-row)
|
|
|
|
|
(target . org-man-target)
|
|
|
|
|
(template . org-man-template)
|
|
|
|
|
(timestamp . org-man-timestamp)
|
|
|
|
|
(underline . org-man-underline)
|
|
|
|
|
(verbatim . org-man-verbatim)
|
|
|
|
|
(verse-block . org-man-verse-block))
|
2012-09-09 11:08:52 +00:00
|
|
|
|
:menu-entry
|
2015-03-15 20:50:07 +00:00
|
|
|
|
'(?M "Export to MAN"
|
2013-03-19 15:24:40 +00:00
|
|
|
|
((?m "As MAN file" org-man-export-to-man)
|
|
|
|
|
(?p "As PDF file" org-man-export-to-pdf)
|
|
|
|
|
(?o "As PDF file and open"
|
|
|
|
|
(lambda (a s v b)
|
|
|
|
|
(if a (org-man-export-to-pdf t s v b)
|
|
|
|
|
(org-open-file (org-man-export-to-pdf nil s v b)))))))
|
2012-09-09 11:08:52 +00:00
|
|
|
|
:options-alist
|
2013-03-19 15:24:40 +00:00
|
|
|
|
'((:man-class "MAN_CLASS" nil nil t)
|
|
|
|
|
(:man-class-options "MAN_CLASS_OPTIONS" nil nil t)
|
2014-05-21 07:06:59 +00:00
|
|
|
|
(:man-header-extra "MAN_HEADER" nil nil newline)
|
|
|
|
|
;; Other variables.
|
|
|
|
|
(:man-tables-centered nil nil org-man-tables-centered)
|
|
|
|
|
(:man-tables-verbatim nil nil org-man-tables-verbatim)
|
|
|
|
|
(:man-table-scientific-notation nil nil org-man-table-scientific-notation)
|
|
|
|
|
(:man-source-highlight nil nil org-man-source-highlight)
|
2014-07-28 13:14:53 +00:00
|
|
|
|
(:man-source-highlight-langs nil nil org-man-source-highlight-langs)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; User Configurable Variables
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defgroup org-export-man nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Options for exporting Org mode files to Man."
|
|
|
|
|
:tag "Org Export Man"
|
|
|
|
|
:group 'org-export)
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Tables
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-tables-centered t
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"When non-nil, tables are exported in a center environment."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-tables-verbatim nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"When non-nil, tables are exported verbatim."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-table-scientific-notation "%sE%s"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Format string to display numbers in scientific notation.
|
|
|
|
|
The format should have \"%s\" twice, for mantissa and exponent
|
|
|
|
|
\(i.e. \"%s\\\\times10^{%s}\").
|
|
|
|
|
|
|
|
|
|
When nil, no transformation is made."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(const :tag "No formatting")))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Inlinetasks
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Src blocks
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-source-highlight nil
|
2019-09-20 22:27:53 +00:00
|
|
|
|
"Use GNU source highlight to embellish source blocks."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-source-highlight-langs
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
'((emacs-lisp "lisp") (lisp "lisp") (clojure "lisp")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(scheme "scheme")
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(c "c") (cc "cpp") (csharp "csharp") (d "d")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(fortran "fortran") (cobol "cobol") (pascal "pascal")
|
|
|
|
|
(ada "ada") (asm "asm")
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(perl "perl") (cperl "perl")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(python "python") (ruby "ruby") (tcl "tcl") (lua "lua")
|
|
|
|
|
(java "java") (javascript "javascript")
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(tex "latex")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(shell-script "sh") (awk "awk") (diff "diff") (m4 "m4")
|
|
|
|
|
(ocaml "caml") (caml "caml")
|
|
|
|
|
(sql "sql") (sqlite "sql")
|
|
|
|
|
(html "html") (css "css") (xml "xml")
|
|
|
|
|
(bat "bat") (bison "bison") (clipper "clipper")
|
|
|
|
|
(ldap "ldap") (opa "opa")
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(php "php") (postscript "postscript") (prolog "prolog")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(properties "properties") (makefile "makefile")
|
2021-09-26 12:13:28 +00:00
|
|
|
|
(tml "tml") (vbscript "vbscript") (xorg "xorg"))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Alist mapping languages to their listing language counterpart.
|
|
|
|
|
The key is a symbol, the major mode symbol without the \"-mode\".
|
|
|
|
|
The value is the string that should be inserted as the language
|
|
|
|
|
parameter for the listings package. If the mode name and the
|
|
|
|
|
listings name are the same, the language does not need an entry
|
|
|
|
|
in this list - but it does not hurt if it is present."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list
|
|
|
|
|
(symbol :tag "Major mode ")
|
|
|
|
|
(string :tag "Listings language"))))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Compilation
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-pdf-process
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'("tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
|
|
|
|
|
"tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
"tbl %f | eqn | groff -man | ps2pdf - > %b.pdf")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
"Commands to process a Man file to a PDF file.
|
2016-11-27 11:07:11 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
This is a list of strings, each of them will be given to the
|
|
|
|
|
shell as a command. %f in the command will be replaced by the
|
2016-11-27 11:07:11 +00:00
|
|
|
|
relative file name, %F by the absolute file name, %b by the file
|
|
|
|
|
base name (i.e. without directory and extension parts), %o by the
|
|
|
|
|
base directory of the file and %O by the absolute file name of
|
|
|
|
|
the output file.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
By default, Org uses 3 runs of to do the processing.
|
|
|
|
|
|
|
|
|
|
Alternatively, this may be a Lisp function that does the
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
processing. This function should accept the file name as
|
2012-07-28 20:20:41 +00:00
|
|
|
|
its single argument."
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:group 'org-export-man
|
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(repeat :tag "Shell command sequence"
|
|
|
|
|
(string :tag "Shell command"))
|
|
|
|
|
(const :tag "2 runs of pdfgroff"
|
|
|
|
|
("tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
|
2012-09-08 16:29:16 +00:00
|
|
|
|
"tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf" ))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(const :tag "3 runs of pdfgroff"
|
|
|
|
|
("tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
|
|
|
|
|
"tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"
|
|
|
|
|
"tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"))
|
|
|
|
|
(function)))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-logfiles-extensions
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'("log" "out" "toc")
|
|
|
|
|
"The list of file extensions to consider as Man logfiles."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat (string :tag "Extension")))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-man-remove-logfiles t
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Non-nil means remove the logfiles produced by PDF production.
|
|
|
|
|
These are the .aux, .log, .out, and .toc files."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-man
|
Add :version and :package-version
* ox.el (org-export-snippet-translation-alist)
(org-export-coding-system, org-export-in-background)
(org-export-async-init-file, org-export-invisible-backends)
(org-export-dispatch-use-expert-ui):
* ox-texinfo.el (org-texinfo-filename, org-texinfo-classes)
(org-texinfo-format-headline-function)
(org-texinfo-node-description-column)
(org-texinfo-active-timestamp-format)
(org-texinfo-link-with-unknown-path-format)
(org-texinfo-tables-verbatim)
(org-texinfo-table-scientific-notation)
(org-texinfo-text-markup-alist)
(org-texinfo-format-drawer-function)
(org-texinfo-format-inlinetask-function)
(org-texinfo-info-process):
* ox-man.el (org-man-tables-centered)
(org-man-table-scientific-notation)
(org-man-source-highlight, org-man-source-highlight-langs)
(org-man-pdf-process, org-man-logfiles-extensions):
* ox-html.el (org-html-allow-name-attribute-in-anchors)
(org-html-coding-system, org-html-divs):
* ox-ascii.el (org-ascii-text-width)
(org-ascii-headline-spacing, org-ascii-indented-line-width)
(org-ascii-paragraph-spacing, org-ascii-charset)
(org-ascii-underline, org-ascii-bullets)
(org-ascii-links-to-notes)
(org-ascii-table-keep-all-vertical-lines)
(org-ascii-table-widen-columns)
(org-ascii-table-use-ascii-art)
(org-ascii-format-drawer-function)
(org-ascii-format-inlinetask-function):
* org.el (org-modules, org-export-backends)
(org-highlight-latex-and-related, orgstruct-setup-hook):
* org-attach.el (org-attach-git-annex-cutoff):
* org-archive.el (org-archive-file-header-format):
* org-agenda.el (org-agenda-todo-ignore-time-comparison-use-seconds):
* ob-python.el (org-babel-python-hline-to)
(org-babel-python-None-to):
* ob-ditaa.el (org-ditaa-eps-jar-path):
* ob-core.el (org-babel-results-keyword): Add :version and
:package-version.
* ox-ascii.el: Use utf-8-emacs as the file coding system.
2013-03-05 15:34:16 +00:00
|
|
|
|
:version "24.4"
|
|
|
|
|
:package-version '(Org . "8.0")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
;;; Internal Functions
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man--caption/label-string (element info)
|
2012-09-13 15:00:55 +00:00
|
|
|
|
"Return caption and label Man string for ELEMENT.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-13 15:00:55 +00:00
|
|
|
|
INFO is a plist holding contextual information. If there's no
|
|
|
|
|
caption nor label, return the empty string.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
For non-floats, see `org-man--wrap-label'."
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(let ((label (org-element-property :label element))
|
|
|
|
|
(main (org-export-get-caption element))
|
|
|
|
|
(short (org-export-get-caption element t)))
|
|
|
|
|
(cond ((and (not main) (not label)) "")
|
|
|
|
|
((not main) (format "\\fI%s\\fP" label))
|
|
|
|
|
;; Option caption format with short name.
|
|
|
|
|
(short (format "\\fR%s\\fP - \\fI\\P - %s\n"
|
|
|
|
|
(org-export-data short info)
|
|
|
|
|
(org-export-data main info)))
|
|
|
|
|
;; Standard caption format.
|
|
|
|
|
(t (format "\\fR%s\\fP" (org-export-data main info))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man--wrap-label (element output)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
|
|
|
|
|
This function shouldn't be used for floats. See
|
2013-01-27 22:11:34 +00:00
|
|
|
|
`org-man--caption/label-string'."
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(let ((label (org-element-property :name element)))
|
|
|
|
|
(if (or (not output) (not label) (string= output "") (string= label ""))
|
|
|
|
|
output
|
|
|
|
|
(concat (format "%s\n.br\n" label) output))))
|
|
|
|
|
|
2017-10-19 19:51:31 +00:00
|
|
|
|
(defun org-man--protect-text (text)
|
|
|
|
|
"Protect minus and backslash characters in string TEXT."
|
2017-10-20 10:21:08 +00:00
|
|
|
|
(replace-regexp-in-string "-" "\\-" text nil t))
|
2017-10-19 19:51:31 +00:00
|
|
|
|
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(defun org-man--protect-example (text)
|
|
|
|
|
"Escape necessary characters for verbatim TEXT."
|
|
|
|
|
;; See man groff_man_style; \e must be used to render backslash.
|
|
|
|
|
;; Note that groff's .eo (disable backslash) and .ec (re-enable
|
|
|
|
|
;; backslash) cannot be used as per the same man page.
|
|
|
|
|
(replace-regexp-in-string "\\\\" "\\e" text nil t))
|
|
|
|
|
|
2012-10-26 22:36:00 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Template
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-template (contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return complete document string after Man conversion.
|
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist
|
|
|
|
|
holding export options."
|
2015-02-12 09:59:30 +00:00
|
|
|
|
(let* ((title (when (plist-get info :with-title)
|
ox: Optional export of title
* ox.el (org-export-with-title): New variable.
* ox (org-export-options-alist),
ox-ascii.el (org-ascii-template--document-title),
ox-beamer.el (org-beamer-template), ox-html.el (org-html-template),
ox-latex.el (org-latex-template), ox-man.el (org-man-template),
ox-odt.el (org-odt-template), ox-org.el (org-org-template),
ox-publish.el (org-publish-project-alist),
ox-texinfo.el (org-texinfo-template),
ox-groff.el (org-groff--mt-head): Use new variable.
* ox-koma-letter.el (org-koma-letter-use-title): Mark obsolete.
* test-ox.el (test-org-export/parse-option-keyword): Add :with-title.
* ORG-NEWS, org.texi: Mention org-export-with-title.
This is useful in e.g. ox-html where title can be set via
`org-html-preamble-template' or when using the {{{title}}}-macro.
2015-02-10 23:09:39 +00:00
|
|
|
|
(org-export-data (plist-get info :title) info)))
|
2021-09-29 07:22:47 +00:00
|
|
|
|
(attr (read (format "(%s)"
|
|
|
|
|
(mapconcat
|
|
|
|
|
#'identity
|
|
|
|
|
(list (plist-get info :man-class-options))
|
|
|
|
|
" "))))
|
|
|
|
|
(section-item (plist-get attr :section-id)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(concat
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(cond
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((and title (stringp section-item))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(format ".TH \"%s\" \"%s\" \n" title section-item))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((and (string= "" title) (stringp section-item))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(format ".TH \"%s\" \"%s\" \n" " " section-item))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(title
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(format ".TH \"%s\" \"1\" \n" title))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(t
|
|
|
|
|
".TH \" \" \"1\" "))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
contents)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;; Transcode Functions
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Babel Call
|
|
|
|
|
;;
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Babel Calls are ignored.
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Bold
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-bold (_bold contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode BOLD from Org to Man.
|
|
|
|
|
CONTENTS is the text with bold markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(format "\\fB%s\\fP" contents))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Center Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-center-block (center-block contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a CENTER-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the center block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
center-block
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(format ".ce %d\n.nf\n%s\n.fi"
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(- (length (split-string contents "\n")) 1 )
|
2012-07-28 20:20:41 +00:00
|
|
|
|
contents)))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Code
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-code (code _contents _info)
|
2017-10-18 20:54:40 +00:00
|
|
|
|
"Transcode a CODE object from Org to Man."
|
2017-10-19 19:51:31 +00:00
|
|
|
|
(format "\\fC%s\\fP"
|
|
|
|
|
(org-man--protect-text (org-element-property :value code))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Drawer
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-drawer (_drawer contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a DRAWER element from Org to Man.
|
2021-09-16 10:32:43 +00:00
|
|
|
|
DRAWER holds the drawer information
|
|
|
|
|
CONTENTS holds the contents of the block.
|
|
|
|
|
INFO is a plist holding contextual information."
|
2012-07-28 20:20:41 +00:00
|
|
|
|
contents)
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Dynamic Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-dynamic-block (dynamic-block contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a DYNAMIC-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information. See `org-export-data'."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--wrap-label dynamic-block contents))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Entity
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-entity (entity _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an ENTITY object from Org to Man.
|
|
|
|
|
CONTENTS are the definition itself. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2012-10-26 22:36:00 +00:00
|
|
|
|
(org-element-property :utf-8 entity))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Example Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-example-block (example-block _contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an EXAMPLE-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
example-block
|
|
|
|
|
(format ".RS\n.nf\n%s\n.fi\n.RE"
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(org-man--protect-example (org-export-format-code-default example-block info)))))
|
2012-10-26 22:36:00 +00:00
|
|
|
|
|
|
|
|
|
|
2014-09-08 09:57:27 +00:00
|
|
|
|
;;; Export Block
|
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-export-block (export-block _contents _info)
|
2014-09-08 09:57:27 +00:00
|
|
|
|
"Transcode a EXPORT-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(when (string= (org-element-property :type export-block) "MAN")
|
|
|
|
|
(org-remove-indentation (org-element-property :value export-block))))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Export Snippet
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-export-snippet (export-snippet _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a EXPORT-SNIPPET object from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(when (eq (org-export-snippet-backend export-snippet) 'man)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(org-element-property :value export-snippet)))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Fixed Width
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-fixed-width (fixed-width _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a FIXED-WIDTH element from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
fixed-width
|
2018-07-01 22:24:38 +00:00
|
|
|
|
(format "\\fC\n%s\n\\fP"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(org-remove-indentation
|
|
|
|
|
(org-element-property :value fixed-width)))))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Footnote Definition
|
|
|
|
|
;;
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Footnote Definitions are ignored.
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Footnote References
|
|
|
|
|
;;
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Footnote References are Ignored
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Headline
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-headline (headline contents info)
|
2013-02-23 12:47:44 +00:00
|
|
|
|
"Transcode a HEADLINE element from Org to Man.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((level (org-export-get-relative-level headline info))
|
2015-10-31 23:00:40 +00:00
|
|
|
|
;; Section formatting will set two placeholders: one for the
|
|
|
|
|
;; title and the other for the contents.
|
|
|
|
|
(section-fmt
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(pcase level
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(1 ".SH \"%s\"\n%s")
|
|
|
|
|
(2 ".SS \"%s\"\n%s")
|
|
|
|
|
(3 ".SS \"%s\"\n%s")
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(_ nil)))
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(text (org-export-data (org-element-property :title headline) info)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: This is a footnote section: ignore it.
|
|
|
|
|
((org-element-property :footnote-section-p headline) nil)
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; 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
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(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))))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Case 3. Standard headline. Export it as a section.
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(t (format section-fmt text contents )))))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Horizontal Rule
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Not supported
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Inline Babel Call
|
|
|
|
|
;;
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Inline Babel Calls are ignored.
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Inline Src Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-inline-src-block (inline-src-block _contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an INLINE-SRC-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((code (org-element-property :value inline-src-block)))
|
|
|
|
|
(cond
|
Use options instead of hard-coded variables
* lisp/ox-beamer.el (org-beamer--format-frame,
org-beamer--format-block, org-beamer-template): Use options instead
of hard-coded variables.
* lisp/ox-man.el (org-man-inline-src-block, org-man-src-block,
org-man-table, org-man-table-cell): Use options instead of
hard-coded variables.
* lisp/ox-md.el (org-md-headline): Use options instead of hard-coded
variables.
* lisp/ox-texinfo.el (org-texinfo-format-headline-function,
org-texinfo-format-inlinetask-function): Change default value.
(org-texinfo--text-markup, org-texinfo--format-menu): Change signature
(org-texinfo--build-menu, org-texinfo-bold, org-texinfo-code,
org-texinfo-comment, org-texinfo-italic, org-texinfo-verbatim): Apply
signature change.
(org-texinfo-template, org-texinfo-clock, org-texinfo-drawer,
org-texinfo-link, org-texinfo-plain-list, org-texinfo-planning,
org-texinfo-table, org-texinfo-table-cell, org-texinfo-timestamp): Use
options instead of variable names.
(org-texinfo-format-headline-default-function,
org-texinfo-format-inlinetask-default-function): New functions.
(org-texinfo-headline, org-texinfo-inlinetask): Use new functions.
2014-07-28 13:44:56 +00:00
|
|
|
|
((plist-get info :man-source-highlight)
|
2016-05-26 09:30:11 +00:00
|
|
|
|
(let* ((tmpdir temporary-file-directory)
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(in-file (make-temp-name
|
|
|
|
|
(expand-file-name "srchilite" tmpdir)))
|
|
|
|
|
(out-file (make-temp-name
|
|
|
|
|
(expand-file-name "reshilite" tmpdir)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(org-lang (org-element-property :language inline-src-block))
|
Use options instead of hard-coded variables
* lisp/ox-beamer.el (org-beamer--format-frame,
org-beamer--format-block, org-beamer-template): Use options instead
of hard-coded variables.
* lisp/ox-man.el (org-man-inline-src-block, org-man-src-block,
org-man-table, org-man-table-cell): Use options instead of
hard-coded variables.
* lisp/ox-md.el (org-md-headline): Use options instead of hard-coded
variables.
* lisp/ox-texinfo.el (org-texinfo-format-headline-function,
org-texinfo-format-inlinetask-function): Change default value.
(org-texinfo--text-markup, org-texinfo--format-menu): Change signature
(org-texinfo--build-menu, org-texinfo-bold, org-texinfo-code,
org-texinfo-comment, org-texinfo-italic, org-texinfo-verbatim): Apply
signature change.
(org-texinfo-template, org-texinfo-clock, org-texinfo-drawer,
org-texinfo-link, org-texinfo-plain-list, org-texinfo-planning,
org-texinfo-table, org-texinfo-table-cell, org-texinfo-timestamp): Use
options instead of variable names.
(org-texinfo-format-headline-default-function,
org-texinfo-format-inlinetask-default-function): New functions.
(org-texinfo-headline, org-texinfo-inlinetask): Use new functions.
2014-07-28 13:44:56 +00:00
|
|
|
|
(lst-lang
|
2024-02-24 09:48:35 +00:00
|
|
|
|
(and org-lang
|
|
|
|
|
(cadr (assq (intern org-lang)
|
|
|
|
|
(plist-get info :man-source-highlight-langs)))))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cmd (concat (expand-file-name "source-highlight")
|
|
|
|
|
" -s " lst-lang
|
|
|
|
|
" -f groff_man"
|
|
|
|
|
" -i " in-file
|
2012-09-08 16:29:16 +00:00
|
|
|
|
" -o " out-file )))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(if lst-lang
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(let ((code-block "" ))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(with-temp-file in-file (insert code))
|
|
|
|
|
(shell-command cmd)
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(setq code-block (org-file-contents out-file))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(delete-file in-file)
|
|
|
|
|
(delete-file out-file)
|
|
|
|
|
code-block)
|
|
|
|
|
(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE\n"
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(org-man--protect-example code)))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;; Do not use a special package: transcode it verbatim.
|
|
|
|
|
(t
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(concat ".RS\n.nf\n" "\\fC" "\n" (org-man--protect-example code) "\n"
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
"\\fP\n.fi\n.RE\n")))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Inlinetask
|
|
|
|
|
;;; Italic
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-italic (_italic contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode ITALIC from Org to Man.
|
|
|
|
|
CONTENTS is the text with italic markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\fI%s\\fP" contents))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Item
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-item (item contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an ITEM element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2012-08-08 16:31:05 +00:00
|
|
|
|
(let* ((bullet (org-element-property :bullet item))
|
2023-05-03 12:56:35 +00:00
|
|
|
|
(type (org-element-property :type (org-element-parent item)))
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(checkbox (pcase (org-element-property :checkbox item)
|
|
|
|
|
(`on "\\o'\\(sq\\(mu'")
|
|
|
|
|
(`off "\\(sq ")
|
|
|
|
|
(`trans "\\o'\\(sq\\(mi'")))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(tag (let ((tag (org-element-property :tag item)))
|
|
|
|
|
;; Check-boxes must belong to the tag.
|
|
|
|
|
(and tag (format "\\fB%s\\fP"
|
|
|
|
|
(concat checkbox
|
|
|
|
|
(org-export-data tag info)))))))
|
|
|
|
|
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(if (and (null tag) (null checkbox))
|
|
|
|
|
(let* ((bullet (org-trim bullet))
|
|
|
|
|
(marker (cond ((string= "-" bullet) "\\(em")
|
|
|
|
|
((string= "*" bullet) "\\(bu")
|
|
|
|
|
((eq type 'ordered)
|
|
|
|
|
(format "%s " (org-trim bullet)))
|
|
|
|
|
(t "\\(dg"))))
|
|
|
|
|
(concat ".IP " marker " 4\n"
|
|
|
|
|
(org-trim (or contents " " ))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(concat ".TP\n" (or tag (concat " " checkbox)) "\n"
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(org-trim (or contents " " ))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Keyword
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-keyword (keyword _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a KEYWORD element from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(let ((key (org-element-property :key keyword))
|
|
|
|
|
(value (org-element-property :value keyword)))
|
|
|
|
|
(cond
|
|
|
|
|
((string= key "MAN") value)
|
|
|
|
|
((string= key "INDEX") nil)
|
2012-09-08 16:29:16 +00:00
|
|
|
|
((string= key "TOC" ) nil))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Line Break
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-line-break (_line-break _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a LINE-BREAK object from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2017-03-26 09:59:19 +00:00
|
|
|
|
"\n.br\n")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Link
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2020-02-14 09:00:15 +00:00
|
|
|
|
(defun org-man-link (link desc info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a LINK object from Org to Man.
|
|
|
|
|
|
|
|
|
|
DESC is the description part of the link, or the empty string.
|
|
|
|
|
INFO is a plist holding contextual information. See
|
|
|
|
|
`org-export-data'."
|
2020-01-17 23:44:41 +00:00
|
|
|
|
(let* ((type (org-element-property :type link))
|
2020-02-20 08:29:21 +00:00
|
|
|
|
(raw-path (org-element-property :path link))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Ensure DESC really exists, or set it to nil.
|
|
|
|
|
(desc (and (not (string= desc "")) desc))
|
2020-02-20 08:29:21 +00:00
|
|
|
|
(path (pcase type
|
|
|
|
|
("file" (org-export-file-uri raw-path))
|
2024-02-05 15:39:05 +00:00
|
|
|
|
(_ (concat type ":" raw-path)))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
2015-01-04 20:54:41 +00:00
|
|
|
|
;; Link type is handled by a special function.
|
2020-02-14 09:00:15 +00:00
|
|
|
|
((org-export-custom-protocol-maybe link desc 'man info))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; External link with a description part.
|
|
|
|
|
((and path desc) (format "%s \\fBat\\fP \\fI%s\\fP" path desc))
|
|
|
|
|
;; External link without a description part.
|
|
|
|
|
(path (format "\\fI%s\\fP" path))
|
|
|
|
|
;; No path, only description. Try to do something useful.
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(t (format "\\fI%s\\fP" desc)))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-09-25 19:27:29 +00:00
|
|
|
|
;;;; Node Property
|
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-node-property (node-property _contents _info)
|
2013-09-25 19:27:29 +00:00
|
|
|
|
"Transcode a NODE-PROPERTY element from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "%s:%s"
|
|
|
|
|
(org-element-property :key node-property)
|
|
|
|
|
(let ((value (org-element-property :value node-property)))
|
|
|
|
|
(if value (concat " " value) ""))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Paragraph
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-paragraph (paragraph contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a PARAGRAPH element from Org to Man.
|
|
|
|
|
CONTENTS is the contents of the paragraph, as a string. INFO is
|
|
|
|
|
the plist used as a communication channel."
|
2023-05-03 12:56:35 +00:00
|
|
|
|
(let ((parent (org-element-parent paragraph)))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(when parent
|
2023-05-20 11:29:04 +00:00
|
|
|
|
(let ((parent-type (org-element-type parent))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(fixed-paragraph ""))
|
|
|
|
|
(cond ((and (eq parent-type 'item)
|
2023-05-20 11:29:04 +00:00
|
|
|
|
(org-element-property :bullet parent))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(setq fixed-paragraph (concat "" contents)))
|
|
|
|
|
((eq parent-type 'section)
|
|
|
|
|
(setq fixed-paragraph (concat ".PP\n" contents)))
|
|
|
|
|
((eq parent-type 'footnote-definition)
|
|
|
|
|
(setq fixed-paragraph contents))
|
|
|
|
|
(t (setq fixed-paragraph (concat "" contents))))
|
2023-05-20 11:29:04 +00:00
|
|
|
|
fixed-paragraph))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Plain List
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-plain-list (_plain-list contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a PLAIN-LIST element from Org to Man.
|
|
|
|
|
CONTENTS is the contents of the list. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
contents)
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Plain Text
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-plain-text (text info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TEXT string from Org to Man.
|
|
|
|
|
TEXT is the string to transcode. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2012-10-26 22:36:00 +00:00
|
|
|
|
(let ((output text))
|
|
|
|
|
;; Protect various chars.
|
|
|
|
|
(setq output (replace-regexp-in-string
|
|
|
|
|
"\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%$#&{}~^_\\]\\|$\\)"
|
|
|
|
|
"$\\" output nil t 1))
|
|
|
|
|
;; Activate smart quotes. Be sure to provide original TEXT string
|
|
|
|
|
;; since OUTPUT may have been modified.
|
|
|
|
|
(when (plist-get info :with-smart-quotes)
|
|
|
|
|
(setq output (org-export-activate-smart-quotes output :utf-8 info text)))
|
|
|
|
|
;; Handle break preservation if required.
|
|
|
|
|
(when (plist-get info :preserve-breaks)
|
|
|
|
|
(setq output (replace-regexp-in-string "\\(\\\\\\\\\\)?[ \t]*\n" ".br\n"
|
|
|
|
|
output)))
|
|
|
|
|
;; Return value.
|
|
|
|
|
output))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Planning
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Property Drawer
|
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-property-drawer (_property-drawer contents _info)
|
2013-09-25 19:27:29 +00:00
|
|
|
|
"Transcode a PROPERTY-DRAWER element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the drawer. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(and (org-string-nw-p contents)
|
|
|
|
|
(format ".RS\n.nf\n%s\n.fi\n.RE" contents)))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
|
|
|
|
;;; Quote Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-quote-block (quote-block contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a QUOTE-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
quote-block
|
|
|
|
|
(format ".RS\n%s\n.RE" contents)))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Radio Target
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-radio-target (_radio-target text _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a RADIO-TARGET object from Org to Man.
|
|
|
|
|
TEXT is the text of the target. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2015-10-31 23:00:40 +00:00
|
|
|
|
text)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Section
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-section (_section contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SECTION element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the section. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
contents)
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Special Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-special-block (special-block contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SPECIAL-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(org-man--wrap-label special-block (format "%s\n" contents)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Src Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-src-block (src-block _contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SRC-BLOCK element from Org to Man.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(if (not (plist-get info :man-source-highlight))
|
|
|
|
|
(format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(org-man--protect-example (org-export-format-code-default src-block info)))
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(let* ((tmpdir temporary-file-directory)
|
|
|
|
|
(in-file (make-temp-name (expand-file-name "srchilite" tmpdir)))
|
|
|
|
|
(out-file (make-temp-name (expand-file-name "reshilite" tmpdir)))
|
|
|
|
|
(code (org-element-property :value src-block))
|
|
|
|
|
(org-lang (org-element-property :language src-block))
|
|
|
|
|
(lst-lang
|
2024-02-24 09:48:35 +00:00
|
|
|
|
(and org-lang
|
|
|
|
|
(cadr (assq (intern org-lang)
|
|
|
|
|
(plist-get info :man-source-highlight-langs)))))
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(cmd (concat "source-highlight"
|
|
|
|
|
" -s " lst-lang
|
|
|
|
|
" -f groff_man "
|
|
|
|
|
" -i " in-file
|
|
|
|
|
" -o " out-file)))
|
|
|
|
|
(if lst-lang
|
|
|
|
|
(let ((code-block ""))
|
|
|
|
|
(with-temp-file in-file (insert code))
|
|
|
|
|
(shell-command cmd)
|
|
|
|
|
(setq code-block (org-file-contents out-file))
|
|
|
|
|
(delete-file in-file)
|
|
|
|
|
(delete-file out-file)
|
|
|
|
|
code-block)
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" (org-man--protect-example code))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Statistics Cookie
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-statistics-cookie (statistics-cookie _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a STATISTICS-COOKIE object from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(org-element-property :value statistics-cookie))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Strike-Through
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-strike-through (_strike-through contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode STRIKE-THROUGH from Org to Man.
|
|
|
|
|
CONTENTS is the text with strike-through markup. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(format "\\fI%s\\fP" contents))
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Subscript
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-subscript (_subscript contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SUBSCRIPT object from Org to Man.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\d\\s-2%s\\s+2\\u" contents))
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Superscript "^_%s$
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-superscript (_superscript contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SUPERSCRIPT object from Org to Man.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\u\\s-2%s\\s+2\\d" contents))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Table
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-man-table' is the entry point for table transcoding. It
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; takes care of tables with a "verbatim" attribute. Otherwise, it
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; delegates the job to either `org-man-table--table.el-table' or
|
|
|
|
|
;; `org-man-table--org-table' functions, depending of the type of
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; the table.
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-man-table--align-string' is a subroutine used to build
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; alignment string for Org tables.
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-table (table contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TABLE element from Org to Man.
|
|
|
|
|
CONTENTS is the contents of the table. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: verbatim table.
|
Use options instead of hard-coded variables
* lisp/ox-beamer.el (org-beamer--format-frame,
org-beamer--format-block, org-beamer-template): Use options instead
of hard-coded variables.
* lisp/ox-man.el (org-man-inline-src-block, org-man-src-block,
org-man-table, org-man-table-cell): Use options instead of
hard-coded variables.
* lisp/ox-md.el (org-md-headline): Use options instead of hard-coded
variables.
* lisp/ox-texinfo.el (org-texinfo-format-headline-function,
org-texinfo-format-inlinetask-function): Change default value.
(org-texinfo--text-markup, org-texinfo--format-menu): Change signature
(org-texinfo--build-menu, org-texinfo-bold, org-texinfo-code,
org-texinfo-comment, org-texinfo-italic, org-texinfo-verbatim): Apply
signature change.
(org-texinfo-template, org-texinfo-clock, org-texinfo-drawer,
org-texinfo-link, org-texinfo-plain-list, org-texinfo-planning,
org-texinfo-table, org-texinfo-table-cell, org-texinfo-timestamp): Use
options instead of variable names.
(org-texinfo-format-headline-default-function,
org-texinfo-format-inlinetask-default-function): New functions.
(org-texinfo-headline, org-texinfo-inlinetask): Use new functions.
2014-07-28 13:44:56 +00:00
|
|
|
|
((or (plist-get info :man-tables-verbatim)
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(let ((attr (read (format "(%s)"
|
2021-09-29 07:22:47 +00:00
|
|
|
|
(mapconcat
|
|
|
|
|
#'identity
|
|
|
|
|
(org-element-property :attr_man table)
|
|
|
|
|
" ")))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(and attr (plist-get attr :verbatim))))
|
|
|
|
|
|
|
|
|
|
(format ".nf\n\\fC%s\\fP\n.fi"
|
|
|
|
|
;; Re-create table, without affiliated keywords.
|
2024-04-14 11:05:59 +00:00
|
|
|
|
(org-man--protect-example
|
|
|
|
|
(org-trim
|
|
|
|
|
(org-element-interpret-data
|
|
|
|
|
`(table nil ,@(org-element-contents table)))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Case 2: Standard table.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (org-man-table--org-table table contents info))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-table--align-string (divider table info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return an appropriate Man alignment string.
|
|
|
|
|
TABLE is the considered table. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let (alignment)
|
|
|
|
|
;; Extract column groups and alignment from first (non-rule) row.
|
|
|
|
|
(org-element-map
|
|
|
|
|
(org-element-map table 'table-row
|
|
|
|
|
(lambda (row)
|
|
|
|
|
(and (eq (org-element-property :type row) 'standard) row))
|
|
|
|
|
info 'first-match)
|
|
|
|
|
'table-cell
|
|
|
|
|
(lambda (cell)
|
|
|
|
|
(let* ((borders (org-export-table-cell-borders cell info))
|
|
|
|
|
(raw-width (org-export-table-cell-width cell info))
|
|
|
|
|
(width-cm (when raw-width (/ raw-width 5)))
|
|
|
|
|
(width (if raw-width (format "w(%dc)"
|
|
|
|
|
(if (< width-cm 1) 1 width-cm)) "")))
|
|
|
|
|
;; Check left border for the first cell only.
|
|
|
|
|
(when (and (memq 'left borders) (not alignment))
|
|
|
|
|
(push "|" alignment))
|
|
|
|
|
(push
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(concat (pcase (org-export-table-cell-alignment cell info)
|
|
|
|
|
(`left "l") (`right "r") (`center "c"))
|
|
|
|
|
width
|
|
|
|
|
divider)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
alignment)
|
|
|
|
|
(when (memq 'right borders) (push "|" alignment))))
|
|
|
|
|
info)
|
2016-07-25 14:09:16 +00:00
|
|
|
|
(apply #'concat (reverse alignment))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
|
|
|
|
|
(defun org-man-table--org-table (table contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return appropriate Man code for an Org table.
|
|
|
|
|
|
|
|
|
|
TABLE is the table type element to transcode. CONTENTS is its
|
|
|
|
|
contents, as a string. INFO is a plist used as a communication
|
|
|
|
|
channel.
|
|
|
|
|
|
|
|
|
|
This function assumes TABLE has `org' as its `:type' attribute."
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(let* ((attr (org-export-read-attribute :attr_man table))
|
|
|
|
|
(caption (and (not (plist-get attr :disable-caption))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-man--caption/label-string table info)))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(divider (if (plist-get attr :divider) "|" " "))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;; Determine alignment string.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(alignment (org-man-table--align-string divider table info))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Extract others display options.
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(lines (org-split-string contents "\n"))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(attr-list
|
2013-03-08 23:58:31 +00:00
|
|
|
|
(delq nil
|
|
|
|
|
(list
|
|
|
|
|
(and (plist-get attr :expand) "expand")
|
|
|
|
|
(let ((placement (plist-get attr :placement)))
|
|
|
|
|
(cond ((string= placement 'center) "center")
|
|
|
|
|
((string= placement 'left) nil)
|
Use options instead of hard-coded variables
* lisp/ox-beamer.el (org-beamer--format-frame,
org-beamer--format-block, org-beamer-template): Use options instead
of hard-coded variables.
* lisp/ox-man.el (org-man-inline-src-block, org-man-src-block,
org-man-table, org-man-table-cell): Use options instead of
hard-coded variables.
* lisp/ox-md.el (org-md-headline): Use options instead of hard-coded
variables.
* lisp/ox-texinfo.el (org-texinfo-format-headline-function,
org-texinfo-format-inlinetask-function): Change default value.
(org-texinfo--text-markup, org-texinfo--format-menu): Change signature
(org-texinfo--build-menu, org-texinfo-bold, org-texinfo-code,
org-texinfo-comment, org-texinfo-italic, org-texinfo-verbatim): Apply
signature change.
(org-texinfo-template, org-texinfo-clock, org-texinfo-drawer,
org-texinfo-link, org-texinfo-plain-list, org-texinfo-planning,
org-texinfo-table, org-texinfo-table-cell, org-texinfo-timestamp): Use
options instead of variable names.
(org-texinfo-format-headline-default-function,
org-texinfo-format-inlinetask-default-function): New functions.
(org-texinfo-headline, org-texinfo-inlinetask): Use new functions.
2014-07-28 13:44:56 +00:00
|
|
|
|
((plist-get info :man-tables-centered) "center")
|
|
|
|
|
(t "")))
|
2013-03-08 23:58:31 +00:00
|
|
|
|
(or (plist-get attr :boxtype) "box"))))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(title-line (plist-get attr :title-line))
|
|
|
|
|
(long-cells (plist-get attr :long-cells))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(table-format (concat
|
|
|
|
|
(format "%s" (or (car attr-list) "" ))
|
|
|
|
|
(or
|
|
|
|
|
(let ((output-list '()))
|
|
|
|
|
(when (cdr attr-list)
|
|
|
|
|
(dolist (attr-item (cdr attr-list))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(setq output-list (concat output-list (format ",%s" attr-item)))))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
output-list)
|
|
|
|
|
"")))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(first-line (when lines (org-split-string (car lines) "\t"))))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
;; Prepare the final format string for the table.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; Others.
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(lines (concat ".TS\n " table-format ";\n"
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(format "%s.\n"
|
|
|
|
|
(let ((final-line ""))
|
|
|
|
|
(when title-line
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(dotimes (_ (length first-line))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
(setq final-line (concat final-line "cb" divider))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
(setq final-line (concat final-line "\n"))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(if alignment
|
|
|
|
|
(setq final-line (concat final-line alignment))
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(dotimes (_ (length first-line))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(setq final-line (concat final-line "c" divider))))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
final-line ))
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(format "%s.TE\n"
|
|
|
|
|
(let ((final-line "")
|
|
|
|
|
(long-line "")
|
|
|
|
|
(lines (org-split-string contents "\n")))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
(dolist (line-item lines)
|
|
|
|
|
(setq long-line "")
|
|
|
|
|
|
|
|
|
|
(if long-cells
|
|
|
|
|
(progn
|
|
|
|
|
(if (string= line-item "_")
|
|
|
|
|
(setq long-line (format "%s\n" line-item))
|
|
|
|
|
;; else string =
|
|
|
|
|
(let ((cell-item-list (org-split-string line-item "\t")))
|
|
|
|
|
(dolist (cell-item cell-item-list)
|
|
|
|
|
|
|
|
|
|
(cond ((eq cell-item (car (last cell-item-list)))
|
|
|
|
|
(setq long-line (concat long-line
|
|
|
|
|
(format "T{\n%s\nT}\t\n" cell-item ))))
|
|
|
|
|
(t
|
|
|
|
|
(setq long-line (concat long-line
|
|
|
|
|
(format "T{\n%s\nT}\t" cell-item ))))))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
long-line))
|
|
|
|
|
;; else long cells
|
|
|
|
|
(setq final-line (concat final-line long-line )))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
|
|
|
|
|
(setq final-line (concat final-line line-item "\n"))))
|
|
|
|
|
final-line))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(and caption (format ".TB \"%s\"" caption)))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Table Cell
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-table-cell (table-cell contents info)
|
2023-11-05 09:31:39 +00:00
|
|
|
|
"Transcode a TABLE-CELL element from Org to Man.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
CONTENTS is the cell contents. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
Use options instead of hard-coded variables
* lisp/ox-beamer.el (org-beamer--format-frame,
org-beamer--format-block, org-beamer-template): Use options instead
of hard-coded variables.
* lisp/ox-man.el (org-man-inline-src-block, org-man-src-block,
org-man-table, org-man-table-cell): Use options instead of
hard-coded variables.
* lisp/ox-md.el (org-md-headline): Use options instead of hard-coded
variables.
* lisp/ox-texinfo.el (org-texinfo-format-headline-function,
org-texinfo-format-inlinetask-function): Change default value.
(org-texinfo--text-markup, org-texinfo--format-menu): Change signature
(org-texinfo--build-menu, org-texinfo-bold, org-texinfo-code,
org-texinfo-comment, org-texinfo-italic, org-texinfo-verbatim): Apply
signature change.
(org-texinfo-template, org-texinfo-clock, org-texinfo-drawer,
org-texinfo-link, org-texinfo-plain-list, org-texinfo-planning,
org-texinfo-table, org-texinfo-table-cell, org-texinfo-timestamp): Use
options instead of variable names.
(org-texinfo-format-headline-default-function,
org-texinfo-format-inlinetask-default-function): New functions.
(org-texinfo-headline, org-texinfo-inlinetask): Use new functions.
2014-07-28 13:44:56 +00:00
|
|
|
|
(concat
|
|
|
|
|
(let ((scientific-format (plist-get info :man-table-scientific-notation)))
|
|
|
|
|
(if (and contents
|
|
|
|
|
scientific-format
|
|
|
|
|
(string-match orgtbl-exp-regexp contents))
|
|
|
|
|
;; Use appropriate format string for scientific notation.
|
|
|
|
|
(format scientific-format
|
|
|
|
|
(match-string 1 contents)
|
|
|
|
|
(match-string 2 contents))
|
|
|
|
|
contents))
|
|
|
|
|
(when (org-export-get-next-element table-cell info) "\t")))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Table Row
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-table-row (table-row contents info)
|
2015-10-31 23:00:40 +00:00
|
|
|
|
"Transcode a TABLE-ROW element from Org to Man.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
CONTENTS is the contents of the row. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
2015-10-31 23:00:40 +00:00
|
|
|
|
;; Rules are ignored since table separators are deduced from borders
|
|
|
|
|
;; of the current row.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(when (eq (org-element-property :type table-row) 'standard)
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(let ((borders
|
|
|
|
|
;; TABLE-ROW's borders are extracted from its first cell.
|
|
|
|
|
(org-export-table-cell-borders
|
|
|
|
|
(car (org-element-contents table-row)) info)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(concat
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(cond ((and (memq 'top borders) (memq 'above borders)) "_\n"))
|
2012-09-08 16:29:16 +00:00
|
|
|
|
contents
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(cond ((and (memq 'bottom borders) (memq 'below borders)) "\n_")
|
|
|
|
|
((memq 'below borders) "\n_"))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Target
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-target (target _contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TARGET object from Org to Man.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
2015-04-13 09:24:42 +00:00
|
|
|
|
(format "\\fI%s\\fP" (org-export-get-reference target info)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Timestamp
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-timestamp (_timestamp _contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TIMESTAMP object from Org to Man.
|
2017-07-06 07:23:30 +00:00
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2015-10-31 23:00:40 +00:00
|
|
|
|
"")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Underline
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-underline (_underline contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode UNDERLINE from Org to Man.
|
|
|
|
|
CONTENTS is the text with underline markup. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(format "\\fI%s\\fP" contents))
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Verbatim
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2017-10-18 20:54:40 +00:00
|
|
|
|
(defun org-man-verbatim (verbatim _contents _info)
|
|
|
|
|
"Transcode a VERBATIM object from Org to Man."
|
2017-10-19 19:51:31 +00:00
|
|
|
|
(format "\\fI%s\\fP"
|
|
|
|
|
(org-man--protect-text (org-element-property :value verbatim))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-08 16:29:16 +00:00
|
|
|
|
;;; Verse Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2015-10-31 23:00:40 +00:00
|
|
|
|
(defun org-man-verse-block (_verse-block contents _info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a VERSE-BLOCK element from Org to Man.
|
2019-09-20 22:27:53 +00:00
|
|
|
|
CONTENTS is verse block contents. INFO is a plist holding
|
2012-07-28 20:20:41 +00:00
|
|
|
|
contextual information."
|
|
|
|
|
(format ".RS\n.ft I\n%s\n.ft\n.RE" contents))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Interactive functions
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-export-to-man
|
2021-09-29 07:22:47 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Export current buffer to a Man file.
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 16:24:19 +00:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
When optional argument BODY-ONLY is non-nil, only the body
|
2012-07-28 20:20:41 +00:00
|
|
|
|
without any markers.
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return output file's name."
|
|
|
|
|
(interactive)
|
2012-11-29 20:52:43 +00:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".man" subtreep)))
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 08:35:42 +00:00
|
|
|
|
(org-export-to-file 'man outfile
|
|
|
|
|
async subtreep visible-only body-only ext-plist)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-export-to-pdf
|
2021-09-29 07:22:47 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Export current buffer to Groff then process through to PDF.
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 16:24:19 +00:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write between
|
Code Cleanup
* org-e-man.el (org-e-man-pdf-process)
(org-e-man--caption/label-string, org-e-man-template)
(org-e-man--caption/label-string)
(org-e-man-source-highlight-langs, org-e-man-bold)
(org-e-man-center-block, org-e-man-clock, org-e-man-code)
(org-e-man-example-block, org-e-man-headline)
(org-e-man-inline-src-block, org-e-man-item, org-e-man-keyword)
(org-e-man-link, org-e-man-paragraph, org-e-man-radio-target)
(org-e-man-macro, org-e-man-src-block, org-e-man-table)
(org-e-man-table--align-string, org-e-man-table--org-table)
(org-e-man-collect-errors): Code clean-up.
* org-e-groff.el (org-e-groff-classes, org-e-groff-special-char)
(org-e-groff-pdf-process, org-e-groff-registered-references)
(org-e-groff--caption/label-string, org-e-groff--text-markup)
(org-e-groff-template, org-e-groff-footnote-reference)
(org-e-groff-headline, org-e-groff-inline-src-block)
(org-e-groff-item, org-e-groff-link--inline-image)
(org-e-groff-link, org-e-groff-paragraph)
(org-e-groff-plain-list, org-e-groff-plain-text)
(org-e-groff-src-block, org-e-groff-table)
(org-e-groff-table--align-string, )
(org-e-groff-table--org-table, org-e-groff-table-cell)
(org-e-groff-table-row, org-e-groff-export-to-groff)
(org-e-groff-collect-errors): Code cleanup.
2012-08-08 10:04:56 +00:00
|
|
|
|
markers.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return PDF file's name."
|
|
|
|
|
(interactive)
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 08:35:42 +00:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".man" subtreep)))
|
|
|
|
|
(org-export-to-file 'man outfile
|
|
|
|
|
async subtreep visible-only body-only ext-plist
|
2021-11-29 08:54:33 +00:00
|
|
|
|
#'org-latex-compile)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-man-compile (file)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Compile a Groff file.
|
|
|
|
|
|
2012-10-25 14:06:18 +00:00
|
|
|
|
FILE is the name of the file being compiled. Processing is done
|
2013-01-27 22:11:34 +00:00
|
|
|
|
through the command specified in `org-man-pdf-process'.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
Return PDF file name or an error if it couldn't be produced."
|
2016-05-17 21:37:18 +00:00
|
|
|
|
(message "Processing Groff file %s..." file)
|
|
|
|
|
(let ((output (org-compile-file file org-man-pdf-process "pdf")))
|
|
|
|
|
(when org-man-remove-logfiles
|
|
|
|
|
(let ((base (file-name-sans-extension output)))
|
|
|
|
|
(dolist (ext org-man-logfiles-extensions)
|
|
|
|
|
(let ((file (concat base "." ext)))
|
|
|
|
|
(when (file-exists-p file) (delete-file file))))))
|
|
|
|
|
(message "Process completed.")
|
|
|
|
|
output))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(provide 'ox-man)
|
|
|
|
|
|
|
|
|
|
;;; ox-man.el ends here
|