2013-02-26 10:28:59 +00:00
|
|
|
|
;;; ox-groff.el --- Groff Back-End for Org Export Engine
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-01 15:04:24 +00:00
|
|
|
|
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
|
|
|
|
;; Author: Luis R Anaya <papoanaya aroba hot mail punto com>
|
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, wp
|
|
|
|
|
|
2013-03-10 16:57:47 +00:00
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; 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.
|
|
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; 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
|
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; This library implements a Groff Memorandum Macro back-end 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 'groff "*Test Groff*") RET
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; in an org-mode buffer then switch to the buffer to see the Groff
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; export. See ox.el for more details on how this exporter works.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; It introduces two new buffer keywords: "GROFF_CLASS" and
|
|
|
|
|
;; "GROFF_CLASS_OPTIONS".
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(eval-when-compile (require 'cl))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(require 'ox)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-10-04 12:45:28 +00:00
|
|
|
|
(defvar orgtbl-exp-regexp)
|
2012-09-22 09:27:30 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Define Back-End
|
|
|
|
|
|
2013-03-19 15:26:30 +00:00
|
|
|
|
(org-export-define-backend 'groff
|
|
|
|
|
'((bold . org-groff-bold)
|
|
|
|
|
(center-block . org-groff-center-block)
|
|
|
|
|
(clock . org-groff-clock)
|
|
|
|
|
(code . org-groff-code)
|
|
|
|
|
(comment . (lambda (&rest args) ""))
|
|
|
|
|
(comment-block . (lambda (&rest args) ""))
|
|
|
|
|
(drawer . org-groff-drawer)
|
|
|
|
|
(dynamic-block . org-groff-dynamic-block)
|
|
|
|
|
(entity . org-groff-entity)
|
|
|
|
|
(example-block . org-groff-example-block)
|
|
|
|
|
(export-block . org-groff-export-block)
|
|
|
|
|
(export-snippet . org-groff-export-snippet)
|
|
|
|
|
(fixed-width . org-groff-fixed-width)
|
|
|
|
|
(footnote-definition . org-groff-footnote-definition)
|
|
|
|
|
(footnote-reference . org-groff-footnote-reference)
|
|
|
|
|
(headline . org-groff-headline)
|
|
|
|
|
(horizontal-rule . org-groff-horizontal-rule)
|
|
|
|
|
(inline-src-block . org-groff-inline-src-block)
|
|
|
|
|
(inlinetask . org-groff-inlinetask)
|
|
|
|
|
(italic . org-groff-italic)
|
|
|
|
|
(item . org-groff-item)
|
|
|
|
|
(keyword . org-groff-keyword)
|
|
|
|
|
(line-break . org-groff-line-break)
|
|
|
|
|
(link . org-groff-link)
|
|
|
|
|
(paragraph . org-groff-paragraph)
|
|
|
|
|
(plain-list . org-groff-plain-list)
|
|
|
|
|
(plain-text . org-groff-plain-text)
|
|
|
|
|
(planning . org-groff-planning)
|
|
|
|
|
(property-drawer . (lambda (&rest args) ""))
|
|
|
|
|
(quote-block . org-groff-quote-block)
|
|
|
|
|
(quote-section . org-groff-quote-section)
|
|
|
|
|
(radio-target . org-groff-radio-target)
|
|
|
|
|
(section . org-groff-section)
|
|
|
|
|
(special-block . org-groff-special-block)
|
|
|
|
|
(src-block . org-groff-src-block)
|
|
|
|
|
(statistics-cookie . org-groff-statistics-cookie)
|
|
|
|
|
(strike-through . org-groff-strike-through)
|
|
|
|
|
(subscript . org-groff-subscript)
|
|
|
|
|
(superscript . org-groff-superscript)
|
|
|
|
|
(table . org-groff-table)
|
|
|
|
|
(table-cell . org-groff-table-cell)
|
|
|
|
|
(table-row . org-groff-table-row)
|
|
|
|
|
(target . org-groff-target)
|
|
|
|
|
(template . org-groff-template)
|
|
|
|
|
(timestamp . org-groff-timestamp)
|
|
|
|
|
(underline . org-groff-underline)
|
|
|
|
|
(verbatim . org-groff-verbatim)
|
|
|
|
|
(verse-block . org-groff-verse-block))
|
2012-09-09 11:08:52 +00:00
|
|
|
|
:export-block "GROFF"
|
|
|
|
|
:menu-entry
|
2013-03-19 15:26:30 +00:00
|
|
|
|
'(?g "Export to GROFF"
|
|
|
|
|
((?g "As GROFF file" org-groff-export-to-groff)
|
|
|
|
|
(?p "As PDF file" org-groff-export-to-pdf)
|
|
|
|
|
(?o "As PDF file and open"
|
|
|
|
|
(lambda (a s v b)
|
|
|
|
|
(if a (org-groff-export-to-pdf t s v b)
|
|
|
|
|
(org-open-file (org-groff-export-to-pdf nil s v b)))))))
|
2012-09-09 11:08:52 +00:00
|
|
|
|
:options-alist
|
2013-03-19 15:26:30 +00:00
|
|
|
|
'((:groff-class "GROFF_CLASS" nil org-groff-default-class t)
|
|
|
|
|
(:groff-class-options "GROFF_CLASS_OPTIONS" nil nil t)
|
|
|
|
|
(:groff-header-extra "GROFF_HEADER" nil nil newline)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; User Configurable Variables
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defgroup org-export-groff nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Options for exporting Org mode files to Groff."
|
|
|
|
|
:tag "Org Export Groff"
|
|
|
|
|
:group 'org-export)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Preamble
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-default-class "internal"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"The default Groff class."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(string :tag "Groff class"))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-classes
|
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
|
|
|
|
'(("file" ".MT 1"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "toc"))
|
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" ".MT 0"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "toc"))
|
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
|
|
|
|
("programmer" ".MT 2"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "toc"))
|
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
|
|
|
|
("engineer" ".MT 3"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "toc"))
|
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
|
|
|
|
("external" ".MT 4"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "toc"))
|
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
|
|
|
|
("letter" ".MT 5"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo" :last-section "sign"))
|
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
|
|
|
|
("custom" ".so file"
|
|
|
|
|
(:heading custom-function :type "custom" :last-section "toc"))
|
|
|
|
|
("dummy" ""
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "memo"))
|
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
|
|
|
|
("ms" "ms"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "cover" :last-section "toc"))
|
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
|
|
|
|
("se_ms" "se_ms"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(:heading 'default :type "cover" :last-section "toc"))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
("block" "BL"
|
|
|
|
|
(:heading 'default :type "letter" :last-section "sign"))
|
|
|
|
|
("semiblock" "SB"
|
|
|
|
|
(:heading 'default :type "letter" :last-section "sign"))
|
|
|
|
|
("fullblock" "FB"
|
|
|
|
|
(:heading 'default :type "letter" :last-section "sign"))
|
|
|
|
|
("simplified" "SP"
|
|
|
|
|
(:heading 'default :type "letter" :last-section "sign"))
|
|
|
|
|
("none" "" (:heading 'default :type "custom")))
|
|
|
|
|
|
|
|
|
|
;; none means, no Cover or Memorandum Type and no calls to AU, AT, ND and TL
|
|
|
|
|
;; This is to facilitate the creation of custom pages.
|
|
|
|
|
|
|
|
|
|
;; dummy means, no Cover or Memorandum Type but calls to AU, AT, ND and TL
|
|
|
|
|
;; are made. This is to facilitate Abstract Insertion.
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"This list describes the attributes for the documents being created.
|
|
|
|
|
It allows for the creation of new "
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list (string :tag "Document Type")
|
|
|
|
|
(string :tag "Header")
|
|
|
|
|
(repeat :tag "Options" :inline t
|
|
|
|
|
(choice
|
|
|
|
|
(list :tag "Heading")
|
|
|
|
|
(function :tag "Hook computing sectioning"))))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Headline
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defconst org-groff-special-tags
|
2012-08-10 14:14:00 +00:00
|
|
|
|
'("FROM" "TO" "ABSTRACT" "APPENDIX" "BODY" "NS"))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-format-headline-function nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Function to format headline text.
|
|
|
|
|
|
|
|
|
|
This function will be called with 5 arguments:
|
|
|
|
|
TODO the todo keyword (string or nil).
|
|
|
|
|
TODO-TYPE the type of todo (symbol: `todo', `done', nil)
|
|
|
|
|
PRIORITY the priority of the headline (integer or nil)
|
|
|
|
|
TEXT the main headline text (string).
|
|
|
|
|
TAGS the tags as a list of strings (list of strings or nil).
|
|
|
|
|
|
|
|
|
|
The function result will be used in the section format string.
|
|
|
|
|
|
|
|
|
|
As an example, one could set the variable to the following, in
|
|
|
|
|
order to reproduce the default set-up:
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
\(defun org-groff-format-headline (todo todo-type priority text tags)
|
2013-02-23 12:47:44 +00:00
|
|
|
|
\"Default format function for a headline.\"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
\(concat (when todo
|
|
|
|
|
\(format \"\\fB%s\\fP \" todo))
|
|
|
|
|
\(when priority
|
|
|
|
|
\(format \"[\\#%c] \" priority))
|
|
|
|
|
text
|
|
|
|
|
\(when tags
|
|
|
|
|
\(format \" %s \"
|
|
|
|
|
\(mapconcat 'identity tags \":\"))))"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Timestamps
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-active-timestamp-format "\\fI%s\\fP"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"A printf format string to be applied to active timestamps."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-inactive-timestamp-format "\\fI%s\\fP"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"A printf format string to be applied to inactive timestamps."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-diary-timestamp-format "\\fI%s\\fP"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"A printf format string to be applied to diary timestamps."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Links
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-inline-image-rules
|
2012-09-03 21:24:58 +00:00
|
|
|
|
'(("file" . "\\.\\(jpg\\|png\\|pdf\\|ps\\|eps\\|pic\\)\\'")
|
|
|
|
|
("fuzzy" . "\\.\\(jpg\\|png\\|pdf\\|ps\\|eps\\|pic\\)\\'"))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Rules characterizing image files that can be inlined into Groff.
|
|
|
|
|
|
|
|
|
|
A rule consists in an association whose key is the type of link
|
|
|
|
|
to consider, and value is a regexp that will be matched against
|
|
|
|
|
link's path.
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
Note that, by default, the image extensions actually allowed
|
2012-07-28 20:20:41 +00:00
|
|
|
|
depend on the way the Groff file is processed. When used with
|
|
|
|
|
pdfgroff, pdf, jpg and png images are OK. When processing
|
|
|
|
|
through dvi to Postscript, only ps and eps are allowed. The
|
|
|
|
|
default we use here encompasses both."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(alist :key-type (string :tag "Type")
|
|
|
|
|
:value-type (regexp :tag "Path")))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-link-with-unknown-path-format "\\fI%s\\fP"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Format string for links with unknown path type."
|
|
|
|
|
:group 'org-export-groff
|
|
|
|
|
:type 'string)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Tables
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-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-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-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-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-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-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(string :tag "Format string")
|
|
|
|
|
(const :tag "No formatting")))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Text markup
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-text-markup-alist
|
2012-08-10 14:14:00 +00:00
|
|
|
|
'((bold . "\\fB%s\\fP")
|
2012-08-08 12:11:09 +00:00
|
|
|
|
(code . "\\fC%s\\fP")
|
|
|
|
|
(italic . "\\fI%s\\fP")
|
|
|
|
|
(strike-through . "\\fC%s\\fP") ; Strike through and underline
|
|
|
|
|
(underline . "\\fI%s\\fP") ; need to be revised.
|
|
|
|
|
(verbatim . "protectedtexttt"))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Alist of Groff expressions to convert text markup.
|
|
|
|
|
|
|
|
|
|
The key must be a symbol among `bold', `code', `italic',
|
|
|
|
|
`strike-through', `underline' and `verbatim'. The value is
|
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
|
|
|
|
a formatting string to wrap fontified text with it.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
If no association can be found for a given markup, text will be
|
|
|
|
|
returned as-is."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'alist
|
|
|
|
|
:options '(bold code italic strike-through underline verbatim))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Drawers
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-format-drawer-function nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Function called to format a drawer in Groff code.
|
|
|
|
|
|
|
|
|
|
The function must accept two parameters:
|
|
|
|
|
NAME the drawer name, like \"LOGBOOK\"
|
|
|
|
|
CONTENTS the contents of the drawer.
|
|
|
|
|
|
|
|
|
|
The function should return the string to be exported.
|
|
|
|
|
|
|
|
|
|
For example, the variable could be set to the following function
|
|
|
|
|
in order to mimic default behaviour:
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
\(defun org-groff-format-drawer-default \(name contents\)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
\"Format a drawer element for Groff export.\"
|
|
|
|
|
contents\)"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Inlinetasks
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-format-inlinetask-function nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Function called to format an inlinetask in Groff code.
|
|
|
|
|
|
|
|
|
|
The function must accept six parameters:
|
|
|
|
|
TODO the todo keyword, as a string
|
|
|
|
|
TODO-TYPE the todo type, a symbol among `todo', `done' and nil.
|
|
|
|
|
PRIORITY the inlinetask priority, as a string
|
|
|
|
|
NAME the inlinetask name, as a string.
|
|
|
|
|
TAGS the inlinetask tags, as a list of strings.
|
|
|
|
|
CONTENTS the contents of the inlinetask, as a string.
|
|
|
|
|
|
|
|
|
|
The function should return the string to be exported.
|
|
|
|
|
|
|
|
|
|
For example, the variable could be set to the following function
|
|
|
|
|
in order to mimic default behaviour:
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
\(defun org-groff-format-inlinetask \(todo type priority name tags contents\)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
\"Format an inline task element for Groff export.\"
|
|
|
|
|
\(let ((full-title
|
|
|
|
|
\(concat
|
|
|
|
|
\(when todo
|
|
|
|
|
\(format \"\\fB%s\\fP \" todo))
|
|
|
|
|
\(when priority (format \"[\\#%c] \" priority))
|
|
|
|
|
title
|
|
|
|
|
\(when tags
|
|
|
|
|
\(format \":%s:\"
|
|
|
|
|
\(mapconcat 'identity tags \":\")))))
|
|
|
|
|
\(format (concat \".DS L\\n\"
|
|
|
|
|
\"%s\\n\\n\"
|
|
|
|
|
\"%s\"
|
|
|
|
|
\".DE\")
|
|
|
|
|
full-title contents))"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'function)
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Src blocks
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-source-highlight 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
|
|
|
|
"Use GNU source highlight to embellish source blocks "
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-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")
|
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
|
|
|
|
(tml "tml") (vala "vala") (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-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list
|
|
|
|
|
(symbol :tag "Major mode ")
|
|
|
|
|
(string :tag "Listings language"))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-source-highlight-options nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Association list of options for the groff listings package.
|
|
|
|
|
|
|
|
|
|
These options are supplied as a comma-separated list to the
|
|
|
|
|
\\lstset command. Each element of the association list should be
|
|
|
|
|
a list containing two strings: the name of the option, and the
|
|
|
|
|
value. For example,
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(setq org-groff-source-highlight-options
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'((\"basicstyle\" \"\\small\")
|
|
|
|
|
(\"keywordstyle\" \"\\color{black}\\bfseries\\underbar\")))
|
|
|
|
|
|
|
|
|
|
will typeset the code in a small size font with underlined, bold
|
|
|
|
|
black keywords.
|
|
|
|
|
|
|
|
|
|
Note that the same options will be applied to blocks of all
|
|
|
|
|
languages."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list
|
|
|
|
|
(string :tag "Listings option name ")
|
|
|
|
|
(string :tag "Listings option value"))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defvar org-groff-custom-lang-environments nil
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Alist mapping languages to language-specific Groff environments.
|
|
|
|
|
|
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 is used during export of src blocks by the listings and
|
2012-07-28 20:20:41 +00:00
|
|
|
|
groff packages. For example,
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
\(setq org-groff-custom-lang-environments
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'\(\(python \"pythoncode\"\)\)\)
|
|
|
|
|
|
|
|
|
|
would have the effect that if org encounters begin_src python
|
|
|
|
|
during groff export it will use pythoncode as the source-highlight
|
|
|
|
|
language.")
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Plain text
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-special-char
|
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)" . "\\\\(co")
|
|
|
|
|
("(tm)" . "\\\\(tm")
|
|
|
|
|
("(rg)" . "\\\\(rg"))
|
|
|
|
|
"CONS list in which the value of the car
|
2012-08-03 00:21:13 +00:00
|
|
|
|
is replace on the value of the CDR. "
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-08-03 00:21:13 +00:00
|
|
|
|
:type '(list
|
|
|
|
|
(cons :tag "Character Subtitute"
|
|
|
|
|
(string :tag "Original Character Group")
|
|
|
|
|
(string :tag "Replacement Character"))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Compilation
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-pdf-process
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'("pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"
|
|
|
|
|
"pic %f | tbl | eqn | groff -mm | 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
|
|
|
|
"pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
"Commands to process a Groff file to a PDF file.
|
|
|
|
|
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
|
|
|
|
|
full file name, %b by the file base name \(i.e. without
|
|
|
|
|
extension) and %o by the base directory of the file."
|
|
|
|
|
:group 'org-export-pdf
|
|
|
|
|
:type '(choice
|
|
|
|
|
(repeat :tag "Shell command sequence"
|
|
|
|
|
(string :tag "Shell command"))
|
|
|
|
|
(const :tag "2 runs of pdfgroff"
|
|
|
|
|
("pic %f | tbl | eqn | groff -mm | 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
|
|
|
|
"pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(const :tag "3 runs of pdfgroff"
|
|
|
|
|
("pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"
|
|
|
|
|
"pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"
|
|
|
|
|
"pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"))
|
|
|
|
|
(function)))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-logfiles-extensions
|
2012-07-28 20:20:41 +00:00
|
|
|
|
'("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
|
|
|
|
|
"The list of file extensions to consider as Groff logfiles."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type '(repeat (string :tag "Extension")))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-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-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-organization "Org User"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Name of the organization used to populate the .AF command."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-07-28 20:20:41 +00:00
|
|
|
|
:type 'string)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-groff-raster-to-ps nil
|
2012-09-03 21:24:58 +00:00
|
|
|
|
"Command used to convert raster to EPS. Nil for no conversion. Make sure that
|
2013-01-27 22:11:34 +00:00
|
|
|
|
`org-groff-inline-image-rules' is adjusted accordingly if not conversion is being
|
2012-09-03 21:24:58 +00:00
|
|
|
|
done. In this case, remove the entries for jpg and png in the file and fuzzy lists."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-groff
|
2012-09-03 21:24:58 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(repeat :tag "Shell Command Sequence" (string :tag "Shell Command"))
|
|
|
|
|
(const :tag "sam2p" "a=%s;b=%s;sam2p ${a} ${b} ;grep -v BeginData ${b} > b_${b};mv b_${b} ${b}" )
|
|
|
|
|
(const :tag "NetPNM" "a=%s;b=%s;pngtopnm ${a} | pnmtops -noturn > ${b}" )
|
|
|
|
|
(const :tag "None" nil)))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defvar org-groff-registered-references nil)
|
|
|
|
|
(defvar org-groff-special-content nil)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Internal Functions
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff--caption/label-string (element info)
|
2012-09-13 15:00:55 +00:00
|
|
|
|
"Return caption and label Groff 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-groff--wrap-label'."
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(let ((main (org-export-get-caption element))
|
|
|
|
|
(short (org-export-get-caption element t))
|
|
|
|
|
(label (org-element-property :name element)))
|
|
|
|
|
(cond ((and (not main) (not label)) "")
|
|
|
|
|
((not main) (format "\\fI%s\\fP" label))
|
|
|
|
|
;; Option caption format with short name.
|
|
|
|
|
(short (format "%s\n.br\n - %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-groff--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-groff--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))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff--text-markup (text markup)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Format TEXT depending on MARKUP text markup.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
See `org-groff-text-markup-alist' for details."
|
|
|
|
|
(let ((fmt (cdr (assq markup org-groff-text-markup-alist))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; No format string: Return raw text.
|
|
|
|
|
((not fmt) text)
|
|
|
|
|
((string= "protectedtexttt" fmt)
|
|
|
|
|
(let ((start 0)
|
|
|
|
|
(trans '(("\\" . "\\")))
|
|
|
|
|
(rtn "")
|
|
|
|
|
char)
|
|
|
|
|
(while (string-match "[\\{}$%&_#~^]" text)
|
|
|
|
|
(setq char (match-string 0 text))
|
|
|
|
|
(if (> (match-beginning 0) 0)
|
|
|
|
|
(setq rtn (concat rtn (substring text 0 (match-beginning 0)))))
|
|
|
|
|
(setq text (substring text (1+ (match-beginning 0))))
|
|
|
|
|
(setq char (or (cdr (assoc char trans)) (concat "\\" char))
|
|
|
|
|
rtn (concat rtn char)))
|
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 text (concat rtn text))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(format "\\fC%s\\fP" text)))
|
|
|
|
|
;; Else use format string.
|
|
|
|
|
(t (format fmt text)))))
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff--get-tagged-content (tag info)
|
|
|
|
|
(cdr (assoc tag org-groff-special-content)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff--mt-head (title contents attr info)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(concat
|
|
|
|
|
|
|
|
|
|
;; 1. Insert Organization
|
|
|
|
|
(let ((firm-option (plist-get attr :firm)))
|
|
|
|
|
(cond
|
|
|
|
|
((stringp firm-option)
|
|
|
|
|
(format ".AF \"%s\" \n" firm-option))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (format ".AF \"%s\" \n" (or org-groff-organization "")))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
;; 2. Title
|
|
|
|
|
(let ((subtitle1 (plist-get attr :subtitle1))
|
|
|
|
|
(subtitle2 (plist-get attr :subtitle2)))
|
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
((string= "" title)
|
|
|
|
|
(format ".TL \"%s\" \"%s\" \n%s\n"
|
|
|
|
|
(or subtitle1 "")
|
|
|
|
|
(or subtitle2 "") " "))
|
|
|
|
|
|
|
|
|
|
((not (or subtitle1 subtitle2))
|
|
|
|
|
(format ".TL\n%s\n"
|
|
|
|
|
(or title "")))
|
|
|
|
|
(t
|
|
|
|
|
(format ".TL \"%s\" \"%s \" \n%s\n"
|
|
|
|
|
(or subtitle1 "")
|
|
|
|
|
(or subtitle2 "") title))))
|
|
|
|
|
|
|
|
|
|
;; 3. Author.
|
|
|
|
|
;; In Groff, .AU *MUST* be placed after .TL
|
|
|
|
|
;; If From, populate with data from From else
|
|
|
|
|
;;
|
|
|
|
|
(let ((author (and (plist-get info :with-author)
|
|
|
|
|
(let ((auth (plist-get info :author)))
|
|
|
|
|
(and auth (org-export-data auth info)))))
|
|
|
|
|
(email (and (plist-get info :with-email)
|
|
|
|
|
(org-export-data (plist-get info :email) info)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(from-data (org-groff--get-tagged-content "FROM" info))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(to-data (org-groff--get-tagged-content "TO" info)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
((and author from-data)
|
|
|
|
|
(let ((au-line
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (from-line)
|
|
|
|
|
(format " \"%s\" " from-line))
|
|
|
|
|
(split-string
|
|
|
|
|
(setq from-data
|
|
|
|
|
(replace-regexp-in-string "\\.P\n" "" from-data)) "\n") "")))
|
|
|
|
|
|
|
|
|
|
(concat
|
|
|
|
|
(format ".AU \"%s\" " author) au-line "\n")))
|
|
|
|
|
|
|
|
|
|
((and author email (not (string= "" email)))
|
|
|
|
|
(format ".AU \"%s\" \"%s\"\n" author email))
|
|
|
|
|
|
|
|
|
|
(author (format ".AU \"%s\"\n" author))
|
|
|
|
|
|
|
|
|
|
(t ".AU \"\" \n")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; 4. Author Title, if present
|
|
|
|
|
(let ((at-item (plist-get attr :author-title)))
|
|
|
|
|
(if (and at-item (stringp at-item))
|
|
|
|
|
(format ".AT \"%s\" \n" at-item)
|
|
|
|
|
""))
|
|
|
|
|
|
|
|
|
|
;; 5. Date.
|
2012-11-09 10:04:07 +00:00
|
|
|
|
(when (plist-get info :with-date)
|
2013-04-02 22:02:15 +00:00
|
|
|
|
(let ((date (org-export-data (org-export-get-date info) info)))
|
|
|
|
|
(and (org-string-nw-p date) (format ".ND \"%s\"\n" date))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; If Abstract, then Populate Abstract
|
|
|
|
|
;;
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let ((abstract-data (org-groff--get-tagged-content "ABSTRACT" info))
|
|
|
|
|
(to-data (org-groff--get-tagged-content "TO" info)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(cond
|
|
|
|
|
(abstract-data
|
|
|
|
|
(format ".AS\n%s\n.AE\n" abstract-data))
|
|
|
|
|
(to-data
|
|
|
|
|
(format ".AS\n%s\n.AE\n" to-data))))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff--letter-head (title contents attr info)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(let ((author (and (plist-get info :with-author)
|
|
|
|
|
(let ((auth (plist-get info :author)))
|
|
|
|
|
(and auth (org-export-data auth info)))))
|
|
|
|
|
(email (and (plist-get info :with-email)
|
|
|
|
|
(org-export-data (plist-get info :email) info)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(from-data (org-groff--get-tagged-content "FROM" info))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(at-item (plist-get attr :author-title))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(to-data (org-groff--get-tagged-content "TO" info)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; If FROM then get data from FROM
|
2012-09-03 21:24:58 +00:00
|
|
|
|
(if from-data
|
|
|
|
|
(setq from-data
|
|
|
|
|
(replace-regexp-in-string "\\.P\n" "" from-data))
|
|
|
|
|
(setq from-data ""))
|
|
|
|
|
|
|
|
|
|
(if to-data
|
|
|
|
|
(setq to-data
|
|
|
|
|
(replace-regexp-in-string "\\.P\n" "" to-data))
|
|
|
|
|
(setq from-data ""))
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(concat
|
|
|
|
|
(cond
|
|
|
|
|
(from-data
|
|
|
|
|
(format ".WA \"%s\" \"%s\" \n%s\n.WE\n" author (or at-item "") from-data))
|
|
|
|
|
((and author email (not (string= "" email)))
|
|
|
|
|
(format ".WA \"%s\"\n \"%s\"\n.WE\n" author email))
|
|
|
|
|
(author (format ".WA \"%s\"\n.WE\n" author))
|
|
|
|
|
(t ".WA \"\" \n.WE\n"))
|
|
|
|
|
|
|
|
|
|
;; If TO then get data from TO
|
|
|
|
|
|
|
|
|
|
(when to-data
|
|
|
|
|
(format ".IA \n%s\n.IE\n" to-data)))))
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
;;; Template
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-template (contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return complete document string after Groff conversion.
|
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist
|
|
|
|
|
holding export options."
|
|
|
|
|
(let* ((title (org-export-data (plist-get info :title) info))
|
|
|
|
|
(attr (read
|
|
|
|
|
(format "(%s)"
|
|
|
|
|
(mapconcat
|
|
|
|
|
#'identity
|
|
|
|
|
(list (plist-get info :groff-class-options))
|
|
|
|
|
" "))))
|
|
|
|
|
(class (plist-get info :groff-class))
|
|
|
|
|
(class-options (plist-get info :groff-class-options))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(classes (assoc class org-groff-classes))
|
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
|
|
|
|
(classes-options (car (last classes)))
|
|
|
|
|
(heading-option (plist-get classes-options :heading))
|
|
|
|
|
(type-option (plist-get classes-options :type))
|
|
|
|
|
(last-option (plist-get classes-options :last-section))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(hyphenate (plist-get attr :hyphenate))
|
|
|
|
|
(justify-right (plist-get attr :justify-right))
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(document-class-string
|
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
|
|
|
|
(progn
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(org-element-normalize-string
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let* ((header (nth 1 (assoc class org-groff-classes)))
|
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
|
|
|
|
(document-class-item (if (stringp header) header "")))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
document-class-item)))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(concat
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(if justify-right
|
|
|
|
|
(case justify-right
|
|
|
|
|
('yes ".SA 1 \n")
|
|
|
|
|
('no ".SA 0 \n")
|
|
|
|
|
(t ""))
|
|
|
|
|
"")
|
|
|
|
|
|
|
|
|
|
(if hyphenate
|
|
|
|
|
(case hyphenate
|
|
|
|
|
('yes ".nr Hy 1 \n")
|
|
|
|
|
('no ".nr Hy 0 \n")
|
|
|
|
|
(t ""))
|
|
|
|
|
"")
|
2012-08-08 12:11:09 +00:00
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(cond
|
|
|
|
|
((string= type-option "custom") "")
|
2012-08-08 12:11:09 +00:00
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
((and (stringp document-class-string)
|
|
|
|
|
(string= type-option "cover"))
|
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
|
|
|
|
(concat
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(format ".COVER %s\n" document-class-string)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--mt-head title contents attr info)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
".COVEND\n"))
|
|
|
|
|
|
|
|
|
|
((string= type-option "memo")
|
|
|
|
|
(concat
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--mt-head title contents attr info)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
document-class-string))
|
|
|
|
|
((string= type-option "letter")
|
|
|
|
|
(concat
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--letter-head title contents attr info)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(let ((sa-item (plist-get attr :salutation))
|
|
|
|
|
(cn-item (plist-get attr :confidential))
|
|
|
|
|
(sj-item (plist-get attr :subject))
|
|
|
|
|
(rn-item (plist-get attr :reference))
|
|
|
|
|
(at-item (plist-get attr :attention)))
|
|
|
|
|
|
|
|
|
|
(concat
|
|
|
|
|
|
|
|
|
|
(if (stringp sa-item)
|
|
|
|
|
(format ".LO SA \"%s\" \n" sa-item)
|
|
|
|
|
".LO SA\n")
|
|
|
|
|
|
|
|
|
|
(when cn-item
|
|
|
|
|
(if (stringp cn-item)
|
|
|
|
|
(format ".LO CN \"%s\"\n" cn-item)
|
|
|
|
|
".LO CN\n"))
|
|
|
|
|
|
|
|
|
|
(when (and at-item (stringp at-item))
|
|
|
|
|
(format ".LO AT \"%s\" \n" at-item))
|
|
|
|
|
(when (and title rn-item)
|
|
|
|
|
(format ".LO RN \"%s\"\n" title))
|
|
|
|
|
|
|
|
|
|
(when (and sj-item (stringp sj-item))
|
|
|
|
|
(format ".LO SJ \"%s\" \n" sj-item))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
".LT " document-class-string "\n"))))
|
|
|
|
|
|
|
|
|
|
(t ""))
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
(cond
|
2012-08-10 14:14:00 +00:00
|
|
|
|
((string= last-option "toc")
|
|
|
|
|
".TC")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((string= last-option "sign")
|
|
|
|
|
(let ((fc-item (plist-get attr :closing)))
|
|
|
|
|
(concat (if (stringp fc-item)
|
|
|
|
|
(format ".FC \"%s\" \n" fc-item)
|
|
|
|
|
".FC\n")
|
2012-08-10 14:14:00 +00:00
|
|
|
|
".SG\n")))
|
|
|
|
|
(t ""))
|
|
|
|
|
|
|
|
|
|
(progn
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (item)
|
|
|
|
|
(when (string= (car item) "NS")
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\.P\n" "" (cdr item))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(reverse org-groff-special-content) "\n")))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Transcode Functions
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Babel Call
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Babel Calls are ignored.
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Bold
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-bold (bold contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode BOLD from Org to Groff.
|
|
|
|
|
CONTENTS is the text with bold markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup contents 'bold))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Center Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-center-block (center-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a CENTER-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the center block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
center-block
|
|
|
|
|
(format ".DS C \n%s\n.DE" contents)))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Clock
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-clock (clock contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a CLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(concat
|
|
|
|
|
(format "\\fB%s\\fP " org-clock-string)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-inactive-timestamp-format
|
2012-10-30 20:59:50 +00:00
|
|
|
|
(concat (org-translate-time
|
|
|
|
|
(org-element-property :raw-value
|
|
|
|
|
(org-element-property :value clock)))
|
|
|
|
|
(let ((time (org-element-property :duration clock)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(and time (format " (%s)" time)))))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Code
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-code (code contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a CODE object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup (org-element-property :value code) 'code))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;;; Comments and Comment Blocks are ignored.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Drawer
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-drawer (drawer contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a DRAWER element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((name (org-element-property :drawer-name drawer))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(output (if (functionp org-groff-format-drawer-function)
|
|
|
|
|
(funcall org-groff-format-drawer-function
|
2012-07-28 20:20:41 +00:00
|
|
|
|
name contents)
|
|
|
|
|
;; If there's no user defined function: simply
|
|
|
|
|
;; display contents of the drawer.
|
|
|
|
|
contents)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label drawer output)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Dynamic Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-dynamic-block (dynamic-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a DYNAMIC-BLOCK element from Org to Groff.
|
|
|
|
|
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-groff--wrap-label dynamic-block contents))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Entity
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-entity (entity contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an ENTITY object from Org to Groff.
|
|
|
|
|
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-08-08 12:11:09 +00:00
|
|
|
|
;;; Example Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-example-block (example-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an EXAMPLE-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
example-block
|
|
|
|
|
(format ".DS L\n%s\n.DE"
|
|
|
|
|
(org-export-format-code-default example-block info))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Export Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-export-block (export-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a EXPORT-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(when (string= (org-element-property :type export-block) "GROFF")
|
|
|
|
|
(org-remove-indentation (org-element-property :value export-block))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Export Snippet
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-export-snippet (export-snippet contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a EXPORT-SNIPPET object from Org to Groff.
|
|
|
|
|
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) 'groff)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(org-element-property :value export-snippet)))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Fixed Width
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-fixed-width (fixed-width contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a FIXED-WIDTH element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
fixed-width
|
|
|
|
|
(format "\\fC\n%s\\fP"
|
|
|
|
|
(org-remove-indentation
|
|
|
|
|
(org-element-property :value fixed-width)))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Footnote Definition
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Footnote Definitions are ignored.
|
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-08-08 12:11:09 +00:00
|
|
|
|
;; Footnotes are handled automatically in GROFF. Although manual
|
|
|
|
|
;; references can be added, not really required.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-footnote-reference (footnote-reference contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Changing from info to footnote-reference
|
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
|
|
|
|
(let* ((raw (org-export-get-footnote-definition footnote-reference info))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(n (org-export-get-footnote-number footnote-reference info))
|
|
|
|
|
(data (org-trim (org-export-data raw info)))
|
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
|
|
|
|
(ref-id (plist-get (nth 1 footnote-reference) :label)))
|
2012-08-03 00:21:13 +00:00
|
|
|
|
;; It is a reference
|
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
|
|
|
|
(if (string-match "fn:rl" ref-id)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(if (member ref-id org-groff-registered-references)
|
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 "\\*[%s]" ref-id)
|
|
|
|
|
(progn
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(push ref-id org-groff-registered-references)
|
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 "\\*(Rf\n.RS \"%s\" \n%s\n.RF\n" ref-id data)))
|
|
|
|
|
;; else it is a footnote
|
|
|
|
|
(format "\\u\\s-2%s\\d\\s+2\n.FS %s\n%s\n.FE\n" n n data))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Headline
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-headline (headline contents info)
|
2013-02-23 12:47:44 +00:00
|
|
|
|
"Transcode a HEADLINE element from Org to Groff.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let* ((class (plist-get info :groff-class))
|
|
|
|
|
(level (org-export-get-relative-level headline info))
|
|
|
|
|
(numberedp (org-export-numbered-headline-p headline info))
|
|
|
|
|
;; Section formatting will set two placeholders: one for the
|
|
|
|
|
;; title and the other for the contents.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(classes (assoc class org-groff-classes))
|
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
|
|
|
|
(classes-options (car (last classes)))
|
|
|
|
|
(heading-option (plist-get classes-options :heading))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(section-fmt
|
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
|
|
|
|
(progn
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
((and (symbolp heading-option)
|
|
|
|
|
(fboundp heading-option))
|
|
|
|
|
(funcall heading-option level numberedp))
|
|
|
|
|
((> level 7) nil)
|
|
|
|
|
(t (if numberedp
|
|
|
|
|
(concat ".H " (number-to-string level) " \"%s\"\n%s")
|
|
|
|
|
".HU \"%s\"\n%s")))))
|
|
|
|
|
;; End of section-fmt
|
|
|
|
|
(text (org-export-data (org-element-property :title headline) info))
|
|
|
|
|
(todo
|
|
|
|
|
(and (plist-get info :with-todo-keywords)
|
|
|
|
|
(let ((todo (org-element-property :todo-keyword headline)))
|
|
|
|
|
(and todo (org-export-data todo info)))))
|
|
|
|
|
(todo-type (and todo (org-element-property :todo-type headline)))
|
|
|
|
|
(tags (and (plist-get info :with-tags)
|
|
|
|
|
(org-export-get-tags headline info)))
|
|
|
|
|
(priority (and (plist-get info :with-priority)
|
|
|
|
|
(org-element-property :priority headline)))
|
|
|
|
|
;; Create the headline text along with a no-tag version. The
|
|
|
|
|
;; latter is required to remove tags from table of contents.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(full-text (if (functionp org-groff-format-headline-function)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; User-defined formatting function.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(funcall org-groff-format-headline-function
|
2012-07-28 20:20:41 +00:00
|
|
|
|
todo todo-type priority text tags)
|
|
|
|
|
;; Default formatting.
|
|
|
|
|
(concat
|
|
|
|
|
(when todo
|
|
|
|
|
(format "\\fB%s\\fP " todo))
|
|
|
|
|
(when priority (format " [\\#%c] " priority))
|
|
|
|
|
text
|
|
|
|
|
(when tags
|
|
|
|
|
(format " \\fC:%s:\\fP "
|
|
|
|
|
(mapconcat 'identity tags ":"))))))
|
|
|
|
|
(full-text-no-tag
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(if (functionp org-groff-format-headline-function)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; User-defined formatting function.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(funcall org-groff-format-headline-function
|
2012-07-28 20:20:41 +00:00
|
|
|
|
todo todo-type priority text nil)
|
|
|
|
|
;; Default formatting.
|
|
|
|
|
(concat
|
|
|
|
|
(when todo (format "\\fB%s\\fP " todo))
|
|
|
|
|
(when priority (format " [\\#%c] " priority))
|
|
|
|
|
text)))
|
|
|
|
|
;; Associate some \label to the headline for internal links.
|
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
|
|
|
|
;; (headline-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; (format "\\label{sec-%s}\n"
|
|
|
|
|
;; (mapconcat 'number-to-string
|
|
|
|
|
;; (org-export-get-headline-number headline info)
|
|
|
|
|
;; "-")))
|
|
|
|
|
(headline-label "")
|
|
|
|
|
(pre-blanks
|
|
|
|
|
(make-string (org-element-property :pre-blank headline) 10)))
|
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
|
|
|
|
(cond
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Case 1: Special Tag
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((member (car tags) org-groff-special-tags)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(cond
|
|
|
|
|
((string= (car tags) "BODY") contents)
|
|
|
|
|
|
|
|
|
|
((string= (car tags) "NS")
|
|
|
|
|
(progn
|
|
|
|
|
(push (cons (car tags)
|
|
|
|
|
(format ".NS \"%s\" 1 \n%s"
|
|
|
|
|
(car (org-element-property :title headline))
|
|
|
|
|
(or contents " ")))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-special-content) nil))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
(t
|
|
|
|
|
(progn
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(push (cons (car tags) contents) org-groff-special-content)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
nil))))
|
|
|
|
|
|
|
|
|
|
;; Case 2: This is a footnote section: ignore it.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((org-element-property :footnote-section-p headline) nil)
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
;; Case 3: 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.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((or (not section-fmt) (org-export-low-level-p headline info))
|
|
|
|
|
;; Build the real contents of the sub-tree.
|
|
|
|
|
(let ((low-level-body
|
|
|
|
|
(concat
|
|
|
|
|
;; If the headline is the first sibling, start a list.
|
2012-08-03 11:42:38 +00:00
|
|
|
|
(when (org-export-first-sibling-p headline info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(format "%s\n" (if numberedp ".AL 1\n" ".DL \n")))
|
|
|
|
|
;; Itemize headline
|
|
|
|
|
".LI\n" full-text "\n" headline-label pre-blanks contents)))
|
|
|
|
|
;; If headline is not the last sibling simply return
|
|
|
|
|
;; LOW-LEVEL-BODY. Otherwise, also close the list, before any
|
|
|
|
|
;; blank line.
|
2012-08-03 11:42:38 +00:00
|
|
|
|
(if (not (org-export-last-sibling-p headline info)) low-level-body
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"[ \t\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
|
|
|
|
(concat "\n.LE")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
low-level-body))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
;; Case 4. Standard headline. Export it as a section.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(t
|
|
|
|
|
(format section-fmt full-text
|
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
|
|
|
|
(concat headline-label pre-blanks contents))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Horizontal Rule
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Not supported
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Inline Babel Call
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Inline Babel Calls are ignored.
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Inline Src Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-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 Groff.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((code (org-element-property :value inline-src-block)))
|
|
|
|
|
(cond
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff-source-highlight
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(let* ((tmpdir (if (featurep 'xemacs)
|
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
|
|
|
|
temp-directory
|
|
|
|
|
temporary-file-directory))
|
|
|
|
|
(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))
|
|
|
|
|
(lst-lang (cadr (assq (intern org-lang)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-source-highlight-langs)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cmd (concat (expand-file-name "source-highlight")
|
|
|
|
|
" -s " lst-lang
|
|
|
|
|
" -f groff_mm_color "
|
|
|
|
|
" -i " in-file
|
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
|
|
|
|
" -o " out-file)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(if lst-lang
|
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
|
|
|
|
(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 ".DS I\n\\fC\\m[black]%s\\m[]\\fP\n.DE\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
|
|
|
|
code))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Do not use a special package: transcode it verbatim.
|
|
|
|
|
(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
|
|
|
|
(concat ".DS I\n" "\\fC" code "\\fP\n.DE\n")))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Inlinetask
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-inlinetask (inlinetask contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an INLINETASK element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let ((title (org-export-data (org-element-property :title inlinetask) info))
|
|
|
|
|
(todo (and (plist-get info :with-todo-keywords)
|
|
|
|
|
(let ((todo (org-element-property :todo-keyword inlinetask)))
|
|
|
|
|
(and todo (org-export-data todo info)))))
|
|
|
|
|
(todo-type (org-element-property :todo-type inlinetask))
|
|
|
|
|
(tags (and (plist-get info :with-tags)
|
|
|
|
|
(org-export-get-tags inlinetask info)))
|
|
|
|
|
(priority (and (plist-get info :with-priority)
|
|
|
|
|
(org-element-property :priority inlinetask))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; If `org-groff-format-inlinetask-function' is provided, call it
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; with appropriate arguments.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(if (functionp org-groff-format-inlinetask-function)
|
|
|
|
|
(funcall org-groff-format-inlinetask-function
|
2012-07-28 20:20:41 +00:00
|
|
|
|
todo todo-type priority title tags contents)
|
|
|
|
|
;; Otherwise, use a default template.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
inlinetask
|
|
|
|
|
(let ((full-title
|
|
|
|
|
(concat
|
|
|
|
|
(when todo (format "\\fB%s\\fP " todo))
|
|
|
|
|
(when priority (format " [\\#%c] " priority))
|
|
|
|
|
title
|
|
|
|
|
(when tags (format " \\fC:%s:\\fP "
|
|
|
|
|
(mapconcat 'identity tags ":"))))))
|
|
|
|
|
(format (concat "\n.DS I\n"
|
|
|
|
|
"%s\n"
|
|
|
|
|
".sp"
|
|
|
|
|
"%s\n"
|
|
|
|
|
".DE")
|
|
|
|
|
full-title contents))))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Italic
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-italic (italic contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode ITALIC from Org to Groff.
|
|
|
|
|
CONTENTS is the text with italic markup. INFO is a plist holding
|
|
|
|
|
contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup contents 'italic))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Item
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-item (item contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode an ITEM element from Org to Groff.
|
|
|
|
|
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))
|
2012-08-08 12:11:09 +00:00
|
|
|
|
(type (org-element-property
|
|
|
|
|
:type (org-element-property :parent item)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(checkbox (case (org-element-property :checkbox 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
|
|
|
|
(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.
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(and tag (format "%s"
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(concat checkbox
|
|
|
|
|
(org-export-data tag info)))))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
((or checkbox tag)
|
|
|
|
|
(concat ".LI ""\"" (or tag (concat "\\ " checkbox)) "\""
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"\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
|
|
|
|
(org-trim (or contents " "))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
((eq type 'ordered)
|
|
|
|
|
(concat ".LI"
|
|
|
|
|
"\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
|
|
|
|
(org-trim (or contents " "))))
|
|
|
|
|
(t
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(let* ((bullet (org-trim bullet))
|
|
|
|
|
(marker (cond ((string= "-" bullet) "\\(em")
|
|
|
|
|
((string= "*" bullet) "\\(bu")
|
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 "\\(dg"))))
|
|
|
|
|
(concat ".LI " marker "\n"
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(org-trim (or contents " "))))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Keyword
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-keyword (keyword contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a KEYWORD element from Org to Groff.
|
|
|
|
|
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 "GROFF") value)
|
|
|
|
|
(t nil))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Line Break
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-line-break (line-break contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a LINE-BREAK object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
".br\n")
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Link
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Inline images just place a call to .PSPIC or .PS/.PE
|
|
|
|
|
;; and load the graph.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-link--inline-image (link info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return Groff code for an inline image.
|
|
|
|
|
LINK is the link pointing to the inline image. INFO is a plist
|
|
|
|
|
used as a communication channel."
|
|
|
|
|
(let* ((parent (org-export-get-parent-element link))
|
|
|
|
|
(path (let ((raw-path (org-element-property :path link)))
|
|
|
|
|
(if (not (file-name-absolute-p raw-path)) raw-path
|
|
|
|
|
(expand-file-name raw-path))))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(attr (org-export-read-attribute :attr_groff link))
|
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
|
|
|
|
(placement
|
2013-03-08 23:58:31 +00:00
|
|
|
|
(let ((pos (plist-get attr :position)))
|
|
|
|
|
(cond ((string= pos 'center) "")
|
|
|
|
|
((string= pos 'left) "-L")
|
|
|
|
|
((string= pos 'right) "-R")
|
|
|
|
|
(t ""))))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(width (or (plist-get attr :width) ""))
|
|
|
|
|
(height (or (plist-get attr :height) ""))
|
|
|
|
|
(caption (and (not (plist-get attr :disable-caption))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--caption/label-string parent info))))
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;; Now clear ATTR from any special keyword and set a default value
|
|
|
|
|
;; if nothing is left. Return proper string.
|
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
|
|
|
|
(concat
|
2012-08-03 00:21:13 +00:00
|
|
|
|
(cond
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((and org-groff-raster-to-ps
|
2013-03-08 23:58:31 +00:00
|
|
|
|
(or (string-match ".\.png$" path)
|
2012-09-03 21:24:58 +00:00
|
|
|
|
(string-match ".\.jpg$" path)))
|
|
|
|
|
(let ((eps-path (concat path ".eps")))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(shell-command (format org-groff-raster-to-ps path eps-path))
|
2012-09-03 21:24:58 +00:00
|
|
|
|
(format "\n.DS L F\n.PSPIC %s \"%s\" %s %s\n.DE "
|
|
|
|
|
placement eps-path width height)))
|
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
|
|
|
|
((string-match ".\.pic$" path)
|
|
|
|
|
(format "\n.PS\ncopy \"%s\"\n.PE" path))
|
|
|
|
|
(t (format "\n.DS L F\n.PSPIC %s \"%s\" %s %s\n.DE "
|
|
|
|
|
placement path width height)))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(and caption (format "\n.FG \"%s\"" caption)))))
|
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
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-link (link desc info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a LINK object from Org to Groff.
|
|
|
|
|
|
|
|
|
|
DESC is the description part of the link, or the empty string.
|
|
|
|
|
INFO is a plist holding contextual information. See
|
|
|
|
|
`org-export-data'."
|
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
|
|
|
|
(let* ((type (org-element-property :type link))
|
|
|
|
|
(raw-path (org-element-property :path link))
|
|
|
|
|
;; Ensure DESC really exists, or set it to nil.
|
|
|
|
|
(desc (and (not (string= desc "")) desc))
|
|
|
|
|
(imagep (org-export-inline-image-p
|
2013-01-27 22:11:34 +00:00
|
|
|
|
link org-groff-inline-image-rules))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(path (cond
|
|
|
|
|
((member type '("http" "https" "ftp" "mailto"))
|
|
|
|
|
(concat type ":" raw-path))
|
|
|
|
|
((string= type "file")
|
2012-09-03 21:24:58 +00:00
|
|
|
|
(when (string-match "\\(.+\\)::.+" raw-path)
|
|
|
|
|
(setq raw-path (match-string 1 raw-path)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(if (file-name-absolute-p raw-path)
|
|
|
|
|
(concat "file://" (expand-file-name raw-path))
|
|
|
|
|
(concat "file://" raw-path)))
|
|
|
|
|
(t raw-path)))
|
|
|
|
|
protocol)
|
|
|
|
|
(cond
|
|
|
|
|
;; Image file.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(imagep (org-groff-link--inline-image link info))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; import groff files
|
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
|
|
|
|
((and (string= type "file")
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(string-match ".\.groff$" raw-path))
|
|
|
|
|
(concat ".so " raw-path "\n"))
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;; Radio link: transcode target's contents and use them as link's
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; description.
|
|
|
|
|
((string= type "radio")
|
|
|
|
|
(let ((destination (org-export-resolve-radio-link link info)))
|
|
|
|
|
(when destination
|
|
|
|
|
(format "\\fI [%s] \\fP"
|
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
|
|
|
|
(org-export-solidify-link-text path)))))
|
|
|
|
|
|
2013-02-23 12:47:44 +00:00
|
|
|
|
;; Links pointing to a headline: find destination and build
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; appropriate referencing command.
|
|
|
|
|
((member type '("custom-id" "fuzzy" "id"))
|
|
|
|
|
(let ((destination (if (string= type "fuzzy")
|
|
|
|
|
(org-export-resolve-fuzzy-link link info)
|
|
|
|
|
(org-export-resolve-id-link link info))))
|
|
|
|
|
(case (org-element-type destination)
|
|
|
|
|
;; Id link points to an external file.
|
|
|
|
|
(plain-text
|
|
|
|
|
(if desc (format "%s \\fBat\\fP \\fIfile://%s\\fP" desc destination)
|
|
|
|
|
(format "\\fI file://%s \\fP" destination)))
|
|
|
|
|
;; Fuzzy link points nowhere.
|
|
|
|
|
('nil
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-link-with-unknown-path-format
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(or desc
|
|
|
|
|
(org-export-data
|
|
|
|
|
(org-element-property :raw-link link) info))))
|
2013-04-04 18:35:05 +00:00
|
|
|
|
;; LINK points to a headline. If headlines are numbered and
|
|
|
|
|
;; the link has no description, display headline's number.
|
|
|
|
|
;; Otherwise, display description or headline's title.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(headline
|
|
|
|
|
(let ((label ""))
|
|
|
|
|
(if (and (plist-get info :section-numbers) (not desc))
|
|
|
|
|
(format "\\fI%s\\fP" label)
|
|
|
|
|
(format "\\fI%s\\fP"
|
|
|
|
|
(or desc
|
|
|
|
|
(org-export-data
|
|
|
|
|
(org-element-property :title destination) info))))))
|
|
|
|
|
;; Fuzzy link points to a target. Do as above.
|
|
|
|
|
(otherwise
|
|
|
|
|
(let ((path (org-export-solidify-link-text path)))
|
|
|
|
|
(if (not desc) (format "\\fI%s\\fP" path)
|
|
|
|
|
(format "%s \\fBat\\fP \\fI%s\\fP" desc path)))))))
|
|
|
|
|
;; 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.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (format org-groff-link-with-unknown-path-format desc)))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Paragraph
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-paragraph (paragraph contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a PARAGRAPH element from Org to Groff.
|
|
|
|
|
CONTENTS is the contents of the paragraph, as a string. INFO is
|
|
|
|
|
the plist used as a communication channel."
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(let ((parent (plist-get (nth 1 paragraph) :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
|
|
|
|
(when parent
|
|
|
|
|
(let* ((parent-type (car parent))
|
|
|
|
|
(fixed-paragraph "")
|
|
|
|
|
(class (plist-get info :groff-class))
|
|
|
|
|
(class-options (plist-get info :groff-class-options))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(classes (assoc class org-groff-classes))
|
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
|
|
|
|
(classes-options (car (last classes)))
|
|
|
|
|
(paragraph-option (plist-get classes-options :paragraph)))
|
|
|
|
|
(cond
|
|
|
|
|
((and (symbolp paragraph-option)
|
|
|
|
|
(fboundp paragraph-option))
|
|
|
|
|
(funcall paragraph-option parent-type parent contents))
|
|
|
|
|
((and (eq parent-type 'item)
|
|
|
|
|
(plist-get (nth 1 parent) :bullet))
|
|
|
|
|
(setq fixed-paragraph (concat "" contents)))
|
|
|
|
|
((eq parent-type 'section)
|
|
|
|
|
(setq fixed-paragraph (concat ".P\n" contents)))
|
|
|
|
|
((eq parent-type 'footnote-definition)
|
|
|
|
|
(setq fixed-paragraph (concat "" contents)))
|
|
|
|
|
(t (setq fixed-paragraph (concat "" contents))))
|
|
|
|
|
fixed-paragraph))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Plain List
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-plain-list (plain-list contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a PLAIN-LIST element from Org to Groff.
|
|
|
|
|
CONTENTS is the contents of the list. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((type (org-element-property :type plain-list))
|
|
|
|
|
(attr (mapconcat #'identity
|
|
|
|
|
(org-element-property :attr_groff plain-list)
|
|
|
|
|
" "))
|
|
|
|
|
(groff-type (cond
|
|
|
|
|
((eq type 'ordered) ".AL")
|
|
|
|
|
((eq type 'unordered) ".BL")
|
|
|
|
|
((eq type 'descriptive) ".VL 2.0i"))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
plain-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
|
|
|
|
(format "%s\n%s\n.LE" groff-type contents))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Plain Text
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-plain-text (text info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TEXT string from Org to Groff.
|
|
|
|
|
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 characters.
|
|
|
|
|
(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)))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Handle Special Characters
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(if org-groff-special-char
|
|
|
|
|
(dolist (special-char-list org-groff-special-char)
|
2012-10-26 22:36:00 +00:00
|
|
|
|
(setq output
|
|
|
|
|
(replace-regexp-in-string (car special-char-list)
|
|
|
|
|
(cdr special-char-list) output))))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Handle break preservation if required.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(when (plist-get info :preserve-breaks)
|
2012-10-26 22:36:00 +00:00
|
|
|
|
(setq output (replace-regexp-in-string
|
|
|
|
|
"\\(\\\\\\\\\\)?[ \t]*\n" ".br\n" output)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Return value.
|
2012-10-26 22:36:00 +00:00
|
|
|
|
output))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Planning
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-planning (planning contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a PLANNING element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(concat
|
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(delq nil
|
|
|
|
|
(list
|
|
|
|
|
(let ((closed (org-element-property :closed planning)))
|
|
|
|
|
(when closed
|
|
|
|
|
(concat
|
|
|
|
|
(format "\\fR %s \\fP" org-closed-string)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-inactive-timestamp-format
|
2012-10-30 20:59:50 +00:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value closed))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(let ((deadline (org-element-property :deadline planning)))
|
|
|
|
|
(when deadline
|
|
|
|
|
(concat
|
|
|
|
|
(format "\\fB %s \\fP" org-deadline-string)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-active-timestamp-format
|
2012-10-30 20:59:50 +00:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value deadline))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(let ((scheduled (org-element-property :scheduled planning)))
|
|
|
|
|
(when scheduled
|
|
|
|
|
(concat
|
|
|
|
|
(format "\\fR %s \\fP" org-scheduled-string)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-active-timestamp-format
|
2012-10-30 20:59:50 +00:00
|
|
|
|
(org-translate-time
|
|
|
|
|
(org-element-property :raw-value scheduled))))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"")
|
|
|
|
|
""))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Quote Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-quote-block (quote-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a QUOTE-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
quote-block
|
|
|
|
|
(format ".DS I\n.I\n%s\n.R\n.DE" contents)))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Quote Section
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-quote-section (quote-section contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a QUOTE-SECTION element from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(let ((value (org-remove-indentation
|
|
|
|
|
(org-element-property :value quote-section))))
|
|
|
|
|
(when value (format ".DS L\n\\fI%s\\fP\n.DE\n" value))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Radio Target
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-radio-target (radio-target text info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a RADIO-TARGET object from Org to Groff.
|
|
|
|
|
TEXT is the text of the target. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "%s - %s"
|
|
|
|
|
(org-export-solidify-link-text
|
|
|
|
|
(org-element-property :value radio-target))
|
|
|
|
|
text))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Section
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-section (section contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SECTION element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the section. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
contents)
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Special Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-special-block (special-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SPECIAL-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the block. INFO is a plist
|
|
|
|
|
holding contextual information."
|
|
|
|
|
(let ((type (downcase (org-element-property :type special-block))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--wrap-label
|
2012-07-28 20:20:41 +00:00
|
|
|
|
special-block
|
|
|
|
|
(format "%s\n" contents))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Src Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-src-block (src-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SRC-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((lang (org-element-property :language src-block))
|
|
|
|
|
(label (org-element-property :name src-block))
|
|
|
|
|
(code (org-element-property :value src-block))
|
|
|
|
|
(custom-env (and lang
|
|
|
|
|
(cadr (assq (intern lang)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-custom-lang-environments))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(num-start (case (org-element-property :number-lines src-block)
|
|
|
|
|
(continued (org-export-get-loc src-block info))
|
|
|
|
|
(new 0)))
|
2012-08-03 00:21:13 +00:00
|
|
|
|
(retain-labels (org-element-property :retain-labels src-block))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(caption (and (not (org-export-read-attribute
|
|
|
|
|
:attr_groff src-block :disable-caption))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--caption/label-string src-block info))))
|
2012-08-03 00:21:13 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; Case 1. No source fontification.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((not org-groff-source-highlight)
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(concat
|
|
|
|
|
(format ".DS I\n\\fC%s\\fP\n.DE\n"
|
|
|
|
|
(org-export-format-code-default src-block info))
|
|
|
|
|
(and caption (format ".EX \"%s\" " caption))))
|
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-08-08 12:11:09 +00:00
|
|
|
|
;; Case 2. Source fontification.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff-source-highlight
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(let* ((tmpdir (if (featurep 'xemacs)
|
|
|
|
|
temp-directory
|
|
|
|
|
temporary-file-directory))
|
|
|
|
|
(in-file (make-temp-name
|
|
|
|
|
(expand-file-name "srchilite" tmpdir)))
|
|
|
|
|
(out-file (make-temp-name
|
|
|
|
|
(expand-file-name "reshilite" tmpdir)))
|
|
|
|
|
|
|
|
|
|
(org-lang (org-element-property :language src-block))
|
|
|
|
|
(lst-lang (cadr (assq (intern org-lang)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-source-highlight-langs)))
|
2012-09-13 15:00:55 +00:00
|
|
|
|
|
|
|
|
|
(cmd (concat "source-highlight"
|
|
|
|
|
" -s " lst-lang
|
|
|
|
|
" -f groff_mm_color "
|
|
|
|
|
" -i " in-file
|
|
|
|
|
" -o " out-file)))
|
|
|
|
|
|
|
|
|
|
(concat
|
|
|
|
|
(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)
|
|
|
|
|
(format "%s\n" code-block))
|
|
|
|
|
(format ".DS I\n\\fC\\m[black]%s\\m[]\\fP\n.DE\n"
|
|
|
|
|
code))
|
|
|
|
|
(and caption (format ".EX \"%s\" " caption))))))))
|
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
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Statistics Cookie
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-statistics-cookie (statistics-cookie contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a STATISTICS-COOKIE object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
|
|
|
(org-element-property :value statistics-cookie))
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Strike-Through
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-strike-through (strike-through contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode STRIKE-THROUGH from Org to Groff.
|
|
|
|
|
CONTENTS is the text with strike-through markup. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup contents 'strike-through))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Subscript
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-subscript (subscript contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SUBSCRIPT object from Org to Groff.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\d\\s-2%s\\s+2\\u" contents))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Superscript "^_%s$
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-superscript (superscript contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a SUPERSCRIPT object from Org to Groff.
|
|
|
|
|
CONTENTS is the contents of the object. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\u\\s-2%s\\s+2\\d" contents))
|
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Table
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-groff-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 `org-groff-table--org-table' function,
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; depending of the type of the table.
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-groff-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-groff-table (table contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TABLE element from Org to Groff.
|
|
|
|
|
CONTENTS is the contents of the table. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(cond
|
|
|
|
|
;; Case 1: verbatim table.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((or org-groff-tables-verbatim
|
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
|
|
|
|
(let ((attr (read (format "(%s)"
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(mapconcat
|
|
|
|
|
#'identity
|
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
|
|
|
|
(org-element-property :attr_groff table) " ")))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(and attr (plist-get attr :verbatim))))
|
|
|
|
|
|
|
|
|
|
(format ".DS L\n\\fC%s\\fP\n.DE"
|
|
|
|
|
;; Re-create table, without affiliated keywords.
|
|
|
|
|
(org-trim
|
|
|
|
|
(org-element-interpret-data
|
|
|
|
|
`(table nil ,@(org-element-contents table))))))
|
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: Standard table.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (org-groff-table--org-table table contents info))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-table--align-string (divider table info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return an appropriate Groff 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.
|
|
|
|
|
;; Alignment is nil on assignment
|
|
|
|
|
|
|
|
|
|
(when (and (memq 'left borders) (not alignment))
|
|
|
|
|
(push "|" alignment))
|
|
|
|
|
(push
|
|
|
|
|
(case (org-export-table-cell-alignment cell info)
|
|
|
|
|
(left (concat "l" width divider))
|
|
|
|
|
(right (concat "r" width divider))
|
|
|
|
|
(center (concat "c" width divider)))
|
|
|
|
|
alignment)
|
|
|
|
|
(when (memq 'right borders) (push "|" alignment))))
|
|
|
|
|
info)
|
2012-08-08 16:31:05 +00:00
|
|
|
|
(apply 'concat (reverse alignment))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-table--org-table (table contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Return appropriate Groff 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_groff table))
|
|
|
|
|
(label (org-element-property :name table))
|
|
|
|
|
(caption (and (not (plist-get attr :disable-caption))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--caption/label-string table info)))
|
2012-08-08 12:11:09 +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-groff-table--align-string divider table info))
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
;; Extract others display options.
|
2012-08-10 14:14:00 +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)
|
|
|
|
|
(t (if org-groff-tables-centered "center" ""))))
|
|
|
|
|
(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
|
|
|
|
|
|
|
|
|
(title-line (plist-get attr :title-line))
|
|
|
|
|
(long-cells (plist-get attr :long-cells))
|
|
|
|
|
|
|
|
|
|
(table-format
|
|
|
|
|
(concat
|
2013-03-08 23:58:31 +00:00
|
|
|
|
(or (car attr-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
|
|
|
|
(or
|
2012-08-08 12:11:09 +00:00
|
|
|
|
(let (output-list)
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(when (cdr attr-list)
|
|
|
|
|
(dolist (attr-item (cdr attr-list))
|
2012-08-08 12:11:09 +00:00
|
|
|
|
(setq output-list (concat output-list
|
|
|
|
|
(format ",%s" attr-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
|
|
|
|
output-list) "")))
|
|
|
|
|
(first-line
|
|
|
|
|
(when lines (org-split-string (car lines) "\t"))))
|
|
|
|
|
;; Prepare the final format string for the table.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-10 14:14:00 +00:00
|
|
|
|
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; Others.
|
2012-08-08 12:11:09 +00:00
|
|
|
|
(lines
|
|
|
|
|
(concat ".TS\n " table-format ";\n"
|
2012-09-13 15:00:55 +00:00
|
|
|
|
(format "%s.\n"
|
|
|
|
|
(let ((final-line ""))
|
|
|
|
|
(when title-line
|
|
|
|
|
(dotimes (i (length first-line))
|
|
|
|
|
(setq final-line (concat final-line "cb" divider))))
|
|
|
|
|
|
|
|
|
|
(setq final-line (concat final-line "\n"))
|
|
|
|
|
|
|
|
|
|
(if alignment
|
|
|
|
|
(setq final-line (concat final-line alignment))
|
|
|
|
|
(dotimes (i (length first-line))
|
|
|
|
|
(setq final-line (concat final-line "c" divider))))
|
|
|
|
|
final-line))
|
|
|
|
|
|
|
|
|
|
(format "%s.TE\n"
|
|
|
|
|
(let ((final-line "")
|
|
|
|
|
(long-line "")
|
|
|
|
|
(lines (org-split-string contents "\n")))
|
|
|
|
|
|
|
|
|
|
(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))))))
|
|
|
|
|
long-line))
|
|
|
|
|
;; else long cells
|
|
|
|
|
(setq final-line (concat final-line long-line)))
|
|
|
|
|
|
|
|
|
|
(setq final-line (concat final-line line-item "\n"))))
|
|
|
|
|
final-line))
|
|
|
|
|
|
|
|
|
|
(if caption (format ".TB \"%s\"" caption) ""))))))
|
2012-08-08 12:11:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Table Cell
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-table-cell (table-cell contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TABLE-CELL element from Org to Groff
|
|
|
|
|
CONTENTS is the cell contents. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(progn
|
|
|
|
|
(concat (if (and contents
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-table-scientific-notation
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(string-match orgtbl-exp-regexp contents))
|
|
|
|
|
;; Use appropriate format string for scientific
|
|
|
|
|
;; notation.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-table-scientific-notation
|
2012-08-10 14:14:00 +00:00
|
|
|
|
(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-08-08 12:11:09 +00:00
|
|
|
|
;;; Table Row
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-table-row (table-row contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TABLE-ROW element from Org to Groff
|
|
|
|
|
CONTENTS is the contents of the row. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
|
|
|
|
;; Rules are ignored since table separators are deduced from
|
|
|
|
|
;; borders of the current row.
|
|
|
|
|
(when (eq (org-element-property :type table-row) 'standard)
|
|
|
|
|
(let* ((attr (mapconcat 'identity
|
|
|
|
|
(org-element-property
|
|
|
|
|
:attr_groff (org-export-get-parent table-row))
|
|
|
|
|
" "))
|
|
|
|
|
;; TABLE-ROW's borders are extracted from its first cell.
|
|
|
|
|
(borders
|
|
|
|
|
(org-export-table-cell-borders
|
|
|
|
|
(car (org-element-contents table-row)) info)))
|
|
|
|
|
(concat
|
2012-08-10 14:14:00 +00:00
|
|
|
|
;; Mark horizontal lines
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond ((and (memq 'top borders) (memq 'above borders)) "_\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
|
|
|
|
contents
|
2012-07-28 20:20:41 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; When BOOKTABS are activated enforce bottom rule even when
|
|
|
|
|
;; no hline was specifically marked.
|
2012-08-03 00:21:13 +00:00
|
|
|
|
((and (memq 'bottom borders) (memq 'below borders)) "\n_")
|
|
|
|
|
((memq 'below borders) "\n_"))))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Target
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-target (target contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TARGET object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "\\fI%s\\fP"
|
|
|
|
|
(org-export-solidify-link-text (org-element-property :value target))))
|
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Timestamp
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-timestamp (timestamp contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a TIMESTAMP object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let ((value (org-groff-plain-text
|
2013-01-10 20:42:21 +00:00
|
|
|
|
(org-timestamp-translate timestamp) info)))
|
2012-10-28 15:20:45 +00:00
|
|
|
|
(case (org-element-property :type timestamp)
|
|
|
|
|
((active active-range)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-active-timestamp-format value))
|
2012-10-28 15:20:45 +00:00
|
|
|
|
((inactive inactive-range)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format org-groff-inactive-timestamp-format value))
|
|
|
|
|
(t (format org-groff-diary-timestamp-format value)))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Underline
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-underline (underline contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode UNDERLINE from Org to Groff.
|
|
|
|
|
CONTENTS is the text with underline markup. INFO is a plist
|
|
|
|
|
holding contextual information."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup contents 'underline))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Verbatim
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-verbatim (verbatim contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a VERBATIM object from Org to Groff.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff--text-markup (org-element-property :value verbatim) 'verbatim))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2012-08-08 12:11:09 +00:00
|
|
|
|
;;; Verse Block
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-verse-block (verse-block contents info)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Transcode a VERSE-BLOCK element from Org to Groff.
|
|
|
|
|
CONTENTS is verse block contents. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format ".DS C\n.ft HI\n%s\n.ft\n.DE" contents))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Interactive functions
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-export-to-groff
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Export current buffer to a Groff 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.
|
|
|
|
|
|
|
|
|
|
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."
|
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
|
|
|
|
(interactive)
|
2012-11-29 20:52:43 +00:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(if async
|
|
|
|
|
(org-export-async-start
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(lambda (f) (org-export-add-to-stack f 'groff))
|
|
|
|
|
(let ((org-groff-registered-references nil)
|
|
|
|
|
(org-groff-special-content nil))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
`(expand-file-name
|
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'groff ,outfile ,subtreep ,visible-only ,body-only
|
2012-12-02 16:24:19 +00:00
|
|
|
|
',ext-plist))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let ((org-groff-registered-references nil)
|
|
|
|
|
(org-groff-special-content nil))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'groff outfile 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-groff-export-to-pdf
|
2012-12-02 16:24:19 +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.
|
|
|
|
|
|
|
|
|
|
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)
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(if async
|
|
|
|
|
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
|
|
|
|
|
(org-export-async-start
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(lambda (f) (org-export-add-to-stack f 'groff))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
`(expand-file-name
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff-compile
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'groff ,outfile ,subtreep ,visible-only ,body-only
|
2012-12-02 16:24:19 +00:00
|
|
|
|
',ext-plist)))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-groff-compile
|
|
|
|
|
(org-groff-export-to-groff
|
2012-12-02 16:24:19 +00:00
|
|
|
|
nil 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-groff-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-groff-pdf-process'.
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
Return PDF file name or an error if it couldn't be produced."
|
2012-10-25 14:06:18 +00:00
|
|
|
|
(let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
|
|
|
|
|
(full-name (file-truename file))
|
|
|
|
|
(out-dir (file-name-directory file))
|
2013-05-30 18:29:34 +00:00
|
|
|
|
;; Properly set working directory for compilation.
|
2013-05-30 19:48:48 +00:00
|
|
|
|
(default-directory (if (file-name-absolute-p file)
|
2013-05-30 18:29:34 +00:00
|
|
|
|
(file-name-directory full-name)
|
|
|
|
|
default-directory))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
errors)
|
2012-10-25 14:06:18 +00:00
|
|
|
|
(message (format "Processing Groff file %s ..." file))
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(cond
|
|
|
|
|
;; A function is provided: Apply it.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((functionp org-groff-pdf-process)
|
|
|
|
|
(funcall org-groff-pdf-process (shell-quote-argument file)))
|
2012-10-25 14:06:18 +00:00
|
|
|
|
;; A list is provided: Replace %b, %f and %o with appropriate
|
|
|
|
|
;; values in each command before applying it. Output is
|
|
|
|
|
;; redirected to "*Org PDF Groff Output*" buffer.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((consp org-groff-pdf-process)
|
2012-10-25 14:06:18 +00:00
|
|
|
|
(let ((outbuf (get-buffer-create "*Org PDF Groff Output*")))
|
|
|
|
|
(mapc
|
|
|
|
|
(lambda (command)
|
|
|
|
|
(shell-command
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%b" (shell-quote-argument base-name)
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%f" (shell-quote-argument full-name)
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"%o" (shell-quote-argument out-dir) command t t)
|
|
|
|
|
t t) t t)
|
|
|
|
|
outbuf))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-groff-pdf-process)
|
2012-10-25 14:06:18 +00:00
|
|
|
|
;; Collect standard errors from output buffer.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(setq errors (org-groff-collect-errors outbuf))))
|
2012-10-25 14:06:18 +00:00
|
|
|
|
(t (error "No valid command to process to PDF")))
|
2013-05-30 18:29:48 +00:00
|
|
|
|
(let ((pdffile (concat out-dir base-name ".pdf")))
|
2012-10-25 14:06:18 +00:00
|
|
|
|
;; Check for process failure. Provide collected errors if
|
|
|
|
|
;; possible.
|
|
|
|
|
(if (not (file-exists-p pdffile))
|
|
|
|
|
(error (concat (format "PDF file %s wasn't produced" pdffile)
|
|
|
|
|
(when errors (concat ": " errors))))
|
|
|
|
|
;; Else remove log files, when specified, and signal end of
|
|
|
|
|
;; process to user, along with any error encountered.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(when org-groff-remove-logfiles
|
|
|
|
|
(dolist (ext org-groff-logfiles-extensions)
|
2012-10-25 14:06:18 +00:00
|
|
|
|
(let ((file (concat out-dir base-name "." ext)))
|
|
|
|
|
(when (file-exists-p file) (delete-file file)))))
|
|
|
|
|
(message (concat "Process completed"
|
|
|
|
|
(if (not errors) "."
|
|
|
|
|
(concat " with errors: " errors)))))
|
|
|
|
|
;; Return output file name.
|
|
|
|
|
pdffile))))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-groff-collect-errors (buffer)
|
2012-07-28 20:20:41 +00:00
|
|
|
|
"Collect some kind of errors from \"groff\" output
|
|
|
|
|
BUFFER is the buffer containing output.
|
|
|
|
|
Return collected error types as a string, or nil if there was
|
|
|
|
|
none."
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
;; Find final run
|
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
|
|
|
|
nil)))
|
2012-07-28 20:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(provide 'ox-groff)
|
|
|
|
|
;;; ox-groff.el ends here
|