summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-01-27 23:11:34 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-02-06 23:06:30 +0100
commit8dd2bfc2915b969271160eb5d76dcc581b4121b8 (patch)
tree4537925616d886b5447064b89d74e1e3b1d181b0
parent33c4f6233d25821079282852de65ff6f2b53a9d4 (diff)
downloadorg-mode-57341459cf4c80a8e298057d70bf4f5f8f65fc63.tar.gz
Move new export framework files into corerelease_8.0-alpha
* contrib/README: Remove references to new export framework. * contrib/lisp/org-e-ascii.el: Removed file. * contrib/lisp/org-e-beamer.el: Removed file. * contrib/lisp/org-e-confluence.el: Removed file. * contrib/lisp/org-e-groff.el: Removed file. * contrib/lisp/org-e-html.el: Removed file. * contrib/lisp/org-e-icalendar.el: Removed file. * contrib/lisp/org-e-latex.el: Removed file. * contrib/lisp/org-e-man.el: Removed file. * contrib/lisp/org-e-odt.el: Removed file. * contrib/lisp/org-e-publish.el: Removed file. * contrib/lisp/org-e-texinfo.el: Removed file. * contrib/lisp/org-export.el: Removed file. * contrib/lisp/org-koma-letter.el: Removed file. * contrib/lisp/org-md.el: Removed file. * contrib/lisp/ox-confluence.el: New file. * contrib/lisp/ox-groff.el: New file. * contrib/lisp/ox-koma-letter.el: New file. * lisp/ox-ascii.el: New file. * lisp/ox-beamer.el: New file. * lisp/ox-html.el: New file. * lisp/ox-icalendar.el: New file. * lisp/ox-jsinfo.el: New file. * lisp/ox-latex.el: New file. * lisp/ox-man.el: New file. * lisp/ox-md.el: New file. * lisp/ox-odt.el: New file. * lisp/ox-publish.el: New file. * lisp/ox-texinfo.el: New file. * lisp/ox.el: New file. * mk/org-fixup.el (org-make-org-loaddefs): Install new export framework and back-end files. * testing/lisp/test-org-export.el: Removed file. * testing/lisp/test-ox.el: New file.
-rw-r--r--contrib/README16
-rw-r--r--contrib/lisp/ox-confluence.el (renamed from contrib/lisp/org-e-confluence.el)94
-rw-r--r--contrib/lisp/ox-groff.el (renamed from contrib/lisp/org-e-groff.el)637
-rw-r--r--contrib/lisp/ox-koma-letter.el (renamed from contrib/lisp/org-koma-letter.el)19
-rw-r--r--lisp/ox-ascii.el (renamed from contrib/lisp/org-e-ascii.el)806
-rw-r--r--lisp/ox-beamer.el (renamed from contrib/lisp/org-e-beamer.el)424
-rw-r--r--lisp/ox-html.el (renamed from contrib/lisp/org-e-html.el)1083
-rw-r--r--lisp/ox-icalendar.el (renamed from contrib/lisp/org-e-icalendar.el)375
-rw-r--r--lisp/ox-jsinfo.el260
-rw-r--r--lisp/ox-latex.el (renamed from contrib/lisp/org-e-latex.el)876
-rw-r--r--lisp/ox-man.el (renamed from contrib/lisp/org-e-man.el)432
-rw-r--r--lisp/ox-md.el (renamed from contrib/lisp/org-md.el)40
-rw-r--r--lisp/ox-odt.el (renamed from contrib/lisp/org-e-odt.el)1440
-rw-r--r--lisp/ox-org.el114
-rw-r--r--lisp/ox-publish.el (renamed from contrib/lisp/org-e-publish.el)512
-rw-r--r--lisp/ox-texinfo.el (renamed from contrib/lisp/org-e-texinfo.el)587
-rw-r--r--lisp/ox.el (renamed from contrib/lisp/org-export.el)1028
-rw-r--r--mk/org-fixup.el3
-rw-r--r--testing/lisp/test-ox.el (renamed from testing/lisp/test-org-export.el)115
19 files changed, 4635 insertions, 4226 deletions
diff --git a/contrib/README b/contrib/README
index 687f01d..dcf04e7 100644
--- a/contrib/README
+++ b/contrib/README
@@ -27,7 +27,6 @@ org-eval.el --- The <lisp> tag, adapted from Muse
org-eval-light.el --- Evaluate in-buffer code on demand
org-exp-bibtex.el --- Export citations to LaTeX and HTML
org-expiry.el --- Expiry mechanism for Org entries
-org-export.el --- Generic Export Engine For Org
org-export-generic.el --- Export framework for configurable backends
org-git-link.el --- Provide org links to specific file version
org-interactive-query.el --- Interactive modification of tags query
@@ -55,21 +54,6 @@ org-velocity.el --- something like Notational Velocity for Org
org-wikinodes.el --- CamelCase wiki-like links for Org
-EXPORT ENGINE AND BACKENDS (emacs-lisp code)
-============================================
-
-org-export.el --- the new export engine
-org-e-latex.el --- LaTeX export backend
-org-e-ascii.el --- ASCII export backend
-org-e-beamer.el --- Beamer export backend
-org-e-groff.el --- Groff export backend
-org-e-html.el --- HTML export backend
-org-e-man.el --- man pages export backend
-org-e-odt.el --- ODT export backend
-org-e-texinfo.el --- TeXinfo export backend
-org-md.el --- MarkDown export backend
-
-
BABEL
=====
library-of-babel.org --- Documentation for the library of babel
diff --git a/contrib/lisp/org-e-confluence.el b/contrib/lisp/ox-confluence.el
index f3d46d3..99ef9c0 100644
--- a/contrib/lisp/org-e-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -1,4 +1,4 @@
-;;; org-e-confluence --- Confluence Wiki Back-End for Org Export Engine
+;;; ox-confluence --- Confluence Wiki Back-End for Org Export Engine
;; Copyright (C) 2012 Sébastien Delafond
@@ -22,58 +22,58 @@
;;; Commentary:
;;
-;; org-confluence.el lets you convert Org files to confluence files using
-;; the org-export.el experimental engine.
+;; ox-confluence.el lets you convert Org files to confluence files
+;; using the ox.el export engine.
;;
;; Put this file into your load-path and the following into your ~/.emacs:
-;; (require 'org-confluence)
+;; (require 'ox-confluence)
;;
;; Export Org files to confluence:
-;; M-x org-e-confluence-export-as-confluence RET
+;; M-x org-confluence-export-as-confluence RET
;;
;;; Code:
-(require 'org-export)
-(require 'org-e-ascii)
+(require 'ox)
+(require 'ox-ascii)
;; Define the backend itself
-(org-export-define-derived-backend e-confluence e-ascii
- :translate-alist ((bold . org-e-confluence-bold)
- (example-block . org-e-confluence-example-block)
- (fixed-width . org-e-confluence-fixed-width)
- (footnote-definition . org-e-confluence-empty)
- (footnote-reference . org-e-confluence-empty)
- (headline . org-e-confluence-headline)
- (italic . org-e-confluence-italic)
- (link . org-e-confluence-link)
- (section . org-e-confluence-section)
- (src-block . org-e-confluence-src-block)
- (strike-through . org-e-confluence-strike-through)
- (table . org-e-confluence-table)
- (table-cell . org-e-confluence-table-cell)
- (table-row . org-e-confluence-table-row)
- (template . org-e-confluence-template)
- (underline . org-e-confluence-underline)))
+(org-export-define-derived-backend confluence ascii
+ :translate-alist ((bold . org-confluence-bold)
+ (example-block . org-confluence-example-block)
+ (fixed-width . org-confluence-fixed-width)
+ (footnote-definition . org-confluence-empty)
+ (footnote-reference . org-confluence-empty)
+ (headline . org-confluence-headline)
+ (italic . org-confluence-italic)
+ (link . org-confluence-link)
+ (section . org-confluence-section)
+ (src-block . org-confluence-src-block)
+ (strike-through . org-confluence-strike-through)
+ (table . org-confluence-table)
+ (table-cell . org-confluence-table-cell)
+ (table-row . org-confluence-table-row)
+ (template . org-confluence-template)
+ (underline . org-confluence-underline)))
;; All the functions we use
-(defun org-e-confluence-bold (bold contents info)
+(defun org-confluence-bold (bold contents info)
(format "*%s*" contents))
-(defun org-e-confluence-empty (empy contents info)
+(defun org-confluence-empty (empy contents info)
"")
-(defun org-e-confluence-example-block (example-block contents info)
+(defun org-confluence-example-block (example-block contents info)
;; FIXME: provide a user-controlled variable for theme
(let ((content (org-export-format-code-default example-block info)))
- (org-e-confluence--block "none" "Confluence" content)))
+ (org-confluence--block "none" "Confluence" content)))
-(defun org-e-confluence-italic (italic contents info)
+(defun org-confluence-italic (italic contents info)
(format "_%s_" contents))
-(defun org-e-confluence-fixed-width (fixed-width contents info)
+(defun org-confluence-fixed-width (fixed-width contents info)
(format "\{\{%s\}\}" contents))
-(defun org-e-confluence-headline (headline contents info)
+(defun org-confluence-headline (headline contents info)
(let ((low-level-rank (org-export-low-level-p headline info))
(text (org-export-data (org-element-property :title headline)
info))
@@ -83,7 +83,7 @@
(if (org-string-nw-p contents) contents
""))))
-(defun org-e-confluence-link (link desc info)
+(defun org-confluence-link (link desc info)
(let ((raw-link (org-element-property :raw-link link)))
(concat "["
(when (org-string-nw-p desc) (format "%s|" desc))
@@ -93,45 +93,45 @@
(t
raw-link))
"]")))
-(defun org-e-confluence-section (section contents info)
+(defun org-confluence-section (section contents info)
contents)
-(defun org-e-confluence-src-block (src-block contents info)
+(defun org-confluence-src-block (src-block contents info)
;; FIXME: provide a user-controlled variable for theme
(let* ((lang (org-element-property :language src-block))
(language (if (string= lang "sh") "bash" ;; FIXME: provide a mapping of some sort
lang))
(content (org-export-format-code-default src-block info)))
- (org-e-confluence--block language "Emacs" content)))
+ (org-confluence--block language "Emacs" content)))
-(defun org-e-confluence-strike-through (strike-through contents info)
+(defun org-confluence-strike-through (strike-through contents info)
(format "-%s-" contents))
-(defun org-e-confluence-table (table contents info)
+(defun org-confluence-table (table contents info)
contents)
-(defun org-e-confluence-table-row (table-row contents info)
+(defun org-confluence-table-row (table-row contents info)
(concat
(if (org-string-nw-p contents) (format "|%s" contents)
"")
(when (org-export-table-row-ends-header-p table-row info)
"|")))
-(defun org-e-confluence-table-cell (table-cell contents info)
+(defun org-confluence-table-cell (table-cell contents info)
(let ((table-row (org-export-get-parent table-cell)))
(concat
(when (org-export-table-row-starts-header-p table-row info)
"|")
contents "|")))
-(defun org-e-confluence-template (contents info)
+(defun org-confluence-template (contents info)
(let ((depth (plist-get info :with-toc)))
(concat (when depth "\{toc\}\n\n") contents)))
-(defun org-e-confluence-underline (underline contents info)
+(defun org-confluence-underline (underline contents info)
(format "+%s+" contents))
-(defun org-e-confluence--block (language theme contents)
+(defun org-confluence--block (language theme contents)
(concat "\{code:theme=" theme
(when language (format "|language=%s" language))
"}\n"
@@ -139,7 +139,7 @@
"\{code\}\n"))
;; main interactive entrypoint
-(defun org-e-confluence-export-as-confluence
+(defun org-confluence-export-as-confluence
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a text buffer.
@@ -178,14 +178,14 @@ is non-nil."
(insert output)
(goto-char (point-min))
(text-mode)
- (org-export-add-to-stack (current-buffer) 'e-confluence)))
- `(org-export-as 'e-confluence ,subtreep ,visible-only ,body-only
+ (org-export-add-to-stack (current-buffer) 'confluence)))
+ `(org-export-as 'confluence ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf (org-export-to-buffer
- 'e-confluence "*Org E-Confluence Export*"
+ 'confluence "*Org E-Confluence Export*"
subtreep visible-only body-only ext-plist)))
(with-current-buffer outbuf (text-mode))
(when org-export-show-temporary-export-buffer
(switch-to-buffer-other-window outbuf)))))
-(provide 'org-e-confluence)
+(provide 'ox-confluence)
diff --git a/contrib/lisp/org-e-groff.el b/contrib/lisp/ox-groff.el
index c7fbeac..db62e45 100644
--- a/contrib/lisp/org-e-groff.el
+++ b/contrib/lisp/ox-groff.el
@@ -1,4 +1,4 @@
-;; org-e-groff.el --- Groff Back-End For Org Export Engine
+;; ox-groff.el --- Groff Back-End for Org Export Engine
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
@@ -21,16 +21,15 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
-;; This library implements a Groff Memorandum Macro back-end for
-;; Org generic exporter.
+;; This library implements a Groff Memorandum Macro back-end for Org
+;; generic exporter.
;;
;; To test it, run
;;
-;; M-: (org-export-to-buffer 'e-groff "*Test e-Groff*") RET
+;; M-: (org-export-to-buffer 'groff "*Test Groff*") RET
;;
;; in an org-mode buffer then switch to the buffer to see the Groff
-;; export. See contrib/lisp/org-export.el for more details on how
-;; this exporter works.
+;; export. See ox.el for more details on how this exporter works.
;;
;; It introduces two new buffer keywords: "GROFF_CLASS" and
;; "GROFF_CLASS_OPTIONS".
@@ -38,73 +37,71 @@
;;; Code:
(eval-when-compile (require 'cl))
-(require 'org-export)
+(require 'ox)
(defvar orgtbl-exp-regexp)
;;; Define Back-End
-(org-export-define-backend e-groff
- ((bold . org-e-groff-bold)
- (center-block . org-e-groff-center-block)
- (clock . org-e-groff-clock)
- (code . org-e-groff-code)
- (drawer . org-e-groff-drawer)
- (dynamic-block . org-e-groff-dynamic-block)
- (entity . org-e-groff-entity)
- (example-block . org-e-groff-example-block)
- (export-block . org-e-groff-export-block)
- (export-snippet . org-e-groff-export-snippet)
- (fixed-width . org-e-groff-fixed-width)
- (footnote-definition . org-e-groff-footnote-definition)
- (footnote-reference . org-e-groff-footnote-reference)
- (headline . org-e-groff-headline)
- (horizontal-rule . org-e-groff-horizontal-rule)
- (inline-src-block . org-e-groff-inline-src-block)
- (inlinetask . org-e-groff-inlinetask)
- (italic . org-e-groff-italic)
- (item . org-e-groff-item)
- (keyword . org-e-groff-keyword)
- ;; (latex-environment . org-e-groff-latex-environment)
- ;; (latex-fragment . org-e-groff-latex-fragment)
- (line-break . org-e-groff-line-break)
- (link . org-e-groff-link)
- (paragraph . org-e-groff-paragraph)
- (plain-list . org-e-groff-plain-list)
- (plain-text . org-e-groff-plain-text)
- (planning . org-e-groff-planning)
- (property-drawer . org-e-groff-property-drawer)
- (quote-block . org-e-groff-quote-block)
- (quote-section . org-e-groff-quote-section)
- (radio-target . org-e-groff-radio-target)
- (section . org-e-groff-section)
- (special-block . org-e-groff-special-block)
- (src-block . org-e-groff-src-block)
- (statistics-cookie . org-e-groff-statistics-cookie)
- (strike-through . org-e-groff-strike-through)
- (subscript . org-e-groff-subscript)
- (superscript . org-e-groff-superscript)
- (table . org-e-groff-table)
- (table-cell . org-e-groff-table-cell)
- (table-row . org-e-groff-table-row)
- (target . org-e-groff-target)
- (template . org-e-groff-template)
- (timestamp . org-e-groff-timestamp)
- (underline . org-e-groff-underline)
- (verbatim . org-e-groff-verbatim)
- (verse-block . org-e-groff-verse-block))
+(org-export-define-backend groff
+ ((bold . org-groff-bold)
+ (center-block . org-groff-center-block)
+ (clock . org-groff-clock)
+ (code . org-groff-code)
+ (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 . org-groff-property-drawer)
+ (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))
:export-block "GROFF"
:menu-entry
(?g "Export to GROFF"
- ((?g "As GROFF file" org-e-groff-export-to-groff)
- (?p "As PDF file" org-e-groff-export-to-pdf)
+ ((?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-e-groff-export-to-pdf t s v b)
- (org-open-file (org-e-groff-export-to-pdf nil 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)))))))
:options-alist
- ((:groff-class "GROFF_CLASS" nil org-e-groff-default-class t)
+ ((: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)))
@@ -112,19 +109,19 @@
;;; User Configurable Variables
-(defgroup org-export-e-groff nil
+(defgroup org-export-groff nil
"Options for exporting Org mode files to Groff."
:tag "Org Export Groff"
:group 'org-export)
;;; Preamble
-(defcustom org-e-groff-default-class "internal"
+(defcustom org-groff-default-class "internal"
"The default Groff class."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(string :tag "Groff class"))
-(defcustom org-e-groff-classes
+(defcustom org-groff-classes
'(("file" ".MT 1"
(:heading 'default :type "memo" :last-section "toc"))
("internal" ".MT 0"
@@ -163,7 +160,7 @@
"This list describes the attributes for the documents being created.
It allows for the creation of new "
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(repeat
(list (string :tag "Document Type")
(string :tag "Header")
@@ -174,10 +171,10 @@
;;; Headline
-(defconst org-e-groff-special-tags
+(defconst org-groff-special-tags
'("FROM" "TO" "ABSTRACT" "APPENDIX" "BODY" "NS"))
-(defcustom org-e-groff-format-headline-function nil
+(defcustom org-groff-format-headline-function nil
"Function to format headline text.
This function will be called with 5 arguments:
@@ -192,7 +189,7 @@ 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:
-\(defun org-e-groff-format-headline (todo todo-type priority text tags)
+\(defun org-groff-format-headline (todo todo-type priority text tags)
\"Default format function for an headline.\"
\(concat (when todo
\(format \"\\fB%s\\fP \" todo))
@@ -202,29 +199,29 @@ order to reproduce the default set-up:
\(when tags
\(format \" %s \"
\(mapconcat 'identity tags \":\"))))"
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'function)
;;; Timestamps
-(defcustom org-e-groff-active-timestamp-format "\\fI%s\\fP"
+(defcustom org-groff-active-timestamp-format "\\fI%s\\fP"
"A printf format string to be applied to active timestamps."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'string)
-(defcustom org-e-groff-inactive-timestamp-format "\\fI%s\\fP"
+(defcustom org-groff-inactive-timestamp-format "\\fI%s\\fP"
"A printf format string to be applied to inactive timestamps."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'string)
-(defcustom org-e-groff-diary-timestamp-format "\\fI%s\\fP"
+(defcustom org-groff-diary-timestamp-format "\\fI%s\\fP"
"A printf format string to be applied to diary timestamps."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'string)
;;; Links
-(defcustom org-e-groff-inline-image-rules
+(defcustom org-groff-inline-image-rules
'(("file" . "\\.\\(jpg\\|png\\|pdf\\|ps\\|eps\\|pic\\)\\'")
("fuzzy" . "\\.\\(jpg\\|png\\|pdf\\|ps\\|eps\\|pic\\)\\'"))
"Rules characterizing image files that can be inlined into Groff.
@@ -238,41 +235,41 @@ 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."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
-(defcustom org-e-groff-link-with-unknown-path-format "\\fI%s\\fP"
+(defcustom org-groff-link-with-unknown-path-format "\\fI%s\\fP"
"Format string for links with unknown path type."
:group 'org-export-groff
:type 'string)
;;; Tables
-(defcustom org-e-groff-tables-centered t
+(defcustom org-groff-tables-centered t
"When non-nil, tables are exported in a center environment."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'boolean)
-(defcustom org-e-groff-tables-verbatim nil
+(defcustom org-groff-tables-verbatim nil
"When non-nil, tables are exported verbatim."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'boolean)
-(defcustom org-e-groff-table-scientific-notation "%sE%s"
+(defcustom org-groff-table-scientific-notation "%sE%s"
"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."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(choice
(string :tag "Format string")
(const :tag "No formatting")))
;;; Text markup
-(defcustom org-e-groff-text-markup-alist
+(defcustom org-groff-text-markup-alist
'((bold . "\\fB%s\\fP")
(code . "\\fC%s\\fP")
(italic . "\\fI%s\\fP")
@@ -287,13 +284,13 @@ a formatting string to wrap fontified text with it.
If no association can be found for a given markup, text will be
returned as-is."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'alist
:options '(bold code italic strike-through underline verbatim))
;;; Drawers
-(defcustom org-e-groff-format-drawer-function nil
+(defcustom org-groff-format-drawer-function nil
"Function called to format a drawer in Groff code.
The function must accept two parameters:
@@ -305,15 +302,15 @@ 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:
-\(defun org-e-groff-format-drawer-default \(name contents\)
+\(defun org-groff-format-drawer-default \(name contents\)
\"Format a drawer element for Groff export.\"
contents\)"
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'function)
;;; Inlinetasks
-(defcustom org-e-groff-format-inlinetask-function nil
+(defcustom org-groff-format-inlinetask-function nil
"Function called to format an inlinetask in Groff code.
The function must accept six parameters:
@@ -329,7 +326,7 @@ 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:
-\(defun org-e-groff-format-inlinetask \(todo type priority name tags contents\)
+\(defun org-groff-format-inlinetask \(todo type priority name tags contents\)
\"Format an inline task element for Groff export.\"
\(let ((full-title
\(concat
@@ -345,17 +342,17 @@ in order to mimic default behaviour:
\"%s\"
\".DE\")
full-title contents))"
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'function)
;; Src blocks
-(defcustom org-e-groff-source-highlight nil
+(defcustom org-groff-source-highlight nil
"Use GNU source highlight to embellish source blocks "
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'boolean)
-(defcustom org-e-groff-source-highlight-langs
+(defcustom org-groff-source-highlight-langs
'((emacs-lisp "lisp") (lisp "lisp") (clojure "lisp")
(scheme "scheme")
(c "c") (cc "cpp") (csharp "csharp") (d "d")
@@ -380,13 +377,13 @@ 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."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(repeat
(list
(symbol :tag "Major mode ")
(string :tag "Listings language"))))
-(defcustom org-e-groff-source-highlight-options nil
+(defcustom org-groff-source-highlight-options nil
"Association list of options for the groff listings package.
These options are supplied as a comma-separated list to the
@@ -394,7 +391,7 @@ These options are supplied as a comma-separated list to the
a list containing two strings: the name of the option, and the
value. For example,
- (setq org-e-groff-source-highlight-options
+ (setq org-groff-source-highlight-options
'((\"basicstyle\" \"\\small\")
(\"keywordstyle\" \"\\color{black}\\bfseries\\underbar\")))
@@ -403,19 +400,19 @@ black keywords.
Note that the same options will be applied to blocks of all
languages."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(repeat
(list
(string :tag "Listings option name ")
(string :tag "Listings option value"))))
-(defvar org-e-groff-custom-lang-environments nil
+(defvar org-groff-custom-lang-environments nil
"Alist mapping languages to language-specific Groff environments.
It is used during export of src blocks by the listings and
groff packages. For example,
- \(setq org-e-groff-custom-lang-environments
+ \(setq org-groff-custom-lang-environments
'\(\(python \"pythoncode\"\)\)\)
would have the effect that if org encounters begin_src python
@@ -424,13 +421,13 @@ language.")
;;; Plain text
-(defcustom org-e-groff-special-char
+(defcustom org-groff-special-char
'(("(c)" . "\\\\(co")
("(tm)" . "\\\\(tm")
("(rg)" . "\\\\(rg"))
"CONS list in which the value of the car
is replace on the value of the CDR. "
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(list
(cons :tag "Character Subtitute"
(string :tag "Original Character Group")
@@ -438,7 +435,7 @@ language.")
;;; Compilation
-(defcustom org-e-groff-pdf-process
+(defcustom org-groff-pdf-process
'("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")
@@ -461,48 +458,48 @@ extension) and %o by the base directory of the file."
"pic %f | tbl | eqn | groff -mm | ps2pdf - > %b.pdf"))
(function)))
-(defcustom org-e-groff-logfiles-extensions
+(defcustom org-groff-logfiles-extensions
'("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
"The list of file extensions to consider as Groff logfiles."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type '(repeat (string :tag "Extension")))
-(defcustom org-e-groff-remove-logfiles t
+(defcustom org-groff-remove-logfiles t
"Non-nil means remove the logfiles produced by PDF production.
These are the .aux, .log, .out, and .toc files."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'boolean)
-(defcustom org-e-groff-organization "Org User"
+(defcustom org-groff-organization "Org User"
"Name of the organization used to populate the .AF command."
- :group 'org-export-e-groff
+ :group 'org-export-groff
:type 'string)
-(defcustom org-e-groff-raster-to-ps nil
+(defcustom org-groff-raster-to-ps nil
"Command used to convert raster to EPS. Nil for no conversion. Make sure that
- `org-e-groff-inline-image-rules' is adjusted accordingly if not conversion is being
+ `org-groff-inline-image-rules' is adjusted accordingly if not conversion is being
done. In this case, remove the entries for jpg and png in the file and fuzzy lists."
- :group 'org-export-e-groff
+ :group 'org-export-groff
: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)))
-(defvar org-e-groff-registered-references nil)
-(defvar org-e-groff-special-content nil)
+(defvar org-groff-registered-references nil)
+(defvar org-groff-special-content nil)
;;; Internal Functions
-(defun org-e-groff--caption/label-string (element info)
+(defun org-groff--caption/label-string (element info)
"Return caption and label Groff string for ELEMENT.
INFO is a plist holding contextual information. If there's no
caption nor label, return the empty string.
-For non-floats, see `org-e-groff--wrap-label'."
+For non-floats, see `org-groff--wrap-label'."
(let ((main (org-export-get-caption element))
(short (org-export-get-caption element t))
(label (org-element-property :name element)))
@@ -515,19 +512,19 @@ For non-floats, see `org-e-groff--wrap-label'."
;; Standard caption format.
(t (format "\\fR%s\\fP" (org-export-data main info))))))
-(defun org-e-groff--wrap-label (element output)
+(defun org-groff--wrap-label (element output)
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
This function shouldn't be used for floats. See
-`org-e-groff--caption/label-string'."
+`org-groff--caption/label-string'."
(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))))
-(defun org-e-groff--text-markup (text markup)
+(defun org-groff--text-markup (text markup)
"Format TEXT depending on MARKUP text markup.
-See `org-e-groff-text-markup-alist' for details."
- (let ((fmt (cdr (assq markup org-e-groff-text-markup-alist))))
+See `org-groff-text-markup-alist' for details."
+ (let ((fmt (cdr (assq markup org-groff-text-markup-alist))))
(cond
;; No format string: Return raw text.
((not fmt) text)
@@ -549,10 +546,10 @@ See `org-e-groff-text-markup-alist' for details."
(t (format fmt text)))))
-(defun org-e-groff--get-tagged-content (tag info)
- (cdr (assoc tag org-e-groff-special-content)))
+(defun org-groff--get-tagged-content (tag info)
+ (cdr (assoc tag org-groff-special-content)))
-(defun org-e-groff--mt-head (title contents attr info)
+(defun org-groff--mt-head (title contents attr info)
(concat
;; 1. Insert Organization
@@ -560,7 +557,7 @@ See `org-e-groff-text-markup-alist' for details."
(cond
((stringp firm-option)
(format ".AF \"%s\" \n" firm-option))
- (t (format ".AF \"%s\" \n" (or org-e-groff-organization "")))))
+ (t (format ".AF \"%s\" \n" (or org-groff-organization "")))))
;; 2. Title
(let ((subtitle1 (plist-get attr :subtitle1))
@@ -589,9 +586,9 @@ See `org-e-groff-text-markup-alist' for details."
(and auth (org-export-data auth info)))))
(email (and (plist-get info :with-email)
(org-export-data (plist-get info :email) info)))
- (from-data (org-e-groff--get-tagged-content "FROM" info))
+ (from-data (org-groff--get-tagged-content "FROM" info))
- (to-data (org-e-groff--get-tagged-content "TO" info)))
+ (to-data (org-groff--get-tagged-content "TO" info)))
(cond
((and author from-data)
@@ -629,23 +626,23 @@ See `org-e-groff-text-markup-alist' for details."
;; If Abstract, then Populate Abstract
;;
- (let ((abstract-data (org-e-groff--get-tagged-content "ABSTRACT" info))
- (to-data (org-e-groff--get-tagged-content "TO" info)))
+ (let ((abstract-data (org-groff--get-tagged-content "ABSTRACT" info))
+ (to-data (org-groff--get-tagged-content "TO" info)))
(cond
(abstract-data
(format ".AS\n%s\n.AE\n" abstract-data))
(to-data
(format ".AS\n%s\n.AE\n" to-data))))))
-(defun org-e-groff--letter-head (title contents attr info)
+(defun org-groff--letter-head (title contents attr info)
(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)))
- (from-data (org-e-groff--get-tagged-content "FROM" info))
+ (from-data (org-groff--get-tagged-content "FROM" info))
(at-item (plist-get attr :author-title))
- (to-data (org-e-groff--get-tagged-content "TO" info)))
+ (to-data (org-groff--get-tagged-content "TO" info)))
;; If FROM then get data from FROM
@@ -676,7 +673,7 @@ See `org-e-groff-text-markup-alist' for details."
;;; Template
-(defun org-e-groff-template (contents info)
+(defun org-groff-template (contents info)
"Return complete document string after Groff conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
@@ -689,7 +686,7 @@ holding export options."
" "))))
(class (plist-get info :groff-class))
(class-options (plist-get info :groff-class-options))
- (classes (assoc class org-e-groff-classes))
+ (classes (assoc class org-groff-classes))
(classes-options (car (last classes)))
(heading-option (plist-get classes-options :heading))
(type-option (plist-get classes-options :type))
@@ -700,7 +697,7 @@ holding export options."
(document-class-string
(progn
(org-element-normalize-string
- (let* ((header (nth 1 (assoc class org-e-groff-classes)))
+ (let* ((header (nth 1 (assoc class org-groff-classes)))
(document-class-item (if (stringp header) header "")))
document-class-item)))))
@@ -728,16 +725,16 @@ holding export options."
(concat
(format ".COVER %s\n" document-class-string)
- (org-e-groff--mt-head title contents attr info)
+ (org-groff--mt-head title contents attr info)
".COVEND\n"))
((string= type-option "memo")
(concat
- (org-e-groff--mt-head title contents attr info)
+ (org-groff--mt-head title contents attr info)
document-class-string))
((string= type-option "letter")
(concat
- (org-e-groff--letter-head title contents attr info)
+ (org-groff--letter-head title contents attr info)
(let ((sa-item (plist-get attr :salutation))
(cn-item (plist-get attr :confidential))
(sj-item (plist-get attr :subject))
@@ -787,7 +784,7 @@ holding export options."
(when (string= (car item) "NS")
(replace-regexp-in-string
"\\.P\n" "" (cdr item))))
- (reverse org-e-groff-special-content) "\n")))))
+ (reverse org-groff-special-content) "\n")))))
@@ -800,31 +797,31 @@ holding export options."
;;; Bold
-(defun org-e-groff-bold (bold contents info)
+(defun org-groff-bold (bold contents info)
"Transcode BOLD from Org to Groff.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
- (org-e-groff--text-markup contents 'bold))
+ (org-groff--text-markup contents 'bold))
;;; Center Block
-(defun org-e-groff-center-block (center-block contents info)
+(defun org-groff-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to Groff.
CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
center-block
(format ".DS C \n%s\n.DE" contents)))
;;; Clock
-(defun org-e-groff-clock (clock contents info)
+(defun org-groff-clock (clock contents info)
"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)
- (format org-e-groff-inactive-timestamp-format
+ (format org-groff-inactive-timestamp-format
(concat (org-translate-time
(org-element-property :raw-value
(org-element-property :value clock)))
@@ -833,40 +830,40 @@ information."
;;; Code
-(defun org-e-groff-code (code contents info)
+(defun org-groff-code (code contents info)
"Transcode a CODE object from Org to Groff.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-groff--text-markup (org-element-property :value code) 'code))
+ (org-groff--text-markup (org-element-property :value code) 'code))
;;; Comments and Comment Blocks are ignored.
;;; Drawer
-(defun org-e-groff-drawer (drawer contents info)
+(defun org-groff-drawer (drawer contents info)
"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))
- (output (if (functionp org-e-groff-format-drawer-function)
- (funcall org-e-groff-format-drawer-function
+ (output (if (functionp org-groff-format-drawer-function)
+ (funcall org-groff-format-drawer-function
name contents)
;; If there's no user defined function: simply
;; display contents of the drawer.
contents)))
- (org-e-groff--wrap-label drawer output)))
+ (org-groff--wrap-label drawer output)))
;;; Dynamic Block
-(defun org-e-groff-dynamic-block (dynamic-block contents info)
+(defun org-groff-dynamic-block (dynamic-block contents info)
"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'."
- (org-e-groff--wrap-label dynamic-block contents))
+ (org-groff--wrap-label dynamic-block contents))
;;; Entity
-(defun org-e-groff-entity (entity contents info)
+(defun org-groff-entity (entity contents info)
"Transcode an ENTITY object from Org to Groff.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -874,18 +871,18 @@ contextual information."
;;; Example Block
-(defun org-e-groff-example-block (example-block contents info)
+(defun org-groff-example-block (example-block contents info)
"Transcode an EXAMPLE-BLOCK element from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
example-block
(format ".DS L\n%s\n.DE"
(org-export-format-code-default example-block info))))
;;; Export Block
-(defun org-e-groff-export-block (export-block contents info)
+(defun org-groff-export-block (export-block contents info)
"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")
@@ -893,18 +890,18 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Export Snippet
-(defun org-e-groff-export-snippet (export-snippet contents info)
+(defun org-groff-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-groff)
+ (when (eq (org-export-snippet-backend export-snippet) 'groff)
(org-element-property :value export-snippet)))
;;; Fixed Width
-(defun org-e-groff-fixed-width (fixed-width contents info)
+(defun org-groff-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
fixed-width
(format "\\fC\n%s\\fP"
(org-remove-indentation
@@ -917,7 +914,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; Footnotes are handled automatically in GROFF. Although manual
;; references can be added, not really required.
-(defun org-e-groff-footnote-reference (footnote-reference contents info)
+(defun org-groff-footnote-reference (footnote-reference contents info)
;; Changing from info to footnote-reference
(let* ((raw (org-export-get-footnote-definition footnote-reference info))
(n (org-export-get-footnote-number footnote-reference info))
@@ -925,17 +922,17 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(ref-id (plist-get (nth 1 footnote-reference) :label)))
;; It is a reference
(if (string-match "fn:rl" ref-id)
- (if (member ref-id org-e-groff-registered-references)
+ (if (member ref-id org-groff-registered-references)
(format "\\*[%s]" ref-id)
(progn
- (push ref-id org-e-groff-registered-references)
+ (push ref-id org-groff-registered-references)
(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))))
;;; Headline
-(defun org-e-groff-headline (headline contents info)
+(defun org-groff-headline (headline contents info)
"Transcode an HEADLINE element from Org to Groff.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
@@ -944,7 +941,7 @@ holding contextual information."
(numberedp (org-export-numbered-headline-p headline info))
;; Section formatting will set two placeholders: one for the
;; title and the other for the contents.
- (classes (assoc class org-e-groff-classes))
+ (classes (assoc class org-groff-classes))
(classes-options (car (last classes)))
(heading-option (plist-get classes-options :heading))
(section-fmt
@@ -970,9 +967,9 @@ holding contextual information."
(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.
- (full-text (if (functionp org-e-groff-format-headline-function)
+ (full-text (if (functionp org-groff-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-groff-format-headline-function
+ (funcall org-groff-format-headline-function
todo todo-type priority text tags)
;; Default formatting.
(concat
@@ -984,9 +981,9 @@ holding contextual information."
(format " \\fC:%s:\\fP "
(mapconcat 'identity tags ":"))))))
(full-text-no-tag
- (if (functionp org-e-groff-format-headline-function)
+ (if (functionp org-groff-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-groff-format-headline-function
+ (funcall org-groff-format-headline-function
todo todo-type priority text nil)
;; Default formatting.
(concat
@@ -1005,7 +1002,7 @@ holding contextual information."
(cond
;; Case 1: Special Tag
- ((member (car tags) org-e-groff-special-tags)
+ ((member (car tags) org-groff-special-tags)
(cond
((string= (car tags) "BODY") contents)
@@ -1015,11 +1012,11 @@ holding contextual information."
(format ".NS \"%s\" 1 \n%s"
(car (org-element-property :title headline))
(or contents " ")))
- org-e-groff-special-content) nil))
+ org-groff-special-content) nil))
(t
(progn
- (push (cons (car tags) contents) org-e-groff-special-content)
+ (push (cons (car tags) contents) org-groff-special-content)
nil))))
;; Case 2: This is a footnote section: ignore it.
@@ -1060,13 +1057,13 @@ holding contextual information."
;;; Inline Src Block
-(defun org-e-groff-inline-src-block (inline-src-block contents info)
+(defun org-groff-inline-src-block (inline-src-block contents info)
"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
- (org-e-groff-source-highlight
+ (org-groff-source-highlight
(let* ((tmpdir (if (featurep 'xemacs)
temp-directory
temporary-file-directory))
@@ -1076,7 +1073,7 @@ contextual information."
(expand-file-name "reshilite" tmpdir)))
(org-lang (org-element-property :language inline-src-block))
(lst-lang (cadr (assq (intern org-lang)
- org-e-groff-source-highlight-langs)))
+ org-groff-source-highlight-langs)))
(cmd (concat (expand-file-name "source-highlight")
" -s " lst-lang
@@ -1100,7 +1097,7 @@ contextual information."
;;; Inlinetask
-(defun org-e-groff-inlinetask (inlinetask contents info)
+(defun org-groff-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to Groff.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1113,13 +1110,13 @@ holding contextual information."
(org-export-get-tags inlinetask info)))
(priority (and (plist-get info :with-priority)
(org-element-property :priority inlinetask))))
- ;; If `org-e-groff-format-inlinetask-function' is provided, call it
+ ;; If `org-groff-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- (if (functionp org-e-groff-format-inlinetask-function)
- (funcall org-e-groff-format-inlinetask-function
+ (if (functionp org-groff-format-inlinetask-function)
+ (funcall org-groff-format-inlinetask-function
todo todo-type priority title tags contents)
;; Otherwise, use a default template.
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
inlinetask
(let ((full-title
(concat
@@ -1137,15 +1134,15 @@ holding contextual information."
;;; Italic
-(defun org-e-groff-italic (italic contents info)
+(defun org-groff-italic (italic contents info)
"Transcode ITALIC from Org to Groff.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
- (org-e-groff--text-markup contents 'italic))
+ (org-groff--text-markup contents 'italic))
;;; Item
-(defun org-e-groff-item (item contents info)
+(defun org-groff-item (item contents info)
"Transcode an ITEM element from Org to Groff.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1181,7 +1178,7 @@ contextual information."
;;; Keyword
-(defun org-e-groff-keyword (keyword contents info)
+(defun org-groff-keyword (keyword contents info)
"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))
@@ -1190,35 +1187,9 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((string= key "GROFF") value)
(t nil))))
-;;; LaTeX Environment
-
-(defun org-e-groff-latex-environment (latex-environment contents info)
- "Transcode a LATEX-ENVIRONMENT element from Org to Groff.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((label (org-element-property :name latex-environment))
- (value (org-remove-indentation
- (org-element-property :value latex-environment))))
- (if (not (org-string-nw-p label)) value
- ;; Environment is labelled: label must be within the environment
- ;; (otherwise, a reference pointing to that element will count
- ;; the section instead).
- (with-temp-buffer
- (insert value)
- (goto-char (point-min))
- (forward-line)
- (insert (format "%s\n" label))
- (buffer-string)))))
-
-;;; LaTeX Fragment
-
-(defun org-e-groff-latex-fragment (latex-fragment contents info)
- "Transcode a LATEX-FRAGMENT object from Org to Groff.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (org-element-property :value latex-fragment))
-
;;; Line Break
-(defun org-e-groff-line-break (line-break contents info)
+(defun org-groff-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual information."
".br\n")
@@ -1227,7 +1198,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; Inline images just place a call to .PSPIC or .PS/.PE
;; and load the graph.
-(defun org-e-groff-link--inline-image (link info)
+(defun org-groff-link--inline-image (link info)
"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."
@@ -1245,16 +1216,16 @@ used as a communication channel."
(width (or (plist-get attr :width) ""))
(height (or (plist-get attr :height) ""))
(caption (and (not (plist-get attr :disable-caption))
- (org-e-groff--caption/label-string parent info))))
+ (org-groff--caption/label-string parent info))))
;; Now clear ATTR from any special keyword and set a default value
;; if nothing is left. Return proper string.
(concat
(cond
- ((and org-e-groff-raster-to-ps
+ ((and org-groff-raster-to-ps
(or (string-match ".\.png$" path)
(string-match ".\.jpg$" path)))
(let ((eps-path (concat path ".eps")))
- (shell-command (format org-e-groff-raster-to-ps path eps-path))
+ (shell-command (format org-groff-raster-to-ps path eps-path))
(format "\n.DS L F\n.PSPIC %s \"%s\" %s %s\n.DE "
placement eps-path width height)))
((string-match ".\.pic$" path)
@@ -1263,7 +1234,7 @@ used as a communication channel."
placement path width height)))
(and caption (format "\n.FG \"%s\"" caption)))))
-(defun org-e-groff-link (link desc info)
+(defun org-groff-link (link desc info)
"Transcode a LINK object from Org to Groff.
DESC is the description part of the link, or the empty string.
@@ -1275,7 +1246,7 @@ INFO is a plist holding contextual information. See
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
(imagep (org-export-inline-image-p
- link org-e-groff-inline-image-rules))
+ link org-groff-inline-image-rules))
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
@@ -1289,7 +1260,7 @@ INFO is a plist holding contextual information. See
protocol)
(cond
;; Image file.
- (imagep (org-e-groff-link--inline-image link info))
+ (imagep (org-groff-link--inline-image link info))
;; import groff files
((and (string= type "file")
(string-match ".\.groff$" raw-path))
@@ -1315,7 +1286,7 @@ INFO is a plist holding contextual information. See
(format "\\fI file://%s \\fP" destination)))
;; Fuzzy link points nowhere.
('nil
- (format org-e-groff-link-with-unknown-path-format
+ (format org-groff-link-with-unknown-path-format
(or desc
(org-export-data
(org-element-property :raw-link link) info))))
@@ -1343,11 +1314,11 @@ INFO is a plist holding contextual information. See
;; External link without a description part.
(path (format "\\fI%s\\fP" path))
;; No path, only description. Try to do something useful.
- (t (format org-e-groff-link-with-unknown-path-format desc)))))
+ (t (format org-groff-link-with-unknown-path-format desc)))))
;;; Paragraph
-(defun org-e-groff-paragraph (paragraph contents info)
+(defun org-groff-paragraph (paragraph contents info)
"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."
@@ -1357,7 +1328,7 @@ the plist used as a communication channel."
(fixed-paragraph "")
(class (plist-get info :groff-class))
(class-options (plist-get info :groff-class-options))
- (classes (assoc class org-e-groff-classes))
+ (classes (assoc class org-groff-classes))
(classes-options (car (last classes)))
(paragraph-option (plist-get classes-options :paragraph)))
(cond
@@ -1376,7 +1347,7 @@ the plist used as a communication channel."
;;; Plain List
-(defun org-e-groff-plain-list (plain-list contents info)
+(defun org-groff-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to Groff.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -1388,13 +1359,13 @@ contextual information."
((eq type 'ordered) ".AL")
((eq type 'unordered) ".BL")
((eq type 'descriptive) ".VL 2.0i"))))
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
plain-list
(format "%s\n%s\n.LE" groff-type contents))))
;;; Plain Text
-(defun org-e-groff-plain-text (text info)
+(defun org-groff-plain-text (text info)
"Transcode a TEXT string from Org to Groff.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
@@ -1408,8 +1379,8 @@ contextual information."
(when (plist-get info :with-smart-quotes)
(setq output (org-export-activate-smart-quotes output :utf-8 info text)))
;; Handle Special Characters
- (if org-e-groff-special-char
- (dolist (special-char-list org-e-groff-special-char)
+ (if org-groff-special-char
+ (dolist (special-char-list org-groff-special-char)
(setq output
(replace-regexp-in-string (car special-char-list)
(cdr special-char-list) output))))
@@ -1422,7 +1393,7 @@ contextual information."
;;; Planning
-(defun org-e-groff-planning (planning contents info)
+(defun org-groff-planning (planning contents info)
"Transcode a PLANNING element from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1435,21 +1406,21 @@ information."
(when closed
(concat
(format "\\fR %s \\fP" org-closed-string)
- (format org-e-groff-inactive-timestamp-format
+ (format org-groff-inactive-timestamp-format
(org-translate-time
(org-element-property :raw-value closed))))))
(let ((deadline (org-element-property :deadline planning)))
(when deadline
(concat
(format "\\fB %s \\fP" org-deadline-string)
- (format org-e-groff-active-timestamp-format
+ (format org-groff-active-timestamp-format
(org-translate-time
(org-element-property :raw-value deadline))))))
(let ((scheduled (org-element-property :scheduled planning)))
(when scheduled
(concat
(format "\\fR %s \\fP" org-scheduled-string)
- (format org-e-groff-active-timestamp-format
+ (format org-groff-active-timestamp-format
(org-translate-time
(org-element-property :raw-value scheduled))))))))
"")
@@ -1457,7 +1428,7 @@ information."
;;; Property Drawer
-(defun org-e-groff-property-drawer (property-drawer contents info)
+(defun org-groff-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1467,17 +1438,17 @@ information."
;;; Quote Block
-(defun org-e-groff-quote-block (quote-block contents info)
+(defun org-groff-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to Groff.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
quote-block
(format ".DS I\n.I\n%s\n.R\n.DE" contents)))
;;; Quote Section
-(defun org-e-groff-quote-section (quote-section contents info)
+(defun org-groff-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
@@ -1486,7 +1457,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Radio Target
-(defun org-e-groff-radio-target (radio-target text info)
+(defun org-groff-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to Groff.
TEXT is the text of the target. INFO is a plist holding
contextual information."
@@ -1497,7 +1468,7 @@ contextual information."
;;; Section
-(defun org-e-groff-section (section contents info)
+(defun org-groff-section (section contents info)
"Transcode a SECTION element from Org to Groff.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -1505,18 +1476,18 @@ holding contextual information."
;;; Special Block
-(defun org-e-groff-special-block (special-block contents info)
+(defun org-groff-special-block (special-block contents info)
"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))))
- (org-e-groff--wrap-label
+ (org-groff--wrap-label
special-block
(format "%s\n" contents))))
;;; Src Block
-(defun org-e-groff-src-block (src-block contents info)
+(defun org-groff-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to Groff.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1525,25 +1496,25 @@ contextual information."
(code (org-element-property :value src-block))
(custom-env (and lang
(cadr (assq (intern lang)
- org-e-groff-custom-lang-environments))))
+ org-groff-custom-lang-environments))))
(num-start (case (org-element-property :number-lines src-block)
(continued (org-export-get-loc src-block info))
(new 0)))
(retain-labels (org-element-property :retain-labels src-block))
(caption (and (not (org-export-read-attribute
:attr_groff src-block :disable-caption))
- (org-e-groff--caption/label-string src-block info))))
+ (org-groff--caption/label-string src-block info))))
(cond
;; Case 1. No source fontification.
- ((not org-e-groff-source-highlight)
+ ((not org-groff-source-highlight)
(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))))
;; Case 2. Source fontification.
- (org-e-groff-source-highlight
+ (org-groff-source-highlight
(let* ((tmpdir (if (featurep 'xemacs)
temp-directory
temporary-file-directory))
@@ -1554,7 +1525,7 @@ contextual information."
(org-lang (org-element-property :language src-block))
(lst-lang (cadr (assq (intern org-lang)
- org-e-groff-source-highlight-langs)))
+ org-groff-source-highlight-langs)))
(cmd (concat "source-highlight"
" -s " lst-lang
@@ -1578,7 +1549,7 @@ contextual information."
;;; Statistics Cookie
-(defun org-e-groff-statistics-cookie (statistics-cookie contents info)
+(defun org-groff-statistics-cookie (statistics-cookie contents info)
"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))
@@ -1586,15 +1557,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Strike-Through
-(defun org-e-groff-strike-through (strike-through contents info)
+(defun org-groff-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to Groff.
CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information."
- (org-e-groff--text-markup contents 'strike-through))
+ (org-groff--text-markup contents 'strike-through))
;;; Subscript
-(defun org-e-groff-subscript (subscript contents info)
+(defun org-groff-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to Groff.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1602,7 +1573,7 @@ contextual information."
;;; Superscript "^_%s$
-(defun org-e-groff-superscript (superscript contents info)
+(defun org-groff-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to Groff.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1611,21 +1582,21 @@ contextual information."
;;; Table
;;
-;; `org-e-groff-table' is the entry point for table transcoding. It
+;; `org-groff-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" attribute. Otherwise, it
-;; delegates the job to `org-e-groff-table--org-table' function,
+;; delegates the job to `org-groff-table--org-table' function,
;; depending of the type of the table.
;;
-;; `org-e-groff-table--align-string' is a subroutine used to build
+;; `org-groff-table--align-string' is a subroutine used to build
;; alignment string for Org tables.
-(defun org-e-groff-table (table contents info)
+(defun org-groff-table (table contents info)
"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.
- ((or org-e-groff-tables-verbatim
+ ((or org-groff-tables-verbatim
(let ((attr (read (format "(%s)"
(mapconcat
#'identity
@@ -1639,44 +1610,42 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: Standard table.
- (t (org-e-groff-table--org-table table contents info))))
+ (t (org-groff-table--org-table table contents info))))
-(defun org-e-groff-table--align-string (divider table info)
+(defun org-groff-table--align-string (divider table info)
"Return an appropriate Groff alignment string.
TABLE is the considered table. INFO is a plist used as
a communication channel."
- (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)
+ (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)
(apply 'concat (reverse alignment))))
-(defun org-e-groff-table--org-table (table contents info)
+(defun org-groff-table--org-table (table contents info)
"Return appropriate Groff code for an Org table.
TABLE is the table type element to transcode. CONTENTS is its
@@ -1687,11 +1656,11 @@ This function assumes TABLE has `org' as its `:type' attribute."
(let* ((attr (org-export-read-attribute :attr_groff table))
(label (org-element-property :name table))
(caption (and (not (plist-get attr :disable-caption))
- (org-e-groff--caption/label-string table info)))
+ (org-groff--caption/label-string table info)))
(divider (if (plist-get attr :divider) "|" " "))
;; Determine alignment string.
- (alignment (org-e-groff-table--align-string divider table info))
+ (alignment (org-groff-table--align-string divider table info))
;; Extract others display options.
@@ -1708,7 +1677,7 @@ This function assumes TABLE has `org' as its `:type' attribute."
('center "center")
('left nil)
(t
- (if org-e-groff-tables-centered
+ (if org-groff-tables-centered
"center" "")))
(case (plist-get attr :boxtype)
@@ -1792,17 +1761,17 @@ This function assumes TABLE has `org' as its `:type' attribute."
;;; Table Cell
-(defun org-e-groff-table-cell (table-cell contents info)
+(defun org-groff-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to Groff
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
(progn
(concat (if (and contents
- org-e-groff-table-scientific-notation
+ org-groff-table-scientific-notation
(string-match orgtbl-exp-regexp contents))
;; Use appropriate format string for scientific
;; notation.
- (format org-e-groff-table-scientific-notation
+ (format org-groff-table-scientific-notation
(match-string 1 contents)
(match-string 2 contents))
contents)
@@ -1811,7 +1780,7 @@ a communication channel."
;;; Table Row
-(defun org-e-groff-table-row (table-row contents info)
+(defun org-groff-table-row (table-row contents info)
"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."
@@ -1838,7 +1807,7 @@ a communication channel."
;;; Target
-(defun org-e-groff-target (target contents info)
+(defun org-groff-target (target contents info)
"Transcode a TARGET object from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1847,38 +1816,38 @@ information."
;;; Timestamp
-(defun org-e-groff-timestamp (timestamp contents info)
+(defun org-groff-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to Groff.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (let ((value (org-e-groff-plain-text
+ (let ((value (org-groff-plain-text
(org-timestamp-translate timestamp) info)))
(case (org-element-property :type timestamp)
((active active-range)
- (format org-e-groff-active-timestamp-format value))
+ (format org-groff-active-timestamp-format value))
((inactive inactive-range)
- (format org-e-groff-inactive-timestamp-format value))
- (t (format org-e-groff-diary-timestamp-format value)))))
+ (format org-groff-inactive-timestamp-format value))
+ (t (format org-groff-diary-timestamp-format value)))))
;;; Underline
-(defun org-e-groff-underline (underline contents info)
+(defun org-groff-underline (underline contents info)
"Transcode UNDERLINE from Org to Groff.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
- (org-e-groff--text-markup contents 'underline))
+ (org-groff--text-markup contents 'underline))
;;; Verbatim
-(defun org-e-groff-verbatim (verbatim contents info)
+(defun org-groff-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to Groff.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-groff--text-markup (org-element-property :value verbatim) 'verbatim))
+ (org-groff--text-markup (org-element-property :value verbatim) 'verbatim))
;;; Verse Block
-(defun org-e-groff-verse-block (verse-block contents info)
+(defun org-groff-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to Groff.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
@@ -1887,7 +1856,7 @@ contextual information."
;;; Interactive functions
-(defun org-e-groff-export-to-groff
+(defun org-groff-export-to-groff
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Groff file.
@@ -1916,19 +1885,19 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-groff))
- (let ((org-e-groff-registered-references nil)
- (org-e-groff-special-content nil))
+ (lambda (f) (org-export-add-to-stack f 'groff))
+ (let ((org-groff-registered-references nil)
+ (org-groff-special-content nil))
`(expand-file-name
(org-export-to-file
- 'e-groff ,outfile ,subtreep ,visible-only ,body-only
+ 'groff ,outfile ,subtreep ,visible-only ,body-only
',ext-plist))))
- (let ((org-e-groff-registered-references nil)
- (org-e-groff-special-content nil))
+ (let ((org-groff-registered-references nil)
+ (org-groff-special-content nil))
(org-export-to-file
- 'e-groff outfile subtreep visible-only body-only ext-plist)))))
+ 'groff outfile subtreep visible-only body-only ext-plist)))))
-(defun org-e-groff-export-to-pdf
+(defun org-groff-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Groff then process through to PDF.
@@ -1957,21 +1926,21 @@ Return PDF file's name."
(if async
(let ((outfile (org-export-output-file-name ".groff" subtreep)))
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-groff))
+ (lambda (f) (org-export-add-to-stack f 'groff))
`(expand-file-name
- (org-e-groff-compile
+ (org-groff-compile
(org-export-to-file
- 'e-groff ,outfile ,subtreep ,visible-only ,body-only
+ 'groff ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
- (org-e-groff-compile
- (org-e-groff-export-to-groff
+ (org-groff-compile
+ (org-groff-export-to-groff
nil subtreep visible-only body-only ext-plist))))
-(defun org-e-groff-compile (file)
+(defun org-groff-compile (file)
"Compile a Groff file.
FILE is the name of the file being compiled. Processing is done
-through the command specified in `org-e-groff-pdf-process'.
+through the command specified in `org-groff-pdf-process'.
Return PDF file name or an error if it couldn't be produced."
(let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
@@ -1985,12 +1954,12 @@ Return PDF file name or an error if it couldn't be produced."
(save-window-excursion
(cond
;; A function is provided: Apply it.
- ((functionp org-e-groff-pdf-process)
- (funcall org-e-groff-pdf-process (shell-quote-argument file)))
+ ((functionp org-groff-pdf-process)
+ (funcall org-groff-pdf-process (shell-quote-argument file)))
;; 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.
- ((consp org-e-groff-pdf-process)
+ ((consp org-groff-pdf-process)
(let ((outbuf (get-buffer-create "*Org PDF Groff Output*")))
(mapc
(lambda (command)
@@ -2003,9 +1972,9 @@ Return PDF file name or an error if it couldn't be produced."
"%o" (shell-quote-argument out-dir) command t t)
t t) t t)
outbuf))
- org-e-groff-pdf-process)
+ org-groff-pdf-process)
;; Collect standard errors from output buffer.
- (setq errors (org-e-groff-collect-errors outbuf))))
+ (setq errors (org-groff-collect-errors outbuf))))
(t (error "No valid command to process to PDF")))
(let ((pdffile (concat out-dir base-name ".pdf")))
;; Check for process failure. Provide collected errors if
@@ -2015,8 +1984,8 @@ Return PDF file name or an error if it couldn't be produced."
(when errors (concat ": " errors))))
;; Else remove log files, when specified, and signal end of
;; process to user, along with any error encountered.
- (when org-e-groff-remove-logfiles
- (dolist (ext org-e-groff-logfiles-extensions)
+ (when org-groff-remove-logfiles
+ (dolist (ext org-groff-logfiles-extensions)
(let ((file (concat out-dir base-name "." ext)))
(when (file-exists-p file) (delete-file file)))))
(message (concat "Process completed"
@@ -2025,7 +1994,7 @@ Return PDF file name or an error if it couldn't be produced."
;; Return output file name.
pdffile))))
-(defun org-e-groff-collect-errors (buffer)
+(defun org-groff-collect-errors (buffer)
"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
@@ -2037,5 +2006,5 @@ none."
nil)))
-(provide 'org-e-groff)
-;;; org-e-groff.el ends here
+(provide 'ox-groff)
+;;; ox-groff.el ends here
diff --git a/contrib/lisp/org-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 58714d2..27c5e52 100644
--- a/contrib/lisp/org-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -1,4 +1,4 @@
-;;; org-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine
+;;; ox-koma-letter.el --- KOMA Scrlttr2 Back-End for Org Export Engine
;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
@@ -29,7 +29,7 @@
;; `org-koma-letter-export-to-latex' ("tex" file) and
;; `org-koma-letter-export-to-pdf' ("pdf" file).
;;
-;; On top of buffer keywords supported by `e-latex' back-end (see
+;; On top of buffer keywords supported by `latex' back-end (see
;; `org-e-latex-options-alist'), this back-end introduces the
;; following keywords: "CLOSING" (see `org-koma-letter-closing'),
;; "FROM_ADDRESS" (see `org-koma-letter-from-address'), "LCO" (see
@@ -42,7 +42,7 @@
;; `org-e-latex-classes' in order to use the KOMA Scrlttr2 class. For
;; example, you can use the following code:
;;
-;; (add-to-list 'org-e-latex-classes
+;; (add-to-list 'org-latex-classes
;; '("my-letter"
;; "\\documentclass\[%
;; DIV=14,
@@ -65,7 +65,7 @@
;;; Code:
-(require 'org-e-latex)
+(require 'ox-latex)
;;; User-Configurable Variables
@@ -109,7 +109,7 @@
;;; Define Back-End
-(org-export-define-derived-backend koma-letter e-latex
+(org-export-define-derived-backend koma-letter latex
:options-alist
((:closing "CLOSING" nil org-koma-letter-closing)
(:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
@@ -164,7 +164,7 @@ channel."
;; Handle specifically BEAMER and TOC (headlines only) keywords.
;; Otherwise, fallback to `e-latex' back-end.
(if (equal key "KOMA-LETTER") value
- (org-export-with-backend 'e-latex keyword contents info))))
+ (org-export-with-backend 'latex keyword contents info))))
;;;; Template
@@ -213,7 +213,8 @@ holding export options."
"\\begin{document}\n\n"
(format "\\setkomavar{subject}{%s}\n\n"
(org-export-data (plist-get info :title) info))
- (format "\\begin{letter}{%%\n%s}\n\n" (or (plist-get info :to-address) "no address given"))
+ (format "\\begin{letter}{%%\n%s}\n\n"
+ (or (plist-get info :to-address) "no address given"))
;; Opening.
(format "\\opening{%s}\n\n" (plist-get info :opening))
;; Letter body.
@@ -365,5 +366,5 @@ Return PDF file's name."
nil subtreep visible-only body-only ext-plist))))
-(provide 'org-koma-letter)
-;;; org-koma-letter.el ends here
+(provide 'ox-koma-letter)
+;;; ox-koma-letter.el ends here
diff --git a/contrib/lisp/org-e-ascii.el b/lisp/ox-ascii.el
index c137fd7..07fc093 100644
--- a/contrib/lisp/org-e-ascii.el
+++ b/lisp/ox-ascii.el
@@ -1,4 +1,4 @@
-;;; org-e-ascii.el --- ASCII Back-End For Org Export Engine
+;;; ox-ascii.el --- ASCII Back-End for Org Export Engine
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
@@ -23,11 +23,13 @@
;; This library implements an ASCII back-end for Org generic exporter.
;;
;; It provides two commands for export, depending on the desired
-;; output: `org-e-ascii-export-as-ascii' (temporary buffer) and
-;; `org-e-ascii-export-to-ascii' ("txt" file).
+;; output: `org-ascii-export-as-ascii' (temporary buffer) and
+;; `org-ascii-export-to-ascii' ("txt" file). Also, three publishing
+;; functions are available: `org-ascii-publish-to-ascii',
+;; `org-ascii-publish-to-latin1' and `org-ascii-publish-to-utf8'.
;;
-;; Output encoding is specified through `org-e-ascii-charset'
-;; variable, among `ascii', `latin1' and `utf-8' symbols.
+;; Output encoding is specified through `org-ascii-charset' variable,
+;; among `ascii', `latin1' and `utf-8' symbols.
;;
;; By default, horizontal rules span over the full text with, but with
;; a given width attribute (set though #+ATTR_ASCII: :width <num>)
@@ -36,8 +38,8 @@
;;; Code:
(eval-when-compile (require 'cl))
-(require 'org-export)
-(require 'org-e-publish)
+(require 'ox)
+(require 'ox-publish)
(declare-function aa2u "ext:ascii-art-to-unicode" ())
@@ -46,126 +48,126 @@
;; The following setting won't allow to modify preferred charset
;; through a buffer keyword or an option item, but, since the property
;; will appear in communication channel nonetheless, it allows to
-;; override `org-e-ascii-charset' variable on the fly by the ext-plist
+;; override `org-ascii-charset' variable on the fly by the ext-plist
;; mechanism.
;;
;; We also install a filter for headlines and sections, in order to
;; control blank lines separating them in output string.
-(org-export-define-backend e-ascii
- ((bold . org-e-ascii-bold)
- (center-block . org-e-ascii-center-block)
- (clock . org-e-ascii-clock)
- (code . org-e-ascii-code)
- (drawer . org-e-ascii-drawer)
- (dynamic-block . org-e-ascii-dynamic-block)
- (entity . org-e-ascii-entity)
- (example-block . org-e-ascii-example-block)
- (export-block . org-e-ascii-export-block)
- (export-snippet . org-e-ascii-export-snippet)
- (fixed-width . org-e-ascii-fixed-width)
- (footnote-definition . org-e-ascii-footnote-definition)
- (footnote-reference . org-e-ascii-footnote-reference)
- (headline . org-e-ascii-headline)
- (horizontal-rule . org-e-ascii-horizontal-rule)
- (inline-src-block . org-e-ascii-inline-src-block)
- (inlinetask . org-e-ascii-inlinetask)
- (italic . org-e-ascii-italic)
- (item . org-e-ascii-item)
- (keyword . org-e-ascii-keyword)
- (latex-environment . org-e-ascii-latex-environment)
- (latex-fragment . org-e-ascii-latex-fragment)
- (line-break . org-e-ascii-line-break)
- (link . org-e-ascii-link)
- (paragraph . org-e-ascii-paragraph)
- (plain-list . org-e-ascii-plain-list)
- (plain-text . org-e-ascii-plain-text)
- (planning . org-e-ascii-planning)
- (quote-block . org-e-ascii-quote-block)
- (quote-section . org-e-ascii-quote-section)
- (radio-target . org-e-ascii-radio-target)
- (section . org-e-ascii-section)
- (special-block . org-e-ascii-special-block)
- (src-block . org-e-ascii-src-block)
- (statistics-cookie . org-e-ascii-statistics-cookie)
- (strike-through . org-e-ascii-strike-through)
- (subscript . org-e-ascii-subscript)
- (superscript . org-e-ascii-superscript)
- (table . org-e-ascii-table)
- (table-cell . org-e-ascii-table-cell)
- (table-row . org-e-ascii-table-row)
- (target . org-e-ascii-target)
- (template . org-e-ascii-template)
- (timestamp . org-e-ascii-timestamp)
- (underline . org-e-ascii-underline)
- (verbatim . org-e-ascii-verbatim)
- (verse-block . org-e-ascii-verse-block))
+(org-export-define-backend ascii
+ ((bold . org-ascii-bold)
+ (center-block . org-ascii-center-block)
+ (clock . org-ascii-clock)
+ (code . org-ascii-code)
+ (drawer . org-ascii-drawer)
+ (dynamic-block . org-ascii-dynamic-block)
+ (entity . org-ascii-entity)
+ (example-block . org-ascii-example-block)
+ (export-block . org-ascii-export-block)
+ (export-snippet . org-ascii-export-snippet)
+ (fixed-width . org-ascii-fixed-width)
+ (footnote-definition . org-ascii-footnote-definition)
+ (footnote-reference . org-ascii-footnote-reference)
+ (headline . org-ascii-headline)
+ (horizontal-rule . org-ascii-horizontal-rule)
+ (inline-src-block . org-ascii-inline-src-block)
+ (inlinetask . org-ascii-inlinetask)
+ (italic . org-ascii-italic)
+ (item . org-ascii-item)
+ (keyword . org-ascii-keyword)
+ (latex-environment . org-ascii-latex-environment)
+ (latex-fragment . org-ascii-latex-fragment)
+ (line-break . org-ascii-line-break)
+ (link . org-ascii-link)
+ (paragraph . org-ascii-paragraph)
+ (plain-list . org-ascii-plain-list)
+ (plain-text . org-ascii-plain-text)
+ (planning . org-ascii-planning)
+ (quote-block . org-ascii-quote-block)
+ (quote-section . org-ascii-quote-section)
+ (radio-target . org-ascii-radio-target)
+ (section . org-ascii-section)
+ (special-block . org-ascii-special-block)
+ (src-block . org-ascii-src-block)
+ (statistics-cookie . org-ascii-statistics-cookie)
+ (strike-through . org-ascii-strike-through)
+ (subscript . org-ascii-subscript)
+ (superscript . org-ascii-superscript)
+ (table . org-ascii-table)
+ (table-cell . org-ascii-table-cell)
+ (table-row . org-ascii-table-row)
+ (target . org-ascii-target)
+ (template . org-ascii-template)
+ (timestamp . org-ascii-timestamp)
+ (underline . org-ascii-underline)
+ (verbatim . org-ascii-verbatim)
+ (verse-block . org-ascii-verse-block))
:export-block "ASCII"
:menu-entry
(?t "Export to Plain Text"
((?A "As ASCII buffer"
(lambda (a s v b)
- (org-e-ascii-export-as-ascii a s v b '(:ascii-charset ascii))))
+ (org-ascii-export-as-ascii a s v b '(:ascii-charset ascii))))
(?a "As ASCII file"
(lambda (a s v b)
- (org-e-ascii-export-to-ascii a s v b '(:ascii-charset ascii))))
+ (org-ascii-export-to-ascii a s v b '(:ascii-charset ascii))))
(?L "As Latin1 buffer"
(lambda (a s v b)
- (org-e-ascii-export-as-ascii a s v b '(:ascii-charset latin1))))
+ (org-ascii-export-as-ascii a s v b '(:ascii-charset latin1))))
(?l "As Latin1 file"
(lambda (a s v b)
- (org-e-ascii-export-to-ascii a s v b '(:ascii-charset latin1))))
+ (org-ascii-export-to-ascii a s v b '(:ascii-charset latin1))))
(?U "As UTF-8 buffer"
(lambda (a s v b)
- (org-e-ascii-export-as-ascii a s v b '(:ascii-charset utf-8))))
+ (org-ascii-export-as-ascii a s v b '(:ascii-charset utf-8))))
(?u "As UTF-8 file"
(lambda (a s v b)
- (org-e-ascii-export-to-ascii a s v b '(:ascii-charset utf-8))))))
- :filters-alist ((:filter-headline . org-e-ascii-filter-headline-blank-lines)
- (:filter-parse-tree . org-e-ascii-filter-paragraph-spacing)
- (:filter-section . org-e-ascii-filter-headline-blank-lines))
- :options-alist ((:ascii-charset nil nil org-e-ascii-charset)))
+ (org-ascii-export-to-ascii a s v b '(:ascii-charset utf-8))))))
+ :filters-alist ((:filter-headline . org-ascii-filter-headline-blank-lines)
+ (:filter-parse-tree . org-ascii-filter-paragraph-spacing)
+ (:filter-section . org-ascii-filter-headline-blank-lines))
+ :options-alist ((:ascii-charset nil nil org-ascii-charset)))
;;; User Configurable Variables
-(defgroup org-export-e-ascii nil
+(defgroup org-export-ascii nil
"Options for exporting Org mode files to ASCII."
:tag "Org Export ASCII"
:group 'org-export)
-(defcustom org-e-ascii-text-width 72
+(defcustom org-ascii-text-width 72
"Maximum width of exported text.
This number includes margin size, as set in
-`org-e-ascii-global-margin'."
- :group 'org-export-e-ascii
+`org-ascii-global-margin'."
+ :group 'org-export-ascii
:type 'integer)
-(defcustom org-e-ascii-global-margin 0
+(defcustom org-ascii-global-margin 0
"Width of the left margin, in number of characters."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'integer)
-(defcustom org-e-ascii-inner-margin 2
+(defcustom org-ascii-inner-margin 2
"Width of the inner margin, in number of characters.
Inner margin is applied between each headline."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'integer)
-(defcustom org-e-ascii-quote-margin 6
+(defcustom org-ascii-quote-margin 6
"Width of margin used for quoting text, in characters.
This margin is applied on both sides of the text."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'integer)
-(defcustom org-e-ascii-inlinetask-width 30
+(defcustom org-ascii-inlinetask-width 30
"Width of inline tasks, in number of characters.
This number ignores any margin."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'integer)
-(defcustom org-e-ascii-headline-spacing '(1 . 2)
+(defcustom org-ascii-headline-spacing '(1 . 2)
"Number of blank lines inserted around headlines.
This variable can be set to a cons cell. In that case, its car
@@ -175,46 +177,46 @@ contents.
A nil value replicates the number of blank lines found in the
original Org buffer at the same place."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(choice
(const :tag "Replicate original spacing" nil)
(cons :tag "Set an uniform spacing"
(integer :tag "Number of blank lines before contents")
(integer :tag "Number of blank lines after contents"))))
-(defcustom org-e-ascii-indented-line-width 'auto
+(defcustom org-ascii-indented-line-width 'auto
"Additional indentation width for the first line in a paragraph.
If the value is an integer, indent the first line of each
paragraph by this number. If it is the symbol `auto' preserve
indentation from original document."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(choice
(integer :tag "Number of white spaces characters")
(const :tag "Preserve original width" auto)))
-(defcustom org-e-ascii-paragraph-spacing 'auto
+(defcustom org-ascii-paragraph-spacing 'auto
"Number of white lines between paragraphs.
If the value is an integer, add this number of blank lines
between contiguous paragraphs. If is it the symbol `auto', keep
the same number of blank lines as in the original document."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(choice
(integer :tag "Number of blank lines")
(const :tag "Preserve original spacing" auto)))
-(defcustom org-e-ascii-charset 'ascii
+(defcustom org-ascii-charset 'ascii
"The charset allowed to represent various elements and objects.
Possible values are:
`ascii' Only use plain ASCII characters
`latin1' Include Latin-1 characters
`utf-8' Use all UTF-8 characters"
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(choice
(const :tag "ASCII" ascii)
(const :tag "Latin-1" latin1)
(const :tag "UTF-8" utf-8)))
-(defcustom org-e-ascii-underline '((ascii ?= ?~ ?-)
+(defcustom org-ascii-underline '((ascii ?= ?~ ?-)
(latin1 ?= ?~ ?-)
(utf-8 ?═ ?─ ?╌ ?┄ ?┈))
"Characters for underlining headings in ASCII export.
@@ -226,7 +228,7 @@ For each supported charset, this variable associates a sequence
of underline characters. In a sequence, the characters will be
used in order for headlines level 1, 2, ... If no character is
available for a given level, the headline won't be underlined."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(list
(cons :tag "Underline characters sequence"
(const :tag "ASCII charset" ascii)
@@ -238,9 +240,9 @@ available for a given level, the headline won't be underlined."
(const :tag "UTF-8 charset" utf-8)
(repeat character))))
-(defcustom org-e-ascii-bullets '((ascii ?* ?+ ?-)
- (latin1 ?§ ?¶)
- (utf-8 ?◊))
+(defcustom org-ascii-bullets '((ascii ?* ?+ ?-)
+ (latin1 ?§ ?¶)
+ (utf-8 ?◊))
"Bullet characters for headlines converted to lists in ASCII export.
Alist whose key is a symbol among `ascii', `latin1' and `utf-8'
@@ -252,7 +254,7 @@ here, the list will be repeated.
Note that this variable doesn't affect plain lists
representation."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type '(list
(cons :tag "Bullet characters for low level headlines"
(const :tag "ASCII charset" ascii)
@@ -264,28 +266,28 @@ representation."
(const :tag "UTF-8 charset" utf-8)
(repeat character))))
-(defcustom org-e-ascii-links-to-notes t
+(defcustom org-ascii-links-to-notes t
"Non-nil means convert links to notes before the next headline.
When nil, the link will be exported in place. If the line
becomes long in this way, it will be wrapped."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'boolean)
-(defcustom org-e-ascii-table-keep-all-vertical-lines nil
+(defcustom org-ascii-table-keep-all-vertical-lines nil
"Non-nil means keep all vertical lines in ASCII tables.
When nil, vertical lines will be removed except for those needed
for column grouping."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'boolean)
-(defcustom org-e-ascii-table-widen-columns t
+(defcustom org-ascii-table-widen-columns t
"Non-nil means widen narrowed columns for export.
When nil, narrowed columns will look in ASCII export just like in
Org mode, i.e. with \"=>\" as ellipsis."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'boolean)
-(defcustom org-e-ascii-table-use-ascii-art nil
+(defcustom org-ascii-table-use-ascii-art nil
"Non-nil means table.el tables are turned into ascii-art.
It only makes sense when export charset is `utf-8'. It is nil by
@@ -294,18 +296,18 @@ can download it here:
http://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el.")
-(defcustom org-e-ascii-caption-above nil
+(defcustom org-ascii-caption-above nil
"When non-nil, place caption string before the element.
Otherwise, place it right after it."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'boolean)
-(defcustom org-e-ascii-verbatim-format "`%s'"
+(defcustom org-ascii-verbatim-format "`%s'"
"Format string used for verbatim text and inline code."
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'string)
-(defcustom org-e-ascii-format-drawer-function nil
+(defcustom org-ascii-format-drawer-function nil
"Function called to format a drawer in ASCII.
The function must accept three parameters:
@@ -319,13 +321,13 @@ nil to ignore the drawer.
For example, the variable could be set to the following function
in order to mimic default behaviour:
-\(defun org-e-ascii-format-drawer-default (name contents width)
+\(defun org-ascii-format-drawer-default (name contents width)
\"Format a drawer element for ASCII export.\"
contents)"
- :group 'org-export-e-ascii
+ :group 'org-export-ascii
:type 'function)
-(defcustom org-e-ascii-format-inlinetask-function nil
+(defcustom org-ascii-format-inlinetask-function nil
"Function called to format an inlinetask in ASCII.
The function must accept six parameters:
@@ -342,20 +344,20 @@ nil to ignore the inline task.
For example, the variable could be set to the following function
in order to mimic default behaviour:
-\(defun org-e-ascii-format-inlinetask-default
+\(defun org-ascii-format-inlinetask-default
\(todo type priority name tags contents\)
\"Format an inline task element for ASCII export.\"
\(let* \(\(utf8p \(eq \(plist-get info :ascii-charset\) 'utf-8\)\)
- \(width org-e-ascii-inlinetask-width\)
- \(org-e-ascii--indent-string
+ \(width org-ascii-inlinetask-width\)
+ \(org-ascii--indent-string
\(concat
;; Top line, with an additional blank line if not in UTF-8.
\(make-string width \(if utf8p ?━ ?_\)\) \"\\n\"
\(unless utf8p \(concat \(make-string width ? \) \"\\n\"\)\)
;; Add title. Fill it if wider than inlinetask.
- \(let \(\(title \(org-e-ascii--build-title inlinetask info width\)\)\)
+ \(let \(\(title \(org-ascii--build-title inlinetask info width\)\)\)
\(if \(<= \(length title\) width\) title
- \(org-e-ascii--fill-string title width info\)\)\)
+ \(org-ascii--fill-string title width info\)\)\)
\"\\n\"
;; If CONTENTS is not empty, insert it along with
;; a separator.
@@ -367,8 +369,8 @@ in order to mimic default behaviour:
\(- \(plist-get info :ascii-width\)
\(plist-get info :ascii-margin\)
\(plist-get info :ascii-inner-margin\)
- \(org-e-ascii--current-text-width inlinetask info\)\)"
- :group 'org-export-e-ascii
+ \(org-ascii--current-text-width inlinetask info\)\)"
+ :group 'org-export-ascii
:type 'function)
@@ -378,32 +380,32 @@ in order to mimic default behaviour:
;; Internal functions fall into three categories.
;; The first one is about text formatting. The core function is
-;; `org-e-ascii--current-text-width', which determines the current
+;; `org-ascii--current-text-width', which determines the current
;; text width allowed to a given element. In other words, it helps
;; keeping each line width within maximum text width defined in
-;; `org-e-ascii-text-width'. Once this information is known,
-;; `org-e-ascii--fill-string', `org-e-ascii--justify-string',
-;; `org-e-ascii--box-string' and `org-e-ascii--indent-string' can
+;; `org-ascii-text-width'. Once this information is known,
+;; `org-ascii--fill-string', `org-ascii--justify-string',
+;; `org-ascii--box-string' and `org-ascii--indent-string' can
;; operate on a given output string.
;; The second category contains functions handling elements listings,
-;; triggered by "#+TOC:" keyword. As such, `org-e-ascii--build-toc'
-;; returns a complete table of contents, `org-e-ascii--list-listings'
+;; triggered by "#+TOC:" keyword. As such, `org-ascii--build-toc'
+;; returns a complete table of contents, `org-ascii--list-listings'
;; returns a list of referenceable src-block elements, and
-;; `org-e-ascii--list-tables' does the same for table elements.
+;; `org-ascii--list-tables' does the same for table elements.
;; The third category includes general helper functions.
-;; `org-e-ascii--build-title' creates the title for a given headline
-;; or inlinetask element. `org-e-ascii--build-caption' returns the
+;; `org-ascii--build-title' creates the title for a given headline
+;; or inlinetask element. `org-ascii--build-caption' returns the
;; caption string associated to a table or a src-block.
-;; `org-e-ascii--describe-links' creates notes about links for
+;; `org-ascii--describe-links' creates notes about links for
;; insertion at the end of a section. It uses
-;; `org-e-ascii--unique-links' to get the list of links to describe.
-;; Eventually, `org-e-ascii--translate' translates a string according
+;; `org-ascii--unique-links' to get the list of links to describe.
+;; Eventually, `org-ascii--translate' translates a string according
;; to language and charset specification.
-(defun org-e-ascii--fill-string (s text-width info &optional justify)
+(defun org-ascii--fill-string (s text-width info &optional justify)
"Fill a string with specified text-width and return it.
S is the string being filled. TEXT-WIDTH is an integer
@@ -413,20 +415,22 @@ a communication channel.
Optional argument JUSTIFY can specify any type of justification
among `left', `center', `right' or `full'. A nil value is
equivalent to `left'. For a justification that doesn't also fill
-string, see `org-e-ascii--justify-string'.
+string, see `org-ascii--justify-string'.
Return nil if S isn't a string."
;; Don't fill paragraph when break should be preserved.
(cond ((not (stringp s)) nil)
((plist-get info :preserve-breaks) s)
- (t (with-temp-buffer
- (let ((fill-column text-width)
- (use-hard-newlines t))
- (insert s)
- (fill-region (point-min) (point-max) justify))
- (buffer-string)))))
-
-(defun org-e-ascii--justify-string (s text-width how)
+ (t (let ((double-space-p sentence-end-double-space))
+ (with-temp-buffer
+ (let ((fill-column text-width)
+ (use-hard-newlines t)
+ (sentence-end-double-space double-space-p))
+ (insert s)
+ (fill-region (point-min) (point-max) justify))
+ (buffer-string))))))
+
+(defun org-ascii--justify-string (s text-width how)
"Justify string S.
TEXT-WIDTH is an integer specifying maximum length of a line.
HOW determines the type of justification: it can be `left',
@@ -443,14 +447,14 @@ HOW determines the type of justification: it can be `left',
(forward-line)))
(buffer-string)))
-(defun org-e-ascii--indent-string (s width)
+(defun org-ascii--indent-string (s width)
"Indent string S by WIDTH white spaces.
Empty lines are not indented."
(when (stringp s)
(replace-regexp-in-string
"\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1)))
-(defun org-e-ascii--box-string (s info)
+(defun org-ascii--box-string (s info)
"Return string S with a partial box to its left.
INFO is a plist used as a communicaton channel."
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
@@ -460,16 +464,16 @@ INFO is a plist used as a communicaton channel."
;; Remove last newline character.
(replace-regexp-in-string "\n[ \t]*\\'" "" s)))))
-(defun org-e-ascii--current-text-width (element info)
+(defun org-ascii--current-text-width (element info)
"Return maximum text width for ELEMENT's contents.
INFO is a plist used as a communication channel."
(case (org-element-type element)
;; Elements with an absolute width: `headline' and `inlinetask'.
- (inlinetask org-e-ascii-inlinetask-width)
+ (inlinetask org-ascii-inlinetask-width)
('headline
- (- org-e-ascii-text-width
+ (- org-ascii-text-width
(let ((low-level-rank (org-export-low-level-p element info)))
- (if low-level-rank (* low-level-rank 2) org-e-ascii-global-margin))))
+ (if low-level-rank (* low-level-rank 2) org-ascii-global-margin))))
;; Elements with a relative width: store maximum text width in
;; TOTAL-WIDTH.
(otherwise
@@ -479,10 +483,10 @@ INFO is a plist used as a communication channel."
(total-width
(if (loop for parent in genealogy
thereis (eq (org-element-type parent) 'inlinetask))
- org-e-ascii-inlinetask-width
+ org-ascii-inlinetask-width
;; No inlinetask: Remove global margin from text width.
- (- org-e-ascii-text-width
- org-e-ascii-global-margin
+ (- org-ascii-text-width
+ org-ascii-global-margin
(let ((parent (org-export-get-parent-headline element)))
;; Inner margin doesn't apply to text before first
;; headline.
@@ -493,7 +497,7 @@ INFO is a plist used as a communication channel."
;; low level headlines, since they've got their
;; own indentation mechanism.
(if low-level-rank (* low-level-rank 2)
- org-e-ascii-inner-margin))))))))
+ org-ascii-inner-margin))))))))
(- total-width
;; Each `quote-block', `quote-section' and `verse-block' above
;; narrows text width by twice the standard margin size.
@@ -501,7 +505,7 @@ INFO is a plist used as a communication channel."
when (memq (org-element-type parent)
'(quote-block quote-section verse-block))
count parent)
- 2 org-e-ascii-quote-margin)
+ 2 org-ascii-quote-margin)
;; Text width within a plain-list is restricted by
;; indentation of current item. If that's the case,
;; compute it with the help of `:structure' property from
@@ -523,12 +527,12 @@ INFO is a plist used as a communication channel."
(+ (- (org-list-get-ind beg-item struct)
(org-list-get-ind
(org-list-get-top-point struct) struct))
- (length (org-e-ascii--checkbox parent-item info))
+ (length (org-ascii--checkbox parent-item info))
(length
(or (org-list-get-tag beg-item struct)
(org-list-get-bullet beg-item struct)))))))))))))
-(defun org-e-ascii--build-title
+(defun org-ascii--build-title
(element info text-width &optional underline notags)
"Format ELEMENT title and return it.
@@ -537,7 +541,7 @@ a plist used as a communication channel. TEXT-WIDTH is an
integer representing the maximum length of a line.
When optional argument UNDERLINE is non-nil, underline title,
-without the tags, according to `org-e-ascii-underline'
+without the tags, according to `org-ascii-underline'
specifications.
if optional argument NOTAGS is nil, no tags will be added to the
@@ -583,18 +587,18 @@ title."
(let ((under-char
(nth (1- (org-export-get-relative-level element info))
(cdr (assq (plist-get info :ascii-charset)
- org-e-ascii-underline)))))
+ org-ascii-underline)))))
(and under-char
(concat "\n"
(make-string (length first-part) under-char))))))))
-(defun org-e-ascii--has-caption-p (element info)
+(defun org-ascii--has-caption-p (element info)
"Non-nil when ELEMENT has a caption affiliated keyword.
INFO is a plist used as a communication channel. This function
is meant to be used as a predicate for `org-export-get-ordinal'."
(org-element-property :caption element))
-(defun org-e-ascii--build-caption (element info)
+(defun org-ascii--build-caption (element info)
"Return caption string for ELEMENT, if applicable.
INFO is a plist used as a communication channel.
@@ -608,17 +612,17 @@ caption keyword."
;; src-block with a caption.
(let ((reference
(org-export-get-ordinal
- element info nil 'org-e-ascii--has-caption-p))
- (title-fmt (org-e-ascii--translate
+ element info nil 'org-ascii--has-caption-p))
+ (title-fmt (org-ascii--translate
(case (org-element-type element)
(table "Table %d: %s")
(src-block "Listing %d: %s"))
info)))
- (org-e-ascii--fill-string
+ (org-ascii--fill-string
(format title-fmt reference (org-export-data caption info))
- (org-e-ascii--current-text-width element info) info)))))
+ (org-ascii--current-text-width element info) info)))))
-(defun org-e-ascii--build-toc (info &optional n keyword)
+(defun org-ascii--build-toc (info &optional n keyword)
"Return a table of contents.
INFO is a plist used as a communication channel.
@@ -628,40 +632,40 @@ depth of the table.
Optional argument KEYWORD specifies the TOC keyword, if any, from
which the table of contents generation has been initiated."
- (let ((title (org-e-ascii--translate "Table of Contents" info)))
+ (let ((title (org-ascii--translate "Table of Contents" info)))
(concat
title "\n"
(make-string (length title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
- (if keyword (org-e-ascii--current-text-width keyword info)
- (- org-e-ascii-text-width org-e-ascii-global-margin))))
+ (if keyword (org-ascii--current-text-width keyword info)
+ (- org-ascii-text-width org-ascii-global-margin))))
(mapconcat
(lambda (headline)
(let* ((level (org-export-get-relative-level headline info))
(indent (* (1- level) 3)))
(concat
(unless (zerop indent) (concat (make-string (1- indent) ?.) " "))
- (org-e-ascii--build-title
+ (org-ascii--build-title
headline info (- text-width indent) nil
(eq (plist-get info :with-tags) 'not-in-toc)))))
(org-export-collect-headlines info n) "\n")))))
-(defun org-e-ascii--list-listings (keyword info)
+(defun org-ascii--list-listings (keyword info)
"Return a list of listings.
KEYWORD is the keyword that initiated the list of listings
generation. INFO is a plist used as a communication channel."
- (let ((title (org-e-ascii--translate "List of Listings" info)))
+ (let ((title (org-ascii--translate "List of Listings" info)))
(concat
title "\n"
(make-string (length title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
- (if keyword (org-e-ascii--current-text-width keyword info)
- (- org-e-ascii-text-width org-e-ascii-global-margin)))
+ (if keyword (org-ascii--current-text-width keyword info)
+ (- org-ascii-text-width org-ascii-global-margin)))
;; Use a counter instead of retreiving ordinal of each
;; src-block.
(count 0))
@@ -671,13 +675,13 @@ generation. INFO is a plist used as a communication channel."
;; used to properly align caption right to it in case of
;; filling (like contents of a description list item).
(let ((initial-text
- (format (org-e-ascii--translate "Listing %d:" info)
+ (format (org-ascii--translate "Listing %d:" info)
(incf count))))
(concat
initial-text " "
(org-trim
- (org-e-ascii--indent-string
- (org-e-ascii--fill-string
+ (org-ascii--indent-string
+ (org-ascii--fill-string
;; Use short name in priority, if available.
(let ((caption (or (org-export-get-caption src-block t)
(org-export-get-caption src-block))))
@@ -686,20 +690,20 @@ generation. INFO is a plist used as a communication channel."
(length initial-text))))))
(org-export-collect-listings info) "\n")))))
-(defun org-e-ascii--list-tables (keyword info)
+(defun org-ascii--list-tables (keyword info)
"Return a list of listings.
KEYWORD is the keyword that initiated the list of listings
generation. INFO is a plist used as a communication channel."
- (let ((title (org-e-ascii--translate "List of Tables" info)))
+ (let ((title (org-ascii--translate "List of Tables" info)))
(concat
title "\n"
(make-string (length title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
- (if keyword (org-e-ascii--current-text-width keyword info)
- (- org-e-ascii-text-width org-e-ascii-global-margin)))
+ (if keyword (org-ascii--current-text-width keyword info)
+ (- org-ascii-text-width org-ascii-global-margin)))
;; Use a counter instead of retreiving ordinal of each
;; src-block.
(count 0))
@@ -709,13 +713,13 @@ generation. INFO is a plist used as a communication channel."
;; used to properly align caption right to it in case of
;; filling (like contents of a description list item).
(let ((initial-text
- (format (org-e-ascii--translate "Table %d:" info)
+ (format (org-ascii--translate "Table %d:" info)
(incf count))))
(concat
initial-text " "
(org-trim
- (org-e-ascii--indent-string
- (org-e-ascii--fill-string
+ (org-ascii--indent-string
+ (org-ascii--fill-string
;; Use short name in priority, if available.
(let ((caption (or (org-export-get-caption table t)
(org-export-get-caption table))))
@@ -724,7 +728,7 @@ generation. INFO is a plist used as a communication channel."
(length initial-text))))))
(org-export-collect-tables info) "\n")))))
-(defun org-e-ascii--unique-links (element info)
+(defun org-ascii--unique-links (element info)
"Return a list of unique link references in ELEMENT.
ELEMENT is either an headline element or a section element. INFO
@@ -751,14 +755,14 @@ is a plist used as a communication channel."
(if (eq (org-element-type element) 'headline) element
(or (org-export-get-parent-headline element) element))))
;; Get all links in HEADLINE.
- (org-element-map
- headline 'link (lambda (l) (funcall unique-link-p l)) info nil nil t)))
+ (org-element-map headline 'link
+ (lambda (l) (funcall unique-link-p l)) info nil nil t)))
-(defun org-e-ascii--describe-links (links width info)
+(defun org-ascii--describe-links (links width info)
"Return a string describing a list of links.
LINKS is a list of link type objects, as returned by
-`org-e-ascii--unique-links'. WIDTH is the text width allowed for
+`org-ascii--unique-links'. WIDTH is the text width allowed for
the output string. INFO is a plist used as a communication
channel."
(mapconcat
@@ -774,13 +778,13 @@ channel."
((member type '("custom-id" "id"))
(let ((dest (org-export-resolve-id-link link info)))
(concat
- (org-e-ascii--fill-string
+ (org-ascii--fill-string
(format
"[%s] %s"
anchor
- (if (not dest) (org-e-ascii--translate "Unknown reference" info)
+ (if (not dest) (org-ascii--translate "Unknown reference" info)
(format
- (org-e-ascii--translate "See section %s" info)
+ (org-ascii--translate "See section %s" info)
(mapconcat 'number-to-string
(org-export-get-headline-number dest info) "."))))
width info) "\n\n")))
@@ -790,13 +794,13 @@ channel."
((not (org-element-contents link)) nil)
(t
(concat
- (org-e-ascii--fill-string
+ (org-ascii--fill-string
(format "[%s] %s" anchor (org-element-property :raw-link link))
width info)
"\n\n")))))
links ""))
-(defun org-e-ascii--checkbox (item info)
+(defun org-ascii--checkbox (item info)
"Return checkbox string for ITEM or nil.
INFO is a plist used as a communication channel."
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
@@ -809,13 +813,13 @@ INFO is a plist used as a communication channel."
;;; Template
-(defun org-e-ascii-template--document-title (info)
+(defun org-ascii-template--document-title (info)
"Return document title, as a string.
INFO is a plist used as a communication channel."
- (let* ((text-width org-e-ascii-text-width)
+ (let* ((text-width org-ascii-text-width)
;; Links in the title will not be resolved later, so we make
;; sure their path is located right after them.
- (org-e-ascii-links-to-notes nil)
+ (org-ascii-links-to-notes nil)
(title (org-export-data (plist-get info :title) info))
(author (and (plist-get info :with-author)
(let ((auth (plist-get info :author)))
@@ -845,7 +849,7 @@ INFO is a plist used as a communication channel."
date "\n\n\n"))
((org-string-nw-p date)
(concat
- (org-e-ascii--justify-string date text-width 'right)
+ (org-ascii--justify-string date text-width 'right)
"\n\n\n"))
((and (org-string-nw-p author) (org-string-nw-p email))
(concat author "\n" email "\n\n\n"))
@@ -858,12 +862,12 @@ INFO is a plist used as a communication channel."
;; Format TITLE. It may be filled if it is too wide,
;; that is wider than the two thirds of the total width.
(title-len (min (length title) (/ (* 2 text-width) 3)))
- (formatted-title (org-e-ascii--fill-string title title-len info))
+ (formatted-title (org-ascii--fill-string title title-len info))
(line
(make-string
(min (+ (max title-len (length author) (length email)) 2)
text-width) (if utf8p ?━ ?_))))
- (org-e-ascii--justify-string
+ (org-ascii--justify-string
(concat line "\n"
(unless utf8p "\n")
(upcase formatted-title)
@@ -878,21 +882,21 @@ INFO is a plist used as a communication channel."
(when (org-string-nw-p date) (concat "\n\n\n" date))
"\n\n\n") text-width 'center)))))
-(defun org-e-ascii-template (contents info)
+(defun org-ascii-template (contents info)
"Return complete document string after ASCII conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
(org-element-normalize-string
- (org-e-ascii--indent-string
- (let ((text-width (- org-e-ascii-text-width org-e-ascii-global-margin)))
+ (org-ascii--indent-string
+ (let ((text-width (- org-ascii-text-width org-ascii-global-margin)))
;; 1. Build title block.
(concat
- (org-e-ascii-template--document-title info)
+ (org-ascii-template--document-title info)
;; 2. Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat
- (org-e-ascii--build-toc info (and (wholenump depth) depth))
+ (org-ascii--build-toc info (and (wholenump depth) depth))
"\n\n\n")))
;; 3. Document's body.
contents
@@ -901,11 +905,11 @@ holding export options."
(plist-get info :parse-tree) info))
;; Insert full links right inside the footnote definition
;; as they have no chance to be inserted later.
- (org-e-ascii-links-to-notes nil))
+ (org-ascii-links-to-notes nil))
(when definitions
(concat
"\n\n\n"
- (let ((title (org-e-ascii--translate "Footnotes" info)))
+ (let ((title (org-ascii--translate "Footnotes" info)))
(concat
title "\n"
(make-string
@@ -931,7 +935,7 @@ holding export options."
(org-export-data def info)))
;; Fill paragraph once footnote ID is inserted in
;; order to have a correct length for first line.
- (org-e-ascii--fill-string
+ (org-ascii--fill-string
(concat id (org-export-data def info))
text-width info))))))
definitions "\n\n"))))
@@ -941,11 +945,11 @@ holding export options."
(unless (or (not creator-info) (eq creator-info 'comment))
(concat
"\n\n\n"
- (org-e-ascii--fill-string
+ (org-ascii--fill-string
(plist-get info :creator) text-width info 'right))))))
- org-e-ascii-global-margin)))
+ org-ascii-global-margin)))
-(defun org-e-ascii--translate (s info)
+(defun org-ascii--translate (s info)
"Translate string S according to specified language and charset.
INFO is a plist used as a communication channel."
(let ((charset (intern (format ":%s" (plist-get info :ascii-charset)))))
@@ -957,7 +961,7 @@ INFO is a plist used as a communication channel."
;;;; Bold
-(defun org-e-ascii-bold (bold contents info)
+(defun org-ascii-bold (bold contents info)
"Transcode BOLD from Org to ASCII.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
@@ -966,17 +970,17 @@ contextual information."
;;;; Center Block
-(defun org-e-ascii-center-block (center-block contents info)
+(defun org-ascii-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (org-e-ascii--justify-string
- contents (org-e-ascii--current-text-width center-block info) 'center))
+ (org-ascii--justify-string
+ contents (org-ascii--current-text-width center-block info) 'center))
;;;; Clock
-(defun org-e-ascii-clock (clock contents info)
+(defun org-ascii-clock (clock contents info)
"Transcode a CLOCK object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -994,23 +998,23 @@ information."
;;;; Code
-(defun org-e-ascii-code (code contents info)
+(defun org-ascii-code (code contents info)
"Return a CODE object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (format org-e-ascii-verbatim-format (org-element-property :value code)))
+ (format org-ascii-verbatim-format (org-element-property :value code)))
;;;; Drawer
-(defun org-e-ascii-drawer (drawer contents info)
+(defun org-ascii-drawer (drawer contents info)
"Transcode a DRAWER element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let ((name (org-element-property :drawer-name drawer))
- (width (org-e-ascii--current-text-width drawer info)))
- (if (functionp org-e-ascii-format-drawer-function)
- (funcall org-e-ascii-format-drawer-function name contents width)
+ (width (org-ascii--current-text-width drawer info)))
+ (if (functionp org-ascii-format-drawer-function)
+ (funcall org-ascii-format-drawer-function name contents width)
;; If there's no user defined function: simply
;; display contents of the drawer.
contents)))
@@ -1018,7 +1022,7 @@ holding contextual information."
;;;; Dynamic Block
-(defun org-e-ascii-dynamic-block (dynamic-block contents info)
+(defun org-ascii-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1027,7 +1031,7 @@ holding contextual information."
;;;; Entity
-(defun org-e-ascii-entity (entity contents info)
+(defun org-ascii-entity (entity contents info)
"Transcode an ENTITY object from Org to ASCII.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -1038,25 +1042,25 @@ contextual information."
;;;; Example Block
-(defun org-e-ascii-example-block (example-block contents info)
+(defun org-ascii-example-block (example-block contents info)
"Transcode a EXAMPLE-BLOCK element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-ascii--box-string
+ (org-ascii--box-string
(org-export-format-code-default example-block info) info))
;;;; Export Snippet
-(defun org-e-ascii-export-snippet (export-snippet contents info)
+(defun org-ascii-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-ascii)
+ (when (eq (org-export-snippet-backend export-snippet) 'ascii)
(org-element-property :value export-snippet)))
;;;; Export Block
-(defun org-e-ascii-export-block (export-block contents info)
+(defun org-ascii-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "ASCII")
@@ -1065,10 +1069,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Fixed Width
-(defun org-e-ascii-fixed-width (fixed-width contents info)
+(defun org-ascii-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-ascii--box-string
+ (org-ascii--box-string
(org-remove-indentation
(org-element-property :value fixed-width)) info))
@@ -1076,12 +1080,12 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Footnote Definition
;; Footnote Definitions are ignored. They are compiled at the end of
-;; the document, by `org-e-ascii-template'.
+;; the document, by `org-ascii-template'.
;;;; Footnote Reference
-(defun org-e-ascii-footnote-reference (footnote-reference contents info)
+(defun org-ascii-footnote-reference (footnote-reference contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
(format "[%s]" (org-export-get-footnote-number footnote-reference info)))
@@ -1089,7 +1093,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Headline
-(defun org-e-ascii-headline (headline contents info)
+(defun org-ascii-headline (headline contents info)
"Transcode an HEADLINE element from Org to ASCII.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
@@ -1097,13 +1101,13 @@ holding contextual information."
;; of the template.
(unless (org-element-property :footnote-section-p headline)
(let* ((low-level-rank (org-export-low-level-p headline info))
- (width (org-e-ascii--current-text-width headline info))
+ (width (org-ascii--current-text-width headline info))
;; Blank lines between headline and its contents.
- ;; `org-e-ascii-headline-spacing', when set, overwrites
+ ;; `org-ascii-headline-spacing', when set, overwrites
;; original buffer's spacing.
(pre-blanks
(make-string
- (if org-e-ascii-headline-spacing (car org-e-ascii-headline-spacing)
+ (if org-ascii-headline-spacing (car org-ascii-headline-spacing)
(org-element-property :pre-blank headline)) ?\n))
;; Even if HEADLINE has no section, there might be some
;; links in its title that we shouldn't forget to describe.
@@ -1111,42 +1115,42 @@ holding contextual information."
(unless (or (eq (caar (org-element-contents headline)) 'section))
(let ((title (org-element-property :title headline)))
(when (consp title)
- (org-e-ascii--describe-links
- (org-e-ascii--unique-links title info) width info))))))
+ (org-ascii--describe-links
+ (org-ascii--unique-links title info) width info))))))
;; Deep subtree: export it as a list item.
(if low-level-rank
(concat
;; Bullet.
(let ((bullets (cdr (assq (plist-get info :ascii-charset)
- org-e-ascii-bullets))))
+ org-ascii-bullets))))
(char-to-string
(nth (mod (1- low-level-rank) (length bullets)) bullets)))
" "
;; Title.
- (org-e-ascii--build-title headline info width) "\n"
+ (org-ascii--build-title headline info width) "\n"
;; Contents, indented by length of bullet.
pre-blanks
- (org-e-ascii--indent-string
+ (org-ascii--indent-string
(concat contents
(when (org-string-nw-p links) (concat "\n\n" links)))
2))
;; Else: Standard headline.
(concat
- (org-e-ascii--build-title headline info width 'underline)
+ (org-ascii--build-title headline info width 'underline)
"\n" pre-blanks
(concat (when (org-string-nw-p links) links) contents))))))
;;;; Horizontal Rule
-(defun org-e-ascii-horizontal-rule (horizontal-rule contents info)
+(defun org-ascii-horizontal-rule (horizontal-rule contents info)
"Transcode an HORIZONTAL-RULE object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (let ((text-width (org-e-ascii--current-text-width horizontal-rule info))
+ (let ((text-width (org-ascii--current-text-width horizontal-rule info))
(spec-width
(org-export-read-attribute :attr_ascii horizontal-rule :width)))
- (org-e-ascii--justify-string
+ (org-ascii--justify-string
(make-string (if (wholenump spec-width) spec-width text-width)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?― ?-))
text-width 'center)))
@@ -1154,25 +1158,25 @@ information."
;;;; Inline Src Block
-(defun org-e-ascii-inline-src-block (inline-src-block contents info)
+(defun org-ascii-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
- (format org-e-ascii-verbatim-format
+ (format org-ascii-verbatim-format
(org-element-property :value inline-src-block)))
;;;; Inlinetask
-(defun org-e-ascii-inlinetask (inlinetask contents info)
+(defun org-ascii-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (let ((width (org-e-ascii--current-text-width inlinetask info)))
- ;; If `org-e-ascii-format-inlinetask-function' is provided, call it
+ (let ((width (org-ascii--current-text-width inlinetask info)))
+ ;; If `org-ascii-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- (if (functionp org-e-ascii-format-inlinetask-function)
- (funcall org-e-ascii-format-inlinetask-function
+ (if (functionp org-ascii-format-inlinetask-function)
+ (funcall org-ascii-format-inlinetask-function
;; todo.
(and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property
@@ -1192,15 +1196,15 @@ holding contextual information."
contents width)
;; Otherwise, use a default template.
(let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
- (org-e-ascii--indent-string
+ (org-ascii--indent-string
(concat
;; Top line, with an additional blank line if not in UTF-8.
(make-string width (if utf8p ?━ ?_)) "\n"
(unless utf8p (concat (make-string width ? ) "\n"))
;; Add title. Fill it if wider than inlinetask.
- (let ((title (org-e-ascii--build-title inlinetask info width)))
+ (let ((title (org-ascii--build-title inlinetask info width)))
(if (<= (length title) width) title
- (org-e-ascii--fill-string title width info)))
+ (org-ascii--fill-string title width info)))
"\n"
;; If CONTENTS is not empty, insert it along with
;; a separator.
@@ -1209,15 +1213,15 @@ holding contextual information."
;; Bottom line.
(make-string width (if utf8p ?━ ?_)))
;; Flush the inlinetask to the right.
- (- org-e-ascii-text-width org-e-ascii-global-margin
+ (- org-ascii-text-width org-ascii-global-margin
(if (not (org-export-get-parent-headline inlinetask)) 0
- org-e-ascii-inner-margin)
- (org-e-ascii--current-text-width inlinetask info)))))))
+ org-ascii-inner-margin)
+ (org-ascii--current-text-width inlinetask info)))))))
;;;; Italic
-(defun org-e-ascii-italic (italic contents info)
+(defun org-ascii-italic (italic contents info)
"Transcode italic from Org to ASCII.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
@@ -1226,12 +1230,12 @@ contextual information."
;;;; Item
-(defun org-e-ascii-item (item contents info)
+(defun org-ascii-item (item contents info)
"Transcode an ITEM element from Org to ASCII.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))
- (checkbox (org-e-ascii--checkbox item info))
+ (checkbox (org-ascii--checkbox item info))
(list-type (org-element-property :type (org-export-get-parent item)))
(bullet
;; First parent of ITEM is always the plain-list. Get
@@ -1268,7 +1272,7 @@ contextual information."
;; Contents: Pay attention to indentation. Note: check-boxes are
;; already taken care of at the paragraph level so they don't
;; interfere with indentation.
- (let ((contents (org-e-ascii--indent-string contents (length bullet))))
+ (let ((contents (org-ascii--indent-string contents (length bullet))))
(if (eq (org-element-type (car (org-element-contents item))) 'paragraph)
(org-trim contents)
(concat "\n" contents))))))
@@ -1276,7 +1280,7 @@ contextual information."
;;;; Keyword
-(defun org-e-ascii-keyword (keyword contents info)
+(defun org-ascii-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1291,35 +1295,37 @@ information."
(let ((depth (or (and (string-match "[0-9]+" value)
(string-to-number (match-string 0 value)))
(plist-get info :with-toc))))
- (org-e-ascii--build-toc
+ (org-ascii--build-toc
info (and (wholenump depth) depth) keyword)))
((string= "tables" value)
- (org-e-ascii--list-tables keyword info))
+ (org-ascii--list-tables keyword info))
((string= "listings" value)
- (org-e-ascii--list-listings keyword info))))))))
+ (org-ascii--list-listings keyword info))))))))
;;;; Latex Environment
-(defun org-e-ascii-latex-environment (latex-environment contents info)
+(defun org-ascii-latex-environment (latex-environment contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (org-remove-indentation (org-element-property :value latex-environment)))
+ (when (plist-get info :with-latex)
+ (org-remove-indentation (org-element-property :value latex-environment))))
;;;; Latex Fragment
-(defun org-e-ascii-latex-fragment (latex-fragment contents info)
+(defun org-ascii-latex-fragment (latex-fragment contents info)
"Transcode a LATEX-FRAGMENT object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (org-element-property :value latex-fragment))
+ (when (plist-get info :with-latex)
+ (org-element-property :value latex-fragment)))
;;;; Line Break
-(defun org-e-ascii-line-break (line-break contents info)
+(defun org-ascii-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual
information." hard-newline)
@@ -1327,7 +1333,7 @@ CONTENTS is nil. INFO is a plist holding contextual
;;;; Link
-(defun org-e-ascii-link (link desc info)
+(defun org-ascii-link (link desc info)
"Transcode a LINK object from Org to ASCII.
DESC is the description part of the link, or the empty string.
@@ -1355,7 +1361,7 @@ INFO is a plist holding contextual information."
(when destination
(let ((number
(org-export-get-ordinal
- destination info nil 'org-e-ascii--has-caption-p)))
+ destination info nil 'org-ascii--has-caption-p)))
(when number
(if (atom number) (number-to-string number)
(mapconcat 'number-to-string number ".")))))))))
@@ -1363,26 +1369,26 @@ INFO is a plist holding contextual information."
(if (not (org-string-nw-p desc)) (format "[%s]" raw-link)
(concat
(format "[%s]" desc)
- (unless org-e-ascii-links-to-notes (format " (%s)" raw-link))))))))
+ (unless org-ascii-links-to-notes (format " (%s)" raw-link))))))))
;;;; Paragraph
-(defun org-e-ascii-paragraph (paragraph contents info)
+(defun org-ascii-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to ASCII.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
- (let ((contents (if (not (wholenump org-e-ascii-indented-line-width)) contents
+ (let ((contents (if (not (wholenump org-ascii-indented-line-width)) contents
(concat
- (make-string org-e-ascii-indented-line-width ? )
+ (make-string org-ascii-indented-line-width ? )
(replace-regexp-in-string "\\`[ \t]+" "" contents)))))
- (org-e-ascii--fill-string
- contents (org-e-ascii--current-text-width paragraph info) info)))
+ (org-ascii--fill-string
+ contents (org-ascii--current-text-width paragraph info) info)))
;;;; Plain List
-(defun org-e-ascii-plain-list (plain-list contents info)
+(defun org-ascii-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to ASCII.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -1391,7 +1397,7 @@ contextual information."
;;;; Plain Text
-(defun org-e-ascii-plain-text (text info)
+(defun org-ascii-plain-text (text info)
"Transcode a TEXT string from Org to ASCII.
INFO is a plist used as a communication channel."
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
@@ -1410,7 +1416,7 @@ INFO is a plist used as a communication channel."
;;;; Planning
-(defun org-e-ascii-planning (planning contents info)
+(defun org-ascii-planning (planning contents info)
"Transcode a PLANNING element from Org to ASCII.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -1437,39 +1443,39 @@ channel."
;;;; Quote Block
-(defun org-e-ascii-quote-block (quote-block contents info)
+(defun org-ascii-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (let ((width (org-e-ascii--current-text-width quote-block info)))
- (org-e-ascii--indent-string
+ (let ((width (org-ascii--current-text-width quote-block info)))
+ (org-ascii--indent-string
(org-remove-indentation
- (org-e-ascii--fill-string contents width info))
- org-e-ascii-quote-margin)))
+ (org-ascii--fill-string contents width info))
+ org-ascii-quote-margin)))
;;;; Quote Section
-(defun org-e-ascii-quote-section (quote-section contents info)
+(defun org-ascii-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((width (org-e-ascii--current-text-width quote-section info))
+ (let ((width (org-ascii--current-text-width quote-section info))
(value
(org-export-data
(org-remove-indentation (org-element-property :value quote-section))
info)))
- (org-e-ascii--indent-string
+ (org-ascii--indent-string
value
- (+ org-e-ascii-quote-margin
+ (+ org-ascii-quote-margin
;; Don't apply inner margin if parent headline is low level.
(let ((headline (org-export-get-parent-headline quote-section)))
(if (org-export-low-level-p headline info) 0
- org-e-ascii-inner-margin))))))
+ org-ascii-inner-margin))))))
;;;; Radio Target
-(defun org-e-ascii-radio-target (radio-target contents info)
+(defun org-ascii-radio-target (radio-target contents info)
"Transcode a RADIO-TARGET object from Org to ASCII.
CONTENTS is the contents of the target. INFO is a plist holding
contextual information."
@@ -1478,29 +1484,29 @@ contextual information."
;;;; Section
-(defun org-e-ascii-section (section contents info)
+(defun org-ascii-section (section contents info)
"Transcode a SECTION element from Org to ASCII.
CONTENTS is the contents of the section. INFO is a plist holding
contextual information."
- (org-e-ascii--indent-string
+ (org-ascii--indent-string
(concat
contents
- (when org-e-ascii-links-to-notes
+ (when org-ascii-links-to-notes
;; Add list of links at the end of SECTION.
- (let ((links (org-e-ascii--describe-links
- (org-e-ascii--unique-links section info)
- (org-e-ascii--current-text-width section info) info)))
+ (let ((links (org-ascii--describe-links
+ (org-ascii--unique-links section info)
+ (org-ascii--current-text-width section info) info)))
;; Separate list of links and section contents.
(when (org-string-nw-p links) (concat "\n\n" links)))))
;; Do not apply inner margin if parent headline is low level.
(let ((headline (org-export-get-parent-headline section)))
(if (or (not headline) (org-export-low-level-p headline info)) 0
- org-e-ascii-inner-margin))))
+ org-ascii-inner-margin))))
;;;; Special Block
-(defun org-e-ascii-special-block (special-block contents info)
+(defun org-ascii-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1509,22 +1515,22 @@ holding contextual information."
;;;; Src Block
-(defun org-e-ascii-src-block (src-block contents info)
+(defun org-ascii-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to ASCII.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
- (let ((caption (org-e-ascii--build-caption src-block info)))
+ (let ((caption (org-ascii--build-caption src-block info)))
(concat
- (when (and caption org-e-ascii-caption-above) (concat caption "\n"))
- (org-e-ascii--box-string
+ (when (and caption org-ascii-caption-above) (concat caption "\n"))
+ (org-ascii--box-string
(org-export-format-code-default src-block info) info)
- (when (and caption (not org-e-ascii-caption-above))
+ (when (and caption (not org-ascii-caption-above))
(concat "\n" caption)))))
;;;; Statistics Cookie
-(defun org-e-ascii-statistics-cookie (statistics-cookie contents info)
+(defun org-ascii-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value statistics-cookie))
@@ -1532,7 +1538,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Subscript
-(defun org-e-ascii-subscript (subscript contents info)
+(defun org-ascii-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to ASCII.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1543,7 +1549,7 @@ contextual information."
;;;; Superscript
-(defun org-e-ascii-superscript (superscript contents info)
+(defun org-ascii-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to ASCII.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1554,7 +1560,7 @@ contextual information."
;;;; Strike-through
-(defun org-e-ascii-strike-through (strike-through contents info)
+(defun org-ascii-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to ASCII.
CONTENTS is text with strike-through markup. INFO is a plist
holding contextual information."
@@ -1563,17 +1569,17 @@ holding contextual information."
;;;; Table
-(defun org-e-ascii-table (table contents info)
+(defun org-ascii-table (table contents info)
"Transcode a TABLE element from Org to ASCII.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
- (let ((caption (org-e-ascii--build-caption table info)))
+ (let ((caption (org-ascii--build-caption table info)))
(concat
;; Possibly add a caption string above.
- (when (and caption org-e-ascii-caption-above) (concat caption "\n"))
+ (when (and caption org-ascii-caption-above) (concat caption "\n"))
;; Insert table. Note: "table.el" tables are left unmodified.
(cond ((eq (org-element-property :type table) 'org) contents)
- ((and org-e-ascii-table-use-ascii-art
+ ((and org-ascii-table-use-ascii-art
(eq (plist-get info :ascii-charset) 'utf-8)
(require 'ascii-art-to-unicode nil t))
(with-temp-buffer
@@ -1586,13 +1592,13 @@ contextual information."
(buffer-substring (point-min) (point))))
(t (org-remove-indentation (org-element-property :value table))))
;; Possible add a caption string below.
- (when (and caption (not org-e-ascii-caption-above))
+ (when (and caption (not org-ascii-caption-above))
(concat "\n" caption)))))
;;;; Table Cell
-(defun org-e-ascii--table-cell-width (table-cell info)
+(defun org-ascii--table-cell-width (table-cell info)
"Return width of TABLE-CELL.
INFO is a plist used as a communication channel.
@@ -1601,46 +1607,45 @@ Width of a cell is determined either by a width cookie in the
same column as the cell, or by the maximum cell's length in that
column.
-When `org-e-ascii-table-widen-columns' is non-nil, width cookies
+When `org-ascii-table-widen-columns' is non-nil, width cookies
are ignored."
- (or (and (not org-e-ascii-table-widen-columns)
+ (or (and (not org-ascii-table-widen-columns)
(org-export-table-cell-width table-cell info))
(let* ((max-width 0)
(table (org-export-get-parent-table table-cell))
(specialp (org-export-table-has-special-column-p table))
(col (cdr (org-export-table-cell-address table-cell info))))
- (org-element-map
- table 'table-row
- (lambda (row)
- (setq max-width
- (max (length
- (org-export-data
- (org-element-contents
- (elt (if specialp (cdr (org-element-contents row))
- (org-element-contents row))
- col))
- info))
- max-width)))
- info)
+ (org-element-map table 'table-row
+ (lambda (row)
+ (setq max-width
+ (max (length
+ (org-export-data
+ (org-element-contents
+ (elt (if specialp (cdr (org-element-contents row))
+ (org-element-contents row))
+ col))
+ info))
+ max-width)))
+ info)
max-width)))
-(defun org-e-ascii-table-cell (table-cell contents info)
+(defun org-ascii-table-cell (table-cell contents info)
"Transcode a TABLE-CELL object from Org to ASCII.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
- ;; Determine column width. When `org-e-ascii-table-widen-columns'
+ ;; Determine column width. When `org-ascii-table-widen-columns'
;; is nil and some width cookie has set it, use that value.
;; Otherwise, compute the maximum width among transcoded data of
;; each cell in the column.
- (let ((width (org-e-ascii--table-cell-width table-cell info)))
+ (let ((width (org-ascii--table-cell-width table-cell info)))
;; When contents are too large, truncate them.
- (unless (or org-e-ascii-table-widen-columns (<= (length contents) width))
+ (unless (or org-ascii-table-widen-columns (<= (length contents) width))
(setq contents (concat (substring contents 0 (- width 2)) "=>")))
;; Align contents correctly within the cell.
(let* ((indent-tabs-mode nil)
(data
(when contents
- (org-e-ascii--justify-string
+ (org-ascii--justify-string
contents width
(org-export-table-cell-alignment table-cell info)))))
(setq contents (concat data (make-string (- width (length data)) ? ))))
@@ -1652,7 +1657,7 @@ a communication channel."
;;;; Table Row
-(defun org-e-ascii-table-row (table-row contents info)
+(defun org-ascii-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to ASCII.
CONTENTS is the row contents. INFO is a plist used as
a communication channel."
@@ -1663,29 +1668,28 @@ a communication channel."
(concat
(apply
'concat
- (org-element-map
- table-row 'table-cell
- (lambda (cell)
- (let ((width (org-e-ascii--table-cell-width cell info))
- (borders (org-export-table-cell-borders cell info)))
- (concat
- ;; In order to know if CELL starts the row, do
- ;; not compare it with the first cell in the row
- ;; as there might be a special column. Instead,
- ;; compare it with the first exportable cell,
- ;; obtained with `org-element-map'.
- (when (and (memq 'left borders)
- (eq (org-element-map
- table-row 'table-cell 'identity info t)
- cell))
- lcorner)
- (make-string (+ 2 width) (string-to-char horiz))
- (cond
- ((not (memq 'right borders)) nil)
- ((eq (car (last (org-element-contents table-row))) cell)
- rcorner)
- (t vert)))))
- info)) "\n"))))
+ (org-element-map table-row 'table-cell
+ (lambda (cell)
+ (let ((width (org-ascii--table-cell-width cell info))
+ (borders (org-export-table-cell-borders cell info)))
+ (concat
+ ;; In order to know if CELL starts the row, do
+ ;; not compare it with the first cell in the
+ ;; row as there might be a special column.
+ ;; Instead, compare it with first exportable
+ ;; cell, obtained with `org-element-map'.
+ (when (and (memq 'left borders)
+ (eq (org-element-map table-row 'table-cell
+ 'identity info t)
+ cell))
+ lcorner)
+ (make-string (+ 2 width) (string-to-char horiz))
+ (cond
+ ((not (memq 'right borders)) nil)
+ ((eq (car (last (org-element-contents table-row))) cell)
+ rcorner)
+ (t vert)))))
+ info)) "\n"))))
(utf8p (eq (plist-get info :ascii-charset) 'utf-8))
(borders (org-export-table-cell-borders
(org-element-map table-row 'table-cell 'identity info t)
@@ -1706,15 +1710,15 @@ a communication channel."
;;;; Timestamp
-(defun org-e-ascii-timestamp (timestamp contents info)
+(defun org-ascii-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-ascii-plain-text (org-timestamp-translate timestamp) info))
+ (org-ascii-plain-text (org-timestamp-translate timestamp) info))
;;;; Underline
-(defun org-e-ascii-underline (underline contents info)
+(defun org-ascii-underline (underline contents info)
"Transcode UNDERLINE from Org to ASCII.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
@@ -1723,42 +1727,42 @@ holding contextual information."
;;;; Verbatim
-(defun org-e-ascii-verbatim (verbatim contents info)
+(defun org-ascii-verbatim (verbatim contents info)
"Return a VERBATIM object from Org to ASCII.
CONTENTS is nil. INFO is a plist holding contextual information."
- (format org-e-ascii-verbatim-format
+ (format org-ascii-verbatim-format
(org-element-property :value verbatim)))
;;;; Verse Block
-(defun org-e-ascii-verse-block (verse-block contents info)
+(defun org-ascii-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to ASCII.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
- (let ((verse-width (org-e-ascii--current-text-width verse-block info)))
- (org-e-ascii--indent-string
- (org-e-ascii--justify-string contents verse-width 'left)
- org-e-ascii-quote-margin)))
+ (let ((verse-width (org-ascii--current-text-width verse-block info)))
+ (org-ascii--indent-string
+ (org-ascii--justify-string contents verse-width 'left)
+ org-ascii-quote-margin)))
;;; Filters
-(defun org-e-ascii-filter-headline-blank-lines (headline back-end info)
+(defun org-ascii-filter-headline-blank-lines (headline back-end info)
"Filter controlling number of blank lines after an headline.
HEADLINE is a string representing a transcoded headline.
BACK-END is symbol specifying back-end used for export. INFO is
plist containing the communication channel.
-This function only applies to `e-ascii' back-end. See
-`org-e-ascii-headline-spacing' for information."
- (if (not org-e-ascii-headline-spacing) headline
- (let ((blanks (make-string (1+ (cdr org-e-ascii-headline-spacing)) ?\n)))
+This function only applies to `ascii' back-end. See
+`org-ascii-headline-spacing' for information."
+ (if (not org-ascii-headline-spacing) headline
+ (let ((blanks (make-string (1+ (cdr org-ascii-headline-spacing)) ?\n)))
(replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))))
-(defun org-e-ascii-filter-paragraph-spacing (tree back-end info)
+(defun org-ascii-filter-paragraph-spacing (tree back-end info)
"Filter controlling number of blank lines between paragraphs.
TREE is the parse tree. BACK-END is the symbol specifying
@@ -1766,15 +1770,14 @@ back-end used for export. INFO is a plist used as
a communication channel.
This function only applies to `e-ascii' back-end. See
-`org-e-ascii-paragraph-spacing' for information."
- (when (wholenump org-e-ascii-paragraph-spacing)
- (org-element-map
- tree 'paragraph
- (lambda (p)
- (when (eq (org-element-type (org-export-get-next-element p info))
- 'paragraph)
- (org-element-put-property
- p :post-blank org-e-ascii-paragraph-spacing)))))
+`org-ascii-paragraph-spacing' for information."
+ (when (wholenump org-ascii-paragraph-spacing)
+ (org-element-map tree 'paragraph
+ (lambda (p)
+ (when (eq (org-element-type (org-export-get-next-element p info))
+ 'paragraph)
+ (org-element-put-property
+ p :post-blank org-ascii-paragraph-spacing)))))
tree)
@@ -1782,7 +1785,7 @@ This function only applies to `e-ascii' back-end. See
;;; End-user functions
;;;###autoload
-(defun org-e-ascii-export-as-ascii
+(defun org-ascii-export-as-ascii
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a text buffer.
@@ -1809,30 +1812,30 @@ EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
-Export is done in a buffer named \"*Org E-ASCII Export*\", which
+Export is done in a buffer named \"*Org ASCII Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(if async
(org-export-async-start
(lambda (output)
- (with-current-buffer (get-buffer-create "*Org E-ASCII Export*")
+ (with-current-buffer (get-buffer-create "*Org ASCII Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(text-mode)
- (org-export-add-to-stack (current-buffer) 'e-ascii)))
- `(org-export-as 'e-ascii ,subtreep ,visible-only ,body-only
+ (org-export-add-to-stack (current-buffer) 'ascii)))
+ `(org-export-as 'ascii ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf (org-export-to-buffer
- 'e-ascii "*Org E-ASCII Export*"
+ 'ascii "*Org ASCII Export*"
subtreep visible-only body-only ext-plist)))
(with-current-buffer outbuf (text-mode))
(when org-export-show-temporary-export-buffer
(switch-to-buffer-other-window outbuf)))))
;;;###autoload
-(defun org-e-ascii-export-to-ascii
+(defun org-ascii-export-to-ascii
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a text file.
@@ -1864,15 +1867,15 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".txt" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-ascii))
+ (lambda (f) (org-export-add-to-stack f 'ascii))
`(expand-file-name
(org-export-to-file
- 'e-ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
+ 'ascii ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
- 'e-ascii outfile subtreep visible-only body-only ext-plist))))
+ 'ascii outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
-(defun org-e-ascii-publish-to-ascii (plist filename pub-dir)
+(defun org-ascii-publish-to-ascii (plist filename pub-dir)
"Publish an Org file to ASCII.
FILENAME is the filename of the Org file to be published. PLIST
@@ -1880,11 +1883,11 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset ascii ,@plist) pub-dir))
+ (org-publish-org-to
+ 'ascii filename ".txt" `(:ascii-charset ascii ,@plist) pub-dir))
;;;###autoload
-(defun org-e-ascii-publish-to-latin1 (plist filename pub-dir)
+(defun org-ascii-publish-to-latin1 (plist filename pub-dir)
"Publish an Org file to Latin-1.
FILENAME is the filename of the Org file to be published. PLIST
@@ -1892,11 +1895,11 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset latin1 ,@plist) pub-dir))
+ (org-publish-org-to
+ 'ascii filename ".txt" `(:ascii-charset latin1 ,@plist) pub-dir))
;;;###autoload
-(defun org-e-ascii-publish-to-utf8 (plist filename pub-dir)
+(defun org-ascii-publish-to-utf8 (plist filename pub-dir)
"Publish an org file to UTF-8.
FILENAME is the filename of the Org file to be published. PLIST
@@ -1904,9 +1907,14 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to
- 'e-ascii filename ".txt" `(:ascii-charset utf-8 ,@plist) pub-dir))
+ (org-publish-org-to
+ 'ascii filename ".txt" `(:ascii-charset utf-8 ,@plist) pub-dir))
+
+
+(provide 'ox-ascii)
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
-(provide 'org-e-ascii)
-;;; org-e-ascii.el ends here
+;;; ox-ascii.el ends here
diff --git a/contrib/lisp/org-e-beamer.el b/lisp/ox-beamer.el
index 871aa9f..e9697f4 100644
--- a/contrib/lisp/org-e-beamer.el
+++ b/lisp/ox-beamer.el
@@ -1,4 +1,4 @@
-;;; org-e-beamer.el --- Beamer Back-End for Org Export Engine
+;;; ox-beamer.el --- Beamer Back-End for Org Export Engine
;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
@@ -26,24 +26,29 @@
;; document.
;;
;; Depending on the desired output format, three commands are provided
-;; for export: `org-e-beamer-export-as-latex' (temporary buffer),
-;; `org-e-beamer-export-to-latex' ("tex" file) and
-;; `org-e-beamer-export-to-pdf' ("pdf" file).
+;; for export: `org-beamer-export-as-latex' (temporary buffer),
+;; `org-beamer-export-to-latex' ("tex" file) and
+;; `org-beamer-export-to-pdf' ("pdf" file).
;;
-;; On top of buffer keywords and options items supported by `e-latex'
-;; back-end (see `org-e-latex-options-alist'), this back-end
-;; introduces the following keywords: "BEAMER_THEME",
-;; "BEAMER_COLOR_THEME", "BEAMER_FONT_THEME", "BEAMER_INNER_THEME" and
-;; "BEAMER_OUTER_THEME". All accept options in square brackets.
+;; This back-end supports every buffer keyword, attribute and options
+;; items (see `org-latex-options-alist') already supported by `latex'
+;; back-end. As such, it is suggested to add an entry in
+;; `org-latex-classes' variable which is appropriate for Beamer
+;; export.
+;;
+;; On top of this, the `beamer' back-end also introduces the following
+;; keywords: "BEAMER_THEME", "BEAMER_COLOR_THEME",
+;; "BEAMER_FONT_THEME", "BEAMER_INNER_THEME" and "BEAMER_OUTER_THEME".
+;; All accept options in square brackets.
;;
;; Moreover, headlines now fall into three categories: sectioning
;; elements, frames and blocks.
;;
-;; - Like `e-latex' back-end sectioning elements are still set through
-;; `org-e-latex-classes' variable.
+;; - Like `latex' back-end sectioning elements are still set through
+;; `org-latex-classes' variable.
;;
;; - Headlines become frames when their level is equal to
-;; `org-e-beamer-frame-level' (or "H" value in the OPTIONS line).
+;; `org-beamer-frame-level' (or "H" value in the OPTIONS line).
;; Though, if an headline in the current tree has a "BEAMER_env"
;; (see below) property set to either "frame" or "fullframe", its
;; level overrides the variable. A "fullframe" is a frame with an
@@ -51,8 +56,8 @@
;;
;; - All frames' children become block environments. Special block
;; types can be enforced by setting headline's "BEAMER_env" property
-;; to an appropriate value (see `org-e-beamer-environments-default'
-;; for supported value and `org-e-beamer-environments-extra' for
+;; to an appropriate value (see `org-beamer-environments-default'
+;; for supported value and `org-beamer-environments-extra' for
;; adding more).
;;
;; - As a special case, if the "BEAMER_env" property is set to either
@@ -86,25 +91,25 @@
;; among `bold', `item', `link', `radio-target' and `target' will
;; control its overlay specifications.
;;
-;; On the minor mode side, `org-e-beamer-select-environment' (bound by
-;; default to "C-c C-b") and `org-e-beamer-insert-options-template'
-;; are the two entry points.
+;; On the minor mode side, `org-beamer-select-environment' (bound by
+;; default to "C-c C-b") and `org-beamer-insert-options-template' are
+;; the two entry points.
;;; Code:
-(require 'org-e-latex)
+(require 'ox-latex)
;;; User-Configurable Variables
-(defgroup org-export-e-beamer nil
+(defgroup org-export-beamer nil
"Options specific for using the beamer class in LaTeX export."
:tag "Org Beamer"
:group 'org-export
:version "24.2")
-(defcustom org-e-beamer-frame-level 1
+(defcustom org-beamer-frame-level 1
"The level at which headlines become frames.
Headlines at a lower level will be translated into a sectioning
@@ -121,36 +126,36 @@ appendix or a note.
This integer is relative to the minimal level of an headline
within the parse tree, defined as 1."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type 'integer)
-(defcustom org-e-beamer-frame-default-options ""
+(defcustom org-beamer-frame-default-options ""
"Default options string to use for frames.
For example, it could be set to \"allowframebreaks\"."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(string :tag "[options]"))
-(defcustom org-e-beamer-column-view-format
+(defcustom org-beamer-column-view-format
"%45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) %8BEAMER_opt(Opt)"
"Column view format that should be used to fill the template."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(choice
(const :tag "Do not insert Beamer column view format" nil)
(string :tag "Beamer column view format")))
-(defcustom org-e-beamer-theme "default"
+(defcustom org-beamer-theme "default"
"Default theme used in Beamer presentations."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(choice
(const :tag "Do not insert a Beamer theme" nil)
(string :tag "Beamer theme")))
-(defcustom org-e-beamer-environments-extra nil
+(defcustom org-beamer-environments-extra nil
"Environments triggered by tags in Beamer export.
Each entry has 4 elements:
name Name of the environment
-key Selection key for `org-e-beamer-select-environment'
+key Selection key for `org-beamer-select-environment'
open The opening template for the environment, with the following escapes
%a the action/overlay specification
%A the default action/overlay specification
@@ -159,7 +164,7 @@ open The opening template for the environment, with the following escapes
%H if there is headline text, that text in {} braces
%U if there is headline text, that text in [] brackets
close The closing string of the environment."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(repeat
(list
(string :tag "Environment")
@@ -167,26 +172,26 @@ close The closing string of the environment."
(string :tag "Begin")
(string :tag "End"))))
-(defcustom org-e-beamer-outline-frame-title "Outline"
+(defcustom org-beamer-outline-frame-title "Outline"
"Default title of a frame containing an outline."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(string :tag "Outline frame title"))
-(defcustom org-e-beamer-outline-frame-options ""
+(defcustom org-beamer-outline-frame-options ""
"Outline frame options appended after \\begin{frame}.
You might want to put e.g. \"allowframebreaks=0.9\" here."
- :group 'org-export-e-beamer
+ :group 'org-export-beamer
:type '(string :tag "Outline frame options"))
;;; Internal Variables
-(defconst org-e-beamer-column-widths
+(defconst org-beamer-column-widths
"0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
"The column widths that should be installed as allowed property values.")
-(defconst org-e-beamer-environments-special
+(defconst org-beamer-environments-special
'(("againframe" "A")
("appendix" "x")
("column" "c")
@@ -198,11 +203,11 @@ You might want to put e.g. \"allowframebreaks=0.9\" here."
("noteNH" "N"))
"Alist of environments treated in a special way by the back-end.
Keys are environment names, as strings, values are bindings used
-in `org-e-beamer-select-environment'. Environments listed here,
+in `org-beamer-select-environment'. Environments listed here,
along with their binding, are hard coded and cannot be modified
-through `org-e-beamer-environments-extra' variable.")
+through `org-beamer-environments-extra' variable.")
-(defconst org-e-beamer-environments-default
+(defconst org-beamer-environments-default
'(("block" "b" "\\begin{block}%a{%h}" "\\end{block}")
("alertblock" "a" "\\begin{alertblock}%a{%h}" "\\end{alertblock}")
("verse" "v" "\\begin{verse}%a %% %h" "\\end{verse}")
@@ -217,9 +222,9 @@ through `org-e-beamer-environments-extra' variable.")
("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}" "\\end{beamercolorbox}"))
"Environments triggered by properties in Beamer export.
These are the defaults - for user definitions, see
-`org-e-beamer-environments-extra'.")
+`org-beamer-environments-extra'.")
-(defconst org-e-beamer-verbatim-elements
+(defconst org-beamer-verbatim-elements
'(code example-block fixed-width inline-src-block src-block verbatim)
"List of element or object types producing verbatim text.
This is used internally to determine when a frame should have the
@@ -229,7 +234,7 @@ This is used internally to determine when a frame should have the
;;; Internal functions
-(defun org-e-beamer--normalize-argument (argument type)
+(defun org-beamer--normalize-argument (argument type)
"Return ARGUMENT string with proper boundaries.
TYPE is a symbol among the following:
@@ -251,11 +256,11 @@ TYPE is a symbol among the following:
(format "[%s]" argument)))
(otherwise argument))))
-(defun org-e-beamer--element-has-overlay-p (element)
+(defun org-beamer--element-has-overlay-p (element)
"Non-nil when ELEMENT has an overlay specified.
An element has an overlay specification when it starts with an
-`e-beamer' export-snippet whose value is between angular
-brackets. Return overlay specification, as a string, or nil."
+`beamer' export-snippet whose value is between angular brackets.
+Return overlay specification, as a string, or nil."
(let ((first-object (car (org-element-contents element))))
(when (eq (org-element-type first-object) 'export-snippet)
(let ((value (org-element-property :value first-object)))
@@ -265,35 +270,35 @@ brackets. Return overlay specification, as a string, or nil."
;;; Define Back-End
-(org-export-define-derived-backend e-beamer e-latex
+(org-export-define-derived-backend beamer latex
:export-block "BEAMER"
:menu-entry
(?l 1
- ((?B "As TEX buffer (Beamer)" org-e-beamer-export-as-latex)
- (?b "As TEX file (Beamer)" org-e-beamer-export-to-latex)
- (?P "As PDF file (Beamer)" org-e-beamer-export-to-pdf)
+ ((?B "As TEX buffer (Beamer)" org-beamer-export-as-latex)
+ (?b "As TEX file (Beamer)" org-beamer-export-to-latex)
+ (?P "As PDF file (Beamer)" org-beamer-export-to-pdf)
(?O "As PDF file and open (Beamer)"
(lambda (a s v b)
- (if a (org-e-beamer-export-to-pdf t s v b)
- (org-open-file (org-e-beamer-export-to-pdf nil s v b)))))))
+ (if a (org-beamer-export-to-pdf t s v b)
+ (org-open-file (org-beamer-export-to-pdf nil s v b)))))))
:options-alist
- ((:beamer-theme "BEAMER_THEME" nil org-e-beamer-theme)
+ ((:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
(:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
(:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
(:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
(:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
- (:headline-levels nil "H" org-e-beamer-frame-level))
- :translate-alist ((bold . org-e-beamer-bold)
- (export-block . org-e-beamer-export-block)
- (export-snippet . org-e-beamer-export-snippet)
- (headline . org-e-beamer-headline)
- (item . org-e-beamer-item)
- (keyword . org-e-beamer-keyword)
- (link . org-e-beamer-link)
- (plain-list . org-e-beamer-plain-list)
- (radio-target . org-e-beamer-radio-target)
- (target . org-e-beamer-target)
- (template . org-e-beamer-template)))
+ (:headline-levels nil "H" org-beamer-frame-level))
+ :translate-alist ((bold . org-beamer-bold)
+ (export-block . org-beamer-export-block)
+ (export-snippet . org-beamer-export-snippet)
+ (headline . org-beamer-headline)
+ (item . org-beamer-item)
+ (keyword . org-beamer-keyword)
+ (link . org-beamer-link)
+ (plain-list . org-beamer-plain-list)
+ (radio-target . org-beamer-radio-target)
+ (target . org-beamer-target)
+ (template . org-beamer-template)))
@@ -301,18 +306,18 @@ brackets. Return overlay specification, as a string, or nil."
;;;; Bold
-(defun org-e-beamer-bold (bold contents info)
+(defun org-beamer-bold (bold contents info)
"Transcode BLOCK object into Beamer code.
CONTENTS is the text being bold. INFO is a plist used as
a communication channel."
(format "\\alert%s{%s}"
- (or (org-e-beamer--element-has-overlay-p bold) "")
+ (or (org-beamer--element-has-overlay-p bold) "")
contents))
;;;; Export Block
-(defun org-e-beamer-export-block (export-block contents info)
+(defun org-beamer-export-block (export-block contents info)
"Transcode an EXPORT-BLOCK element into Beamer code.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -322,16 +327,16 @@ channel."
;;;; Export Snippet
-(defun org-e-beamer-export-snippet (export-snippet contents info)
+(defun org-beamer-export-snippet (export-snippet contents info)
"Transcode an EXPORT-SNIPPET object into Beamer code.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let ((backend (org-export-snippet-backend export-snippet))
(value (org-element-property :value export-snippet)))
- ;; Only "e-latex" and "e-beamer" snippets are retained.
- (cond ((eq backend 'e-latex) value)
- ;; Ignore "e-beamer" snippets specifying overlays.
- ((and (eq backend 'e-beamer)
+ ;; Only "latex" and "beamer" snippets are retained.
+ (cond ((eq backend 'latex) value)
+ ;; Ignore "beamer" snippets specifying overlays.
+ ((and (eq backend 'beamer)
(or (org-export-get-previous-element export-snippet info)
(not (string-match "\\`<.*>\\'" value))))
value))))
@@ -340,19 +345,19 @@ channel."
;;;; Headline
;;
;; The main function to translate an headline is
-;; `org-e-beamer-headline'.
+;; `org-beamer-headline'.
;;
;; Depending on the level at which an headline is considered as
-;; a frame (given by `org-e-beamer--frame-level'), the headline is
-;; either a section (`org-e-beamer--format-section'), a frame
-;; (`org-e-beamer--format-frame') or a block
-;; (`org-e-beamer--format-block').
+;; a frame (given by `org-beamer--frame-level'), the headline is
+;; either a section (`org-beamer--format-section'), a frame
+;; (`org-beamer--format-frame') or a block
+;; (`org-beamer--format-block').
;;
-;; `org-e-beamer-headline' also takes care of special environments
+;; `org-beamer-headline' also takes care of special environments
;; like "ignoreheading", "note", "noteNH", "appendix" and
;; "againframe".
-(defun org-e-beamer--get-label (headline info)
+(defun org-beamer--get-label (headline info)
"Return label for HEADLINE, as a string.
INFO is a plist used as a communication channel.
@@ -369,7 +374,7 @@ function assumes HEADLINE will be treated as a frame."
(org-export-get-headline-number headline info)
"-")))))
-(defun org-e-beamer--frame-level (headline info)
+(defun org-beamer--frame-level (headline info)
"Return frame level in subtree containing HEADLINE.
INFO is a plist used as a communication channel."
(or
@@ -387,23 +392,22 @@ INFO is a plist used as a communication channel."
(and env (member (downcase env) '("frame" "fullframe"))
(org-export-get-relative-level headline info)))
;; 3. Look for "frame" environment in sub-tree.
- (org-element-map
- headline 'headline
- (lambda (hl)
- (let ((env (org-element-property :beamer-env hl)))
- (when (and env (member (downcase env) '("frame" "fullframe")))
- (org-export-get-relative-level hl info))))
- info 'first-match)
+ (org-element-map headline 'headline
+ (lambda (hl)
+ (let ((env (org-element-property :beamer-env hl)))
+ (when (and env (member (downcase env) '("frame" "fullframe")))
+ (org-export-get-relative-level hl info))))
+ info 'first-match)
;; 4. No "frame" environment in tree: use default value.
(plist-get info :headline-levels)))
-(defun org-e-beamer--format-section (headline contents info)
+(defun org-beamer--format-section (headline contents info)
"Format HEADLINE as a sectioning part.
CONTENTS holds the contents of the headline. INFO is a plist
used as a communication channel."
- ;; Use `e-latex' back-end output, inserting overlay specifications
+ ;; Use `latex' back-end output, inserting overlay specifications
;; if possible.
- (let ((latex-headline (org-export-with-backend 'e-latex headline contents info))
+ (let ((latex-headline (org-export-with-backend 'latex headline contents info))
(mode-specs (org-element-property :beamer-act headline)))
(if (and mode-specs
(string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{"
@@ -413,14 +417,14 @@ used as a communication channel."
nil nil latex-headline 1)
latex-headline)))
-(defun org-e-beamer--format-frame (headline contents info)
+(defun org-beamer--format-frame (headline contents info)
"Format HEADLINE as a frame.
CONTENTS holds the contents of the headline. INFO is a plist
used as a communication channel."
(let ((fragilep
;; FRAGILEP is non-nil when HEADLINE contains an element
- ;; among `org-e-beamer-verbatim-elements'.
- (org-element-map headline org-e-beamer-verbatim-elements 'identity
+ ;; among `org-beamer-verbatim-elements'.
+ (org-element-map headline org-beamer-verbatim-elements 'identity
info 'first-match)))
(concat "\\begin{frame}"
;; Overlay specification, if any. When surrounded by
@@ -430,15 +434,15 @@ used as a communication channel."
(cond
((not action) "")
((string-match "\\`\\[.*\\]\\'" action )
- (org-e-beamer--normalize-argument action 'defaction))
- (t (org-e-beamer--normalize-argument action 'action))))
+ (org-beamer--normalize-argument action 'defaction))
+ (t (org-beamer--normalize-argument action 'action))))
;; Options, if any.
(let* ((beamer-opt (org-element-property :beamer-opt headline))
(options
;; Collect options from default value and headline's
;; properties. Also add a label for links.
(append
- (org-split-string org-e-beamer-frame-default-options ",")
+ (org-split-string org-beamer-frame-default-options ",")
(and beamer-opt
(org-split-string
;; Remove square brackets if user provided
@@ -452,9 +456,9 @@ used as a communication channel."
(string-match "\\(^\\|,\\)label=" beamer-opt))
(list
(format "label=%s"
- (org-e-beamer--get-label headline info)))))))
+ (org-beamer--get-label headline info)))))))
;; Change options list into a string.
- (org-e-beamer--normalize-argument
+ (org-beamer--normalize-argument
(mapconcat
'identity
(if (or (not fragilep) (member "fragile" options)) options
@@ -479,7 +483,7 @@ used as a communication channel."
(replace-regexp-in-string "\\`\n*" "\\& " contents))
"\\end{frame}")))
-(defun org-e-beamer--format-block (headline contents info)
+(defun org-beamer--format-block (headline contents info)
"Format HEADLINE as a block.
CONTENTS holds the contents of the headline. INFO is a plist
used as a communication channel."
@@ -498,13 +502,13 @@ used as a communication channel."
(t (downcase env)))))
(env-format (unless (member environment '("column" "columns"))
(assoc environment
- (append org-e-beamer-environments-special
- org-e-beamer-environments-extra
- org-e-beamer-environments-default))))
+ (append org-beamer-environments-special
+ org-beamer-environments-extra
+ org-beamer-environments-default))))
(title (org-export-data (org-element-property :title headline) info))
(options (let ((options (org-element-property :beamer-opt headline)))
(if (not options) ""
- (org-e-beamer--normalize-argument options 'option))))
+ (org-beamer--normalize-argument options 'option))))
;; Start a "columns" environment when explicitly requested or
;; when there is no previous headline or the previous
;; headline do not have a BEAMER_column property.
@@ -559,10 +563,10 @@ used as a communication channel."
((not action) (list (cons "a" "") (cons "A" "")))
((string-match "\\`\\[.*\\]\\'" action)
(list
- (cons "A" (org-e-beamer--normalize-argument action 'defaction))
+ (cons "A" (org-beamer--normalize-argument action 'defaction))
(cons "a" "")))
(t
- (list (cons "a" (org-e-beamer--normalize-argument action 'action))
+ (list (cons "a" (org-beamer--normalize-argument action 'action))
(cons "A" "")))))
(list (cons "o" options)
(cons "h" title)
@@ -575,13 +579,13 @@ used as a communication channel."
(when column-width "\\end{column}\n")
(when end-columns-p "\\end{columns}"))))
-(defun org-e-beamer-headline (headline contents info)
+(defun org-beamer-headline (headline contents info)
"Transcode HEADLINE element into Beamer code.
CONTENTS is the contents of the headline. INFO is a plist used
as a communication channel."
(unless (org-element-property :footnote-section-p headline)
(let ((level (org-export-get-relative-level headline info))
- (frame-level (org-e-beamer--frame-level headline info))
+ (frame-level (org-beamer--frame-level headline info))
(environment (let ((env (org-element-property :beamer-env headline)))
(if (stringp env) (downcase env) "block"))))
(cond
@@ -595,14 +599,14 @@ as a communication channel."
;; Overlay specification.
(let ((overlay (org-element-property :beamer-act headline)))
(when overlay
- (org-e-beamer--normalize-argument
+ (org-beamer--normalize-argument
overlay
(if (string-match "^\\[.*\\]$" overlay) 'defaction
'action))))
;; Options.
(let ((options (org-element-property :beamer-opt headline)))
(when options
- (org-e-beamer--normalize-argument options 'option)))
+ (org-beamer--normalize-argument options 'option)))
;; Resolve reference provided by "BEAMER_ref"
;; property. This is done by building a minimal fake
;; link and calling the appropriate resolve function,
@@ -621,7 +625,7 @@ as a communication channel."
(org-export-resolve-id-link link info))))
;; Now use user-defined label provided in TARGET
;; headline, or fallback to standard one.
- (format "{%s}" (org-e-beamer--get-label target info)))))))
+ (format "{%s}" (org-beamer--get-label target info)))))))
;; Case 2: Creation of an appendix is requested.
((equal environment "appendix")
(concat "\\appendix"
@@ -644,25 +648,25 @@ as a communication channel."
(org-trim contents))))
;; Case 5: HEADLINE is a frame.
((= level frame-level)
- (org-e-beamer--format-frame headline contents info))
+ (org-beamer--format-frame headline contents info))
;; Case 6: Regular section, extracted from
- ;; `org-e-latex-classes'.
+ ;; `org-latex-classes'.
((< level frame-level)
- (org-e-beamer--format-section headline contents info))
+ (org-beamer--format-section headline contents info))
;; Case 7: Otherwise, HEADLINE is a block.
- (t (org-e-beamer--format-block headline contents info))))))
+ (t (org-beamer--format-block headline contents info))))))
;;;; Item
-(defun org-e-beamer-item (item contents info)
+(defun org-beamer-item (item contents info)
"Transcode an ITEM element into Beamer code.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let ((action (let ((first-element (car (org-element-contents item))))
(and (eq (org-element-type first-element) 'paragraph)
- (org-e-beamer--element-has-overlay-p first-element))))
- (output (org-export-with-backend 'e-latex item contents info)))
+ (org-beamer--element-has-overlay-p first-element))))
+ (output (org-export-with-backend 'latex item contents info)))
(if (not action) output
;; If the item starts with a paragraph and that paragraph starts
;; with an export snippet specifying an overlay, insert it after
@@ -672,14 +676,14 @@ contextual information."
;;;; Keyword
-(defun org-e-beamer-keyword (keyword contents info)
+(defun org-beamer-keyword (keyword contents info)
"Transcode a KEYWORD element into Beamer code.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let ((key (org-element-property :key keyword))
(value (org-element-property :value keyword)))
;; Handle specifically BEAMER and TOC (headlines only) keywords.
- ;; Otherwise, fallback to `e-latex' back-end.
+ ;; Otherwise, fallback to `latex' back-end.
(cond
((equal key "BEAMER") value)
((and (equal key "TOC") (string-match "\\<headlines\\>" value))
@@ -693,12 +697,12 @@ channel."
(when (wholenump depth) (format "\\setcounter{tocdepth}{%s}\n" depth))
"\\tableofcontents" options "\n"
"\\end{frame}")))
- (t (org-export-with-backend 'e-latex keyword contents info)))))
+ (t (org-export-with-backend 'latex keyword contents info)))))
;;;; Link
-(defun org-e-beamer-link (link contents info)
+(defun org-beamer-link (link contents info)
"Transcode a LINK object into Beamer code.
CONTENTS is the description part of the link. INFO is a plist
used as a communication channel."
@@ -710,7 +714,7 @@ used as a communication channel."
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "\\hyperlink%s{%s}{%s}"
- (or (org-e-beamer--element-has-overlay-p link) "")
+ (or (org-beamer--element-has-overlay-p link) "")
(org-export-solidify-link-text path)
(org-export-data (org-element-contents destination) info)))))
((and (member type '("custom-id" "fuzzy" "id"))
@@ -729,18 +733,18 @@ used as a communication channel."
(if (and (plist-get info :section-numbers) (not contents))
(format "\\ref{%s}" label)
(format "\\hyperlink%s{%s}{%s}"
- (or (org-e-beamer--element-has-overlay-p link) "")
+ (or (org-beamer--element-has-overlay-p link) "")
label
contents))))
(target
(let ((path (org-export-solidify-link-text path)))
(if (not contents) (format "\\ref{%s}" path)
(format "\\hyperlink%s{%s}{%s}"
- (or (org-e-beamer--element-has-overlay-p link) "")
+ (or (org-beamer--element-has-overlay-p link) "")
path
contents))))))))
- ;; Otherwise, use `e-latex' back-end.
- (t (org-export-with-backend 'e-latex link contents info)))))
+ ;; Otherwise, use `latex' back-end.
+ (t (org-export-with-backend 'latex link contents info)))))
;;;; Plain List
@@ -748,7 +752,7 @@ used as a communication channel."
;; Plain lists support `:environment', `:overlay' and `:options'
;; attributes.
-(defun org-e-beamer-plain-list (plain-list contents info)
+(defun org-beamer-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element into Beamer code.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -759,16 +763,16 @@ contextual information."
((eq type 'ordered) "enumerate")
((eq type 'descriptive) "description")
(t "itemize")))))
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
plain-list
(format "\\begin{%s}%s%s\n%s\\end{%s}"
latex-type
;; Default overlay specification, if any.
- (org-e-beamer--normalize-argument
+ (org-beamer--normalize-argument
(format "%s" (or (plist-get attributes :overlay) ""))
'defaction)
;; Second optional argument depends on the list type.
- (org-e-beamer--normalize-argument
+ (org-beamer--normalize-argument
(format "%s" (or (plist-get attributes :options) ""))
'option)
;; Eventually insert contents and close environment.
@@ -778,12 +782,12 @@ contextual information."
;;;; Radio Target
-(defun org-e-beamer-radio-target (radio-target text info)
+(defun org-beamer-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object into Beamer code.
TEXT is the text of the target. INFO is a plist holding
contextual information."
(format "\\hypertarget%s{%s}{%s}"
- (or (org-e-beamer--element-has-overlay-p radio-target) "")
+ (or (org-beamer--element-has-overlay-p radio-target) "")
(org-export-solidify-link-text
(org-element-property :value radio-target))
text))
@@ -791,7 +795,7 @@ contextual information."
;;;; Target
-(defun org-e-beamer-target (target contents info)
+(defun org-beamer-target (target contents info)
"Transcode a TARGET object into Beamer code.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -801,10 +805,10 @@ information."
;;;; Template
;;
-;; Template used is similar to the one used in `e-latex' back-end,
+;; Template used is similar to the one used in `latex' back-end,
;; excepted for the table of contents and Beamer themes.
-(defun org-e-beamer-template (contents info)
+(defun org-beamer-template (contents info)
"Return complete document string after Beamer conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
@@ -817,7 +821,7 @@ holding export options."
(let ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
- (let* ((header (nth 1 (assoc class org-e-latex-classes)))
+ (let* ((header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
@@ -825,8 +829,8 @@ holding export options."
"^[ \t]*\\\\documentclass\\(\\(\\[.*\\]\\)?\\)"
class-options header t nil 1)))))
(when document-class-string
- (org-e-latex--guess-babel-language
- (org-e-latex--guess-inputenc
+ (org-latex--guess-babel-language
+ (org-latex--guess-inputenc
(org-splice-latex-header
document-class-string
org-export-latex-default-packages-alist ; defined in org.el
@@ -868,9 +872,17 @@ holding export options."
(author (format "\\author{%s}\n" author))
(t "\\author{}\n")))
;; 6. Date.
- (let ((date (and (plist-get info :with-date)
- (org-export-data (plist-get info :date) info))))
- (format "\\date{%s}\n" (or date "")))
+ (let ((date (and (plist-get info :with-date) (plist-get info :date))))
+ (format "\\date{%s}\n"
+ (cond ((not date) "")
+ ;; If `:date' consists in a single timestamp and
+ ;; `:date-format' is provided, apply it.
+ ((and (plist-get info :date-format)
+ (not (cdr date))
+ (eq (org-element-type (car date)) 'timestamp))
+ (org-timestamp-format
+ (car date) (plist-get info :date-format)))
+ (t (org-export-data date info)))))
;; 7. Title
(format "\\title{%s}\n" title)
;; 8. Hyperref options.
@@ -885,19 +897,19 @@ holding export options."
;; 10. Title command.
(org-element-normalize-string
(cond ((string= "" title) nil)
- ((not (stringp org-e-latex-title-command)) nil)
+ ((not (stringp org-latex-title-command)) nil)
((string-match "\\(?:[^%]\\|^\\)%s"
- org-e-latex-title-command)
- (format org-e-latex-title-command title))
- (t org-e-latex-title-command)))
+ org-latex-title-command)
+ (format org-latex-title-command title))
+ (t org-latex-title-command)))
;; 11. Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat
(format "\\begin{frame}%s{%s}\n"
- (org-e-beamer--normalize-argument
- org-e-beamer-outline-frame-options 'option)
- org-e-beamer-outline-frame-title)
+ (org-beamer--normalize-argument
+ org-beamer-outline-frame-options 'option)
+ org-beamer-outline-frame-title)
(when (wholenump depth)
(format "\\setcounter{tocdepth}{%d}\n" depth))
"\\tableofcontents\n"
@@ -919,26 +931,26 @@ holding export options."
;;; Minor Mode
-(defvar org-e-beamer-mode-map (make-sparse-keymap)
- "The keymap for `org-e-beamer-mode'.")
-(define-key org-e-beamer-mode-map "\C-c\C-b" 'org-e-beamer-select-environment)
+(defvar org-beamer-mode-map (make-sparse-keymap)
+ "The keymap for `org-beamer-mode'.")
+(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment)
;;;###autoload
-(define-minor-mode org-e-beamer-mode
+(define-minor-mode org-beamer-mode
"Support for editing Beamer oriented Org mode files."
- nil " Bm" 'org-e-beamer-mode-map)
+ nil " Bm" 'org-beamer-mode-map)
(when (fboundp 'font-lock-add-keywords)
(font-lock-add-keywords
'org-mode
- '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-e-beamer-tag prepend))
+ '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
'prepend))
-(defface org-e-beamer-tag '((t (:box (:line-width 1 :color grey40))))
+(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
"The special face for beamer tags."
- :group 'org-export-e-beamer)
+ :group 'org-export-beamer)
-(defun org-e-beamer-property-changed (property value)
+(defun org-beamer-property-changed (property value)
"Track the BEAMER_env property with tags.
PROPERTY is the name of the modified property. VALUE is its new
value."
@@ -955,33 +967,33 @@ value."
((equal property "BEAMER_col")
(org-toggle-tag "BMCOL" (if (org-string-nw-p value) 'on 'off)))))
-(add-hook 'org-property-changed-functions 'org-e-beamer-property-changed)
+(add-hook 'org-property-changed-functions 'org-beamer-property-changed)
-(defun org-e-beamer-allowed-property-values (property)
+(defun org-beamer-allowed-property-values (property)
"Supply allowed values for PROPERTY."
(cond
((and (equal property "BEAMER_env")
(not (org-entry-get nil (concat property "_ALL") 'inherit)))
;; If no allowed values for BEAMER_env have been defined,
;; supply all defined environments
- (mapcar 'car (append org-e-beamer-environments-special
- org-e-beamer-environments-extra
- org-e-beamer-environments-default)))
+ (mapcar 'car (append org-beamer-environments-special
+ org-beamer-environments-extra
+ org-beamer-environments-default)))
((and (equal property "BEAMER_col")
(not (org-entry-get nil (concat property "_ALL") 'inherit)))
;; If no allowed values for BEAMER_col have been defined,
;; supply some
- (org-split-string org-e-beamer-column-widths " "))))
+ (org-split-string org-beamer-column-widths " "))))
(add-hook 'org-property-allowed-value-functions
- 'org-e-beamer-allowed-property-values)
+ 'org-beamer-allowed-property-values)
;;; Commands
;;;###autoload
-(defun org-e-beamer-export-as-latex
+(defun org-beamer-export-as-latex
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer buffer.
@@ -1008,30 +1020,30 @@ EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
-Export is done in a buffer named \"*Org E-BEAMER Export*\", which
+Export is done in a buffer named \"*Org BEAMER Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(if async
(org-export-async-start
(lambda (output)
- (with-current-buffer (get-buffer-create "*Org E-BEAMER Export*")
+ (with-current-buffer (get-buffer-create "*Org BEAMER Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(LaTeX-mode)
- (org-export-add-to-stack (current-buffer) 'e-beamer)))
- `(org-export-as 'e-beamer ,subtreep ,visible-only ,body-only
+ (org-export-add-to-stack (current-buffer) 'beamer)))
+ `(org-export-as 'beamer ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf (org-export-to-buffer
- 'e-beamer "*Org E-BEAMER Export*"
+ 'beamer "*Org BEAMER Export*"
subtreep visible-only body-only ext-plist)))
(with-current-buffer outbuf (LaTeX-mode))
(when org-export-show-temporary-export-buffer
(switch-to-buffer-other-window outbuf)))))
;;;###autoload
-(defun org-e-beamer-export-to-latex
+(defun org-beamer-export-to-latex
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer presentation (tex).
@@ -1063,16 +1075,16 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-beamer))
+ (lambda (f) (org-export-add-to-stack f 'beamer))
`(expand-file-name
(org-export-to-file
- 'e-beamer ,outfile ,subtreep ,visible-only ,body-only
+ 'beamer ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))
(org-export-to-file
- 'e-beamer outfile subtreep visible-only body-only ext-plist))))
+ 'beamer outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
-(defun org-e-beamer-export-to-pdf
+(defun org-beamer-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a Beamer presentation (PDF).
@@ -1104,18 +1116,18 @@ Return PDF file's name."
(if async
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-beamer))
+ (lambda (f) (org-export-add-to-stack f 'beamer))
`(expand-file-name
- (org-e-latex-compile
+ (org-latex-compile
(org-export-to-file
- 'e-beamer ,outfile ,subtreep ,visible-only ,body-only
+ 'beamer ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
- (org-e-latex-compile
- (org-e-beamer-export-to-latex
+ (org-latex-compile
+ (org-beamer-export-to-latex
nil subtreep visible-only body-only ext-plist))))
;;;###autoload
-(defun org-e-beamer-select-environment ()
+(defun org-beamer-select-environment ()
"Select the environment to be used by beamer for this entry.
While this uses (for convenience) a tag selection interface, the
result of this command will be that the BEAMER_env *property* of
@@ -1124,11 +1136,11 @@ the entry is set.
In addition to this, the command will also set a tag as a visual
aid, but the tag does not have any semantic meaning."
(interactive)
- ;; Make sure `org-e-beamer-environments-special' has a higher
- ;; priority than `org-e-beamer-environments-extra'.
- (let* ((envs (append org-e-beamer-environments-special
- org-e-beamer-environments-extra
- org-e-beamer-environments-default))
+ ;; Make sure `org-beamer-environments-special' has a higher
+ ;; priority than `org-beamer-environments-extra'.
+ (let* ((envs (append org-beamer-environments-special
+ org-beamer-environments-extra
+ org-beamer-environments-default))
(org-tag-alist
(append '((:startgroup))
(mapcar (lambda (e) (cons (concat "B_" (car e))
@@ -1163,7 +1175,7 @@ aid, but the tag does not have any semantic meaning."
(t (org-entry-delete nil "BEAMER_env"))))))
;;;###autoload
-(defun org-e-beamer-insert-options-template (&optional kind)
+(defun org-beamer-insert-options-template (&optional kind)
"Insert a settings template, to make sure users do this right."
(interactive (progn
(message "Current [s]ubtree or [g]lobal?")
@@ -1176,19 +1188,18 @@ aid, but the tag does not have any semantic meaning."
(org-entry-put nil "EXPORT_LaTeX_CLASS" "beamer")
(org-entry-put nil "EXPORT_LaTeX_CLASS_OPTIONS" "[presentation]")
(org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
- (when org-e-beamer-column-view-format
- (org-entry-put nil "COLUMNS" org-e-beamer-column-view-format))
- (org-entry-put nil "BEAMER_col_ALL" org-e-beamer-column-widths))
+ (when org-beamer-column-view-format
+ (org-entry-put nil "COLUMNS" org-beamer-column-view-format))
+ (org-entry-put nil "BEAMER_col_ALL" org-beamer-column-widths))
(insert "#+LaTeX_CLASS: beamer\n")
(insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
- (when org-e-beamer-theme
- (insert "#+BEAMER_THEME: " org-e-beamer-theme "\n"))
- (when org-e-beamer-column-view-format
- (insert "#+COLUMNS: " org-e-beamer-column-view-format "\n"))
- (insert "#+PROPERTY: BEAMER_col_ALL " org-e-beamer-column-widths "\n")))
+ (when org-beamer-theme (insert "#+BEAMER_THEME: " org-beamer-theme "\n"))
+ (when org-beamer-column-view-format
+ (insert "#+COLUMNS: " org-beamer-column-view-format "\n"))
+ (insert "#+PROPERTY: BEAMER_col_ALL " org-beamer-column-widths "\n")))
;;;###autoload
-(defun org-e-beamer-publish-to-latex (plist filename pub-dir)
+(defun org-beamer-publish-to-latex (plist filename pub-dir)
"Publish an Org file to a Beamer presentation (LaTeX).
FILENAME is the filename of the Org file to be published. PLIST
@@ -1196,10 +1207,10 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to 'e-beamer filename ".tex" plist pub-dir))
+ (org-publish-org-to 'beamer filename ".tex" plist pub-dir))
;;;###autoload
-(defun org-e-beamer-publish-to-pdf (plist filename pub-dir)
+(defun org-beamer-publish-to-pdf (plist filename pub-dir)
"Publish an Org file to a Beamer presentation (PDF, via LaTeX).
FILENAME is the filename of the Org file to be published. PLIST
@@ -1207,13 +1218,18 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- ;; Unlike to `org-e-beamer-publish-to-latex', PDF file is generated
- ;; in working directory and then moved to publishing directory.
- (org-e-publish-attachment
+ ;; Unlike to `org-beamer-publish-to-latex', PDF file is generated in
+ ;; working directory and then moved to publishing directory.
+ (org-publish-attachment
plist
- (org-e-latex-compile (org-e-publish-org-to 'e-beamer filename ".tex" plist))
+ (org-latex-compile (org-publish-org-to 'beamer filename ".tex" plist))
pub-dir))
-(provide 'org-e-beamer)
-;;; org-e-beamer.el ends here
+(provide 'ox-beamer)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-beamer.el ends here
diff --git a/contrib/lisp/org-e-html.el b/lisp/ox-html.el
index c08f25b..9c457e0 100644
--- a/contrib/lisp/org-e-html.el
+++ b/lisp/ox-html.el
@@ -1,4 +1,4 @@
-;;; org-e-html.el --- HTML Back-End For Org Export Engine
+;;; ox-html.el --- HTML Back-End for Org Export Engine
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
@@ -22,21 +22,19 @@
;; This library implements a HTML back-end for Org generic exporter.
-;; To test it, run
+;; To test it, run:
;;
-;; M-: (org-export-to-buffer 'e-html "*Test e-HTML*") RET
+;; M-x org-export-as-html
;;
-;; in an org-mode buffer then switch to the buffer to see the HTML
-;; export. See contrib/lisp/org-export.el for more details on how
-;; this exporter works.
+;; in an Org mode buffer. See ox.el for more details on how this
+;; exporter works.
;;; Code:
-;;; org-e-html.el
;;; Dependencies
-(require 'org-export)
-(require 'org-e-publish)
+(require 'ox)
+(require 'ox-publish)
(require 'format-spec)
(eval-when-compile (require 'cl) (require 'table))
@@ -52,104 +50,98 @@
;;; Define Back-End
-(org-export-define-backend e-html
- ((bold . org-e-html-bold)
- (center-block . org-e-html-center-block)
- (clock . org-e-html-clock)
- (code . org-e-html-code)
- (drawer . org-e-html-drawer)
- (dynamic-block . org-e-html-dynamic-block)
- (entity . org-e-html-entity)
- (example-block . org-e-html-example-block)
- (export-block . org-e-html-export-block)
- (export-snippet . org-e-html-export-snippet)
- (fixed-width . org-e-html-fixed-width)
- (footnote-definition . org-e-html-footnote-definition)
- (footnote-reference . org-e-html-footnote-reference)
- (headline . org-e-html-headline)
- (horizontal-rule . org-e-html-horizontal-rule)
- (inline-src-block . org-e-html-inline-src-block)
- (inlinetask . org-e-html-inlinetask)
- (italic . org-e-html-italic)
- (item . org-e-html-item)
- (keyword . org-e-html-keyword)
- (latex-environment . org-e-html-latex-environment)
- (latex-fragment . org-e-html-latex-fragment)
- (line-break . org-e-html-line-break)
- (link . org-e-html-link)
- (paragraph . org-e-html-paragraph)
- (plain-list . org-e-html-plain-list)
- (plain-text . org-e-html-plain-text)
- (planning . org-e-html-planning)
- (property-drawer . org-e-html-property-drawer)
- (quote-block . org-e-html-quote-block)
- (quote-section . org-e-html-quote-section)
- (radio-target . org-e-html-radio-target)
- (section . org-e-html-section)
- (special-block . org-e-html-special-block)
- (src-block . org-e-html-src-block)
- (statistics-cookie . org-e-html-statistics-cookie)
- (strike-through . org-e-html-strike-through)
- (subscript . org-e-html-subscript)
- (superscript . org-e-html-superscript)
- (table . org-e-html-table)
- (table-cell . org-e-html-table-cell)
- (table-row . org-e-html-table-row)
- (target . org-e-html-target)
- (template . org-e-html-template)
- (timestamp . org-e-html-timestamp)
- (underline . org-e-html-underline)
- (verbatim . org-e-html-verbatim)
- (verse-block . org-e-html-verse-block))
+(org-export-define-backend html
+ ((bold . org-html-bold)
+ (center-block . org-html-center-block)
+ (clock . org-html-clock)
+ (code . org-html-code)
+ (drawer . org-html-drawer)
+ (dynamic-block . org-html-dynamic-block)
+ (entity . org-html-entity)
+ (example-block . org-html-example-block)
+ (export-block . org-html-export-block)
+ (export-snippet . org-html-export-snippet)
+ (fixed-width . org-html-fixed-width)
+ (footnote-definition . org-html-footnote-definition)
+ (footnote-reference . org-html-footnote-reference)
+ (headline . org-html-headline)
+ (horizontal-rule . org-html-horizontal-rule)
+ (inline-src-block . org-html-inline-src-block)
+ (inlinetask . org-html-inlinetask)
+ (italic . org-html-italic)
+ (item . org-html-item)
+ (keyword . org-html-keyword)
+ (latex-environment . org-html-latex-environment)
+ (latex-fragment . org-html-latex-fragment)
+ (line-break . org-html-line-break)
+ (link . org-html-link)
+ (paragraph . org-html-paragraph)
+ (plain-list . org-html-plain-list)
+ (plain-text . org-html-plain-text)
+ (planning . org-html-planning)
+ (property-drawer . org-html-property-drawer)
+ (quote-block . org-html-quote-block)
+ (quote-section . org-html-quote-section)
+ (radio-target . org-html-radio-target)
+ (section . org-html-section)
+ (special-block . org-html-special-block)
+ (src-block . org-html-src-block)
+ (statistics-cookie . org-html-statistics-cookie)
+ (strike-through . org-html-strike-through)
+ (subscript . org-html-subscript)
+ (superscript . org-html-superscript)
+ (table . org-html-table)
+ (table-cell . org-html-table-cell)
+ (table-row . org-html-table-row)
+ (target . org-html-target)
+ (template . org-html-template)
+ (timestamp . org-html-timestamp)
+ (underline . org-html-underline)
+ (verbatim . org-html-verbatim)
+ (verse-block . org-html-verse-block))
:export-block "HTML"
- :filters-alist ((:filter-final-output . org-e-html-final-function))
+ :filters-alist ((:filter-final-output . org-html-final-function))
:menu-entry
(?h "Export to HTML"
- ((?H "To temporary buffer" org-e-html-export-as-html)
- (?h "To file" org-e-html-export-to-html)
+ ((?H "To temporary buffer" org-html-export-as-html)
+ (?h "To file" org-html-export-to-html)
(?o "To file and open"
(lambda (a s v b)
- (if a (org-e-html-export-to-html t s v b)
- (org-open-file (org-e-html-export-to-html nil s v b)))))))
+ (if a (org-html-export-to-html t s v b)
+ (org-open-file (org-html-export-to-html nil s v b)))))))
:options-alist
- ;; FIXME: Prefix KEYWORD and OPTION with "HTML_". Prefix
- ;; corresponding properties with `:html-". If such a renaming is
- ;; taken up, some changes will be required in `org-jsinfo.el',
- ;; I think. So defer renaming for now.
- ((:agenda-style nil nil org-agenda-export-html-style)
- (:creator "CREATOR" nil org-e-html-creator-string)
- (:convert-org-links nil nil org-e-html-link-org-files-as-html)
- (:inline-images nil nil org-e-html-inline-images)
- (:link-home "LINK_HOME" nil org-e-html-link-home)
- (:link-up "LINK_UP" nil org-e-html-link-up)
- (:style nil nil org-e-html-style)
- (:style-extra "STYLE" nil org-e-html-style-extra newline)
- (:style-include-default nil nil org-e-html-style-include-default)
- (:style-include-scripts nil nil org-e-html-style-include-scripts)
- (:html-extension nil nil org-e-html-extension)
- (:html-postamble nil "html-postamble" org-e-html-postamble)
- (:html-preamble nil "html-preamble" org-e-html-preamble)
- (:html-table-tag nil nil org-e-html-table-tag)
- (:xml-declaration nil nil org-e-html-xml-declaration)
- (:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)
- (:mathjax "MATHJAX" nil "" space)))
+ ((:html-extension nil nil org-html-extension)
+ (:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
+ (:html-link-up "HTML_LINK_UP" nil org-html-link-up)
+ (:html-mathjax "HTML_MATHJAX" nil "" space)
+ (:html-postamble nil "html-postamble" org-html-postamble)
+ (:html-preamble nil "html-preamble" org-html-preamble)
+ (:html-style nil nil org-html-style)
+ (:html-style-extra "HTML_STYLE" nil org-html-style-extra newline)
+ (:html-style-include-default nil nil org-html-style-include-default)
+ (:html-style-include-scripts nil nil org-html-style-include-scripts)
+ (:html-table-tag nil nil org-html-table-tag)
+ ;; Redefine regular options.
+ (:creator "CREATOR" nil org-html-creator-string)
+ (:with-latex nil "tex" org-html-with-latex)
+ ;; Leave room for "ox-infojs.el" extension.
+ (:infojs-opt "INFOJS_OPT" nil nil)))
;;; Internal Variables
-(defvar org-e-html-format-table-no-css)
+(defvar org-html-format-table-no-css)
(defvar htmlize-buffer-places) ; from htmlize.el
-(defvar body-only) ; dynamically scoped into this.
-(defconst org-e-html-special-string-regexps
+(defconst org-html-special-string-regexps
'(("\\\\-" . "&shy;")
("---\\([^-]\\)" . "&mdash;\\1")
("--\\([^-]\\)" . "&ndash;\\1")
("\\.\\.\\." . "&hellip;"))
"Regular expressions for special string conversion.")
-(defconst org-e-html-scripts
+(defconst org-html-scripts
"<script type=\"text/javascript\">
/*
@licstart The following is the entire license notice for the
@@ -198,7 +190,7 @@ for the JavaScript code in this tag.
</script>"
"Basic JavaScript that is needed by HTML files produced by Org mode.")
-(defconst org-e-html-style-default
+(defconst org-html-style-default
"<style type=\"text/css\">
<!--/*--><![CDATA[/*><!--*/
html { font-family: Times, serif; font-size: 12pt; }
@@ -249,29 +241,29 @@ for the JavaScript code in this tag.
/*]]>*/-->
</style>"
"The default style specification for exported HTML files.
-Please use the variables `org-e-html-style' and
-`org-e-html-style-extra' to add to this style. If you wish to not
+Please use the variables `org-html-style' and
+`org-html-style-extra' to add to this style. If you wish to not
have the default style included, customize the variable
-`org-e-html-style-include-default'.")
+`org-html-style-include-default'.")
;;; User Configuration Variables
-(defgroup org-export-e-html nil
+(defgroup org-export-html nil
"Options for exporting Org mode files to HTML."
:tag "Org Export HTML"
:group 'org-export)
-(defgroup org-export-e-htmlize nil
+(defgroup org-export-htmlize nil
"Options for processing examples with htmlize.el."
:tag "Org Export Htmlize"
- :group 'org-export-e-html)
+ :group 'org-export-html)
;;;; Bold etc
-(defcustom org-e-html-text-markup-alist
+(defcustom org-html-text-markup-alist
'((bold . "<b>%s</b>")
(code . "<code>%s</code>")
(italic . "<i>%s</i>")
@@ -286,7 +278,7 @@ a formatting string to wrap fontified text with.
If no association can be found for a given markup, text will be
returned as-is."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(alist :key-type (symbol :tag "Markup type")
:value-type (string :tag "Format string"))
:options '(bold code italic strike-through underline verbatim))
@@ -294,15 +286,15 @@ returned as-is."
;;;; Debugging
-(defcustom org-e-html-pretty-output nil
+(defcustom org-html-pretty-output nil
"Enable this to generate pretty HTML."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;; Drawers
-(defcustom org-e-html-format-drawer-function nil
+(defcustom org-html-format-drawer-function nil
"Function called to format a drawer in HTML code.
The function must accept two parameters:
@@ -314,16 +306,16 @@ 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:
-\(defun org-e-html-format-drawer-default \(name contents\)
+\(defun org-html-format-drawer-default \(name contents\)
\"Format a drawer element for HTML export.\"
contents\)"
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'function)
;;;; Footnotes
-(defcustom org-e-html-footnotes-section "<div id=\"footnotes\">
+(defcustom org-html-footnotes-section "<div id=\"footnotes\">
<h2 class=\"footnotes\">%s: </h2>
<div id=\"text-footnotes\">
%s
@@ -333,24 +325,24 @@ in order to mimic default behaviour:
Should contain a two instances of %s. The first will be replaced with the
language-specific word for \"Footnotes\", the second one will be replaced
by the footnotes themselves."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
-(defcustom org-e-html-footnote-format "<sup>%s</sup>"
+(defcustom org-html-footnote-format "<sup>%s</sup>"
"The format for the footnote reference.
%s will be replaced by the footnote reference itself."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
-(defcustom org-e-html-footnote-separator "<sup>, </sup>"
+(defcustom org-html-footnote-separator "<sup>, </sup>"
"Text used to separate footnotes."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;;; Headline
-(defcustom org-e-html-toplevel-hlevel 2
+(defcustom org-html-toplevel-hlevel 2
"The <H> level for level 1 headings in HTML export.
This is also important for the classes that will be wrapped around headlines
and outline structure. If this variable is 1, the top-level headlines will
@@ -358,10 +350,10 @@ be <h1>, and the corresponding classes will be outline-1, section-number-1,
and outline-text-1. If this is 2, all of these will get a 2 instead.
The default for this variable is 2, because we use <h1> for formatting the
document title."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'integer)
-(defcustom org-e-html-format-headline-function nil
+(defcustom org-html-format-headline-function nil
"Function to format headline text.
This function will be called with 5 arguments:
@@ -376,7 +368,7 @@ 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:
-\(defun org-e-html-format-headline \(todo todo-type priority text tags)
+\(defun org-html-format-headline \(todo todo-type priority text tags)
\"Default format function for an headline.\"
\(concat \(when todo
\(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo))
@@ -384,23 +376,23 @@ order to reproduce the default set-up:
\(format \"\\\\framebox{\\\\#%c} \" priority))
text
\(when tags (format \"\\\\hfill{}\\\\textsc{%s}\" tags))))"
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'function)
;;;; HTML-specific
-(defcustom org-e-html-allow-name-attribute-in-anchors t
+(defcustom org-html-allow-name-attribute-in-anchors t
"When nil, do not set \"name\" attribute in anchors.
By default, anchors are formatted with both \"id\" and \"name\"
attributes, when appropriate."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;; Inlinetasks
-(defcustom org-e-html-format-inlinetask-function nil
+(defcustom org-html-format-inlinetask-function nil
"Function called to format an inlinetask in HTML code.
The function must accept six parameters:
@@ -416,7 +408,7 @@ 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:
-\(defun org-e-html-format-inlinetask \(todo type priority name tags contents\)
+\(defun org-html-format-inlinetask \(todo type priority name tags contents\)
\"Format an inline task element for HTML export.\"
\(let \(\(full-title
\(concat
@@ -434,13 +426,42 @@ in order to mimic default behaviour:
\"\\\\end{minipage}}\"
\"\\\\end{center}\")
full-title contents))"
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'function)
+;;;; LaTeX
+
+(defcustom org-html-with-latex org-export-with-latex
+ "Non-nil means process LaTeX math snippets.
+
+When set, the exporter will process LaTeX environments and
+fragments.
+
+This option can also be set with the +OPTIONS line,
+e.g. \"tex:mathjax\". Allowed values are:
+
+nil Ignore math snippets.
+`verbatim' Keep everything in verbatim
+`dvipng' Process the LaTeX fragments to images. This will also
+ include processing of non-math environments.
+`imagemagick' Convert the LaTeX fragments to pdf files and use
+ imagemagick to convert pdf files to png files.
+`mathjax' Do MathJax preprocessing and arrange for MathJax.js to
+ be loaded.
+t Synonym for `mathjax'."
+ :group 'org-export-html
+ :type '(choice
+ (const :tag "Do not process math in any way" nil)
+ (const :tag "Use dvipng to make images" dvipng)
+ (const :tag "Use imagemagick to make images" imagemagick)
+ (const :tag "Use MathJax to display math" mathjax)
+ (const :tag "Leave math verbatim" verbatim)))
+
+
;;;; Links :: Generic
-(defcustom org-e-html-link-org-files-as-html t
+(defcustom org-html-link-org-files-as-html t
"Non-nil means make file links to `file.org' point to `file.html'.
When org-mode is exporting an org-mode file to HTML, links to
non-html files are directly put into a href tag in HTML.
@@ -449,24 +470,24 @@ extension `.org.) should become links to the corresponding html
file, assuming that the linked org-mode file will also be
converted to HTML.
When nil, the links still point to the plain `.org' file."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;; Links :: Inline images
-(defcustom org-e-html-inline-images 'maybe
+(defcustom org-html-inline-images 'maybe
"Non-nil means inline images into exported HTML pages.
This is done using an <img> tag. When nil, an anchor with href is used to
link to the image. If this option is `maybe', then images in links with
an empty description will be inlined, while images with a description will
be linked only."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(choice (const :tag "Never" nil)
(const :tag "Always" t)
(const :tag "When there is no description" maybe)))
-(defcustom org-e-html-inline-image-rules
+(defcustom org-html-inline-image-rules
'(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
@@ -481,26 +502,26 @@ depend on the way the HTML file is processed. When used with
pdflatex, 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."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
;;;; Plain Text
-(defcustom org-e-html-protect-char-alist
+(defcustom org-html-protect-char-alist
'(("&" . "&amp;")
("<" . "&lt;")
(">" . "&gt;"))
- "Alist of characters to be converted by `org-e-html-protect'."
- :group 'org-export-e-html
+ "Alist of characters to be converted by `org-html-protect'."
+ :group 'org-export-html
:type '(repeat (cons (string :tag "Character")
(string :tag "HTML equivalent"))))
;;;; Src Block
-(defcustom org-export-e-htmlize-output-type 'inline-css
+(defcustom org-export-htmlize-output-type 'inline-css
"Output type to be used by htmlize when formatting code snippets.
Choices are `css', to export the CSS selectors only, or `inline-css', to
export the CSS attribute values inline in the HTML. We use as default
@@ -515,16 +536,16 @@ a style file to define the look of these classes.
To get a start for your css file, start Emacs session and make sure that
all the faces you are interested in are defined, for example by loading files
in all modes you want. Then, use the command
-\\[org-export-e-htmlize-generate-css] to extract class definitions."
- :group 'org-export-e-htmlize
+\\[org-export-htmlize-generate-css] to extract class definitions."
+ :group 'org-export-htmlize
:type '(choice (const css) (const inline-css)))
-(defcustom org-export-e-htmlize-css-font-prefix "org-"
+(defcustom org-export-htmlize-font-prefix "org-"
"The prefix for CSS class names for htmlize font specifications."
- :group 'org-export-e-htmlize
+ :group 'org-export-htmlize
:type 'string)
-(defcustom org-export-e-htmlized-org-css-url nil
+(defcustom org-export-htmlized-org-css-url nil
"URL pointing to a CSS file defining text colors for htmlized Emacs buffers.
Normally when creating an htmlized version of an Org buffer, htmlize will
create CSS to define the font colors. However, this does not work when
@@ -533,7 +554,7 @@ with different fontification setup work on the same website.
When this variable is non-nil, creating an htmlized version of an Org buffer
using `org-export-as-org' will remove the internal CSS section and replace it
with a link to this URL."
- :group 'org-export-e-htmlize
+ :group 'org-export-htmlize
:type '(choice
(const :tag "Keep internal css" nil)
(string :tag "URL or local href")))
@@ -541,34 +562,34 @@ with a link to this URL."
;;;; Table
-(defcustom org-e-html-table-tag
+(defcustom org-html-table-tag
"<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">"
"The HTML tag that is used to start a table.
This must be a <table> tag, but you may change the options like
borders and spacing."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
-(defcustom org-e-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
+(defcustom org-html-table-header-tags '("<th scope=\"%s\"%s>" . "</th>")
"The opening tag for table header fields.
This is customizable so that alignment options can be specified.
The first %s will be filled with the scope of the field, either row or col.
The second %s will be replaced by a style entry to align the field.
-See also the variable `org-e-html-table-use-header-tags-for-first-column'.
-See also the variable `org-e-html-table-align-individual-fields'."
+See also the variable `org-html-table-use-header-tags-for-first-column'.
+See also the variable `org-html-table-align-individual-fields'."
:group 'org-export-tables ; FIXME: change group?
:type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
-(defcustom org-e-html-table-data-tags '("<td%s>" . "</td>")
+(defcustom org-html-table-data-tags '("<td%s>" . "</td>")
"The opening tag for table data fields.
This is customizable so that alignment options can be specified.
The first %s will be filled with the scope of the field, either row or col.
The second %s will be replaced by a style entry to align the field.
-See also the variable `org-e-html-table-align-individual-fields'."
+See also the variable `org-html-table-align-individual-fields'."
:group 'org-export-tables
:type '(cons (string :tag "Opening tag") (string :tag "Closing tag")))
-(defcustom org-e-html-table-row-tags '("<tr>" . "</tr>")
+(defcustom org-html-table-row-tags '("<tr>" . "</tr>")
"The opening tag for table data fields.
This is customizable so that alignment options can be specified.
Instead of strings, these can be Lisp forms that will be evaluated
@@ -577,7 +598,7 @@ the variable `head' will be true when this is a header line, nil when this
is a body line. And the variable `nline' will contain the line number,
starting from 1 in the first header line. For example
- (setq org-e-html-table-row-tags
+ (setq org-html-table-row-tags
(cons '(if head
\"<tr>\"
(if (= (mod nline 2) 1)
@@ -595,7 +616,7 @@ will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
(string :tag "Specify")
(sexp))))
-(defcustom org-e-html-table-align-individual-fields t
+(defcustom org-html-table-align-individual-fields t
"Non-nil means attach style attributes for alignment to each table field.
When nil, alignment will only be specified in the column tags, but this
is ignored by some browsers (like Firefox, Safari). Opera does it right
@@ -603,64 +624,64 @@ though."
:group 'org-export-tables
:type 'boolean)
-(defcustom org-e-html-table-use-header-tags-for-first-column nil
+(defcustom org-html-table-use-header-tags-for-first-column nil
"Non-nil means format column one in tables with header tags.
When nil, also column one will use data tags."
:group 'org-export-tables
:type 'boolean)
-(defcustom org-e-html-table-caption-above t
+(defcustom org-html-table-caption-above t
"When non-nil, place caption string at the beginning of the table.
Otherwise, place it near the end."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;; Tags
-(defcustom org-e-html-tag-class-prefix ""
+(defcustom org-html-tag-class-prefix ""
"Prefix to class names for TODO keywords.
Each tag gets a class given by the tag itself, with this prefix.
The default prefix is empty because it is nice to just use the keyword
as a class name. But if you get into conflicts with other, existing
CSS classes, then this prefix can be very useful."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;;; Template :: Generic
-(defcustom org-e-html-extension "html"
+(defcustom org-html-extension "html"
"The extension for exported HTML files."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
-(defcustom org-e-html-xml-declaration
+(defcustom org-html-xml-declaration
'(("html" . "<?xml version=\"1.0\" encoding=\"%s\"?>")
("php" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\"; ?>"))
"The extension for exported HTML files.
%s will be replaced with the charset of the exported file.
This may be a string, or an alist with export extensions
and corresponding declarations."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(choice
(string :tag "Single declaration")
(repeat :tag "Dependent on extension"
(cons (string :tag "Extension")
(string :tag "Declaration")))))
-(defcustom org-e-html-coding-system 'utf-8
+(defcustom org-html-coding-system 'utf-8
"Coding system for HTML export.
Use utf-8 as the default value."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'coding-system)
-(defcustom org-e-html-divs '("preamble" "content" "postamble")
+(defcustom org-html-divs '("preamble" "content" "postamble")
"The name of the main divs for HTML export.
This is a list of three strings, the first one for the preamble
DIV, the second one for the content DIV and the third one for the
postamble DIV."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(list
(string :tag " Div for the preamble:")
(string :tag " Div for the content:")
@@ -669,7 +690,7 @@ postamble DIV."
;;;; Template :: Mathjax
-(defcustom org-e-html-mathjax-options
+(defcustom org-html-mathjax-options
'((path "http://orgmode.org/mathjax/MathJax.js")
(scale "100")
(align "center")
@@ -689,7 +710,7 @@ mathml Should a MathML player be used if available?
You can also customize this for each buffer, using something like
#+MATHJAX: scale:\"133\" align:\"right\" mathml:t path:\"/MathJax/\""
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(list :greedy t
(list :tag "path (the path from where to load MathJax.js)"
(const :format " " path) (string))
@@ -702,7 +723,7 @@ You can also customize this for each buffer, using something like
(list :tag "mathml (should MathML display be used is possible)"
(const :format " " mathml) (boolean))))
-(defcustom org-e-html-mathjax-template
+(defcustom org-html-mathjax-template
"<script type=\"text/javascript\" src=\"%PATH\">
<!--/*--><![CDATA[/*><!--*/
MathJax.Hub.Config({
@@ -745,19 +766,19 @@ You can also customize this for each buffer, using something like
/*]]>*///-->
</script>"
"The MathJax setup for XHTML files."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;;; Template :: Postamble
-(defcustom org-e-html-postamble 'auto
+(defcustom org-html-postamble 'auto
"Non-nil means insert a postamble in HTML export.
When `t', insert a string as defined by the formatting string in
-`org-e-html-postamble-format'. When set to a string, this
-string overrides `org-e-html-postamble-format'. When set to
-'auto, discard `org-e-html-postamble-format' and honor
+`org-html-postamble-format'. When set to a string, this
+string overrides `org-html-postamble-format'. When set to
+'auto, discard `org-html-postamble-format' and honor
`org-export-author/email/creator-info' variables. When set to a
function, apply this function and insert the returned string.
The function takes the property list of export options as its
@@ -765,14 +786,14 @@ only argument.
Setting :html-postamble in publishing projects will take
precedence over this variable."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(choice (const :tag "No postamble" nil)
(const :tag "Auto preamble" 'auto)
(const :tag "Default formatting string" t)
(string :tag "Custom formatting string")
(function :tag "Function (must return a string)")))
-(defcustom org-e-html-postamble-format
+(defcustom org-html-postamble-format
'(("en" "<p class=\"author\">Author: %a (%e)</p>
<p class=\"date\">Date: %d</p>
<p class=\"creator\">Generated by %c</p>
@@ -789,50 +810,50 @@ postamble itself. This format string can contain these elements:
%e stands for the author's email.
%d stands for the date.
%c will be replaced by information about Org/Emacs versions.
- %v will be replaced by `org-e-html-validation-link'.
+ %v will be replaced by `org-html-validation-link'.
If you need to use a \"%\" character, you need to escape it
like that: \"%%\"."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(alist :key-type (string :tag "Language")
:value-type (string :tag "Format string")))
-(defcustom org-e-html-validation-link
+(defcustom org-html-validation-link
"<a href=\"http://validator.w3.org/check?uri=referer\">Validate XHTML 1.0</a>"
"Link to HTML validation service."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
-(defcustom org-e-html-creator-string
+(defcustom org-html-creator-string
(format "Generated by <a href=\"http://orgmode.org\">Org</a> mode %s in <a href=\"http://www.gnu.org/software/emacs/\">Emacs</a> %s."
(if (fboundp 'org-version) (org-version) "(Unknown)")
emacs-version)
"String to insert at the end of the HTML document."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(string :tag "Creator string"))
;;;; Template :: Preamble
-(defcustom org-e-html-preamble t
+(defcustom org-html-preamble t
"Non-nil means insert a preamble in HTML export.
When `t', insert a string as defined by one of the formatting
-strings in `org-e-html-preamble-format'. When set to a
-string, this string overrides `org-e-html-preamble-format'.
+strings in `org-html-preamble-format'. When set to a
+string, this string overrides `org-html-preamble-format'.
When set to a function, apply this function and insert the
returned string. The function takes the property list of export
options as its only argument.
Setting :html-preamble in publishing projects will take
precedence over this variable."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(choice (const :tag "No preamble" nil)
(const :tag "Default preamble" t)
(string :tag "Custom formatting string")
(function :tag "Function (must return a string)")))
-(defcustom org-e-html-preamble-format '(("en" ""))
+(defcustom org-html-preamble-format '(("en" ""))
"Alist of languages and format strings for the HTML preamble.
The first element of each list is the language code, as used for
@@ -848,21 +869,21 @@ preamble itself. This format string can contain these elements:
If you need to use a \"%\" character, you need to escape it
like that: \"%%\"."
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(alist :key-type (string :tag "Language")
:value-type (string :tag "Format string")))
-(defcustom org-e-html-link-up ""
+(defcustom org-html-link-up ""
"Where should the \"UP\" link of exported HTML pages lead?"
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(string :tag "File or URL"))
-(defcustom org-e-html-link-home ""
+(defcustom org-html-link-home ""
"Where should the \"HOME\" link of exported HTML pages lead?"
- :group 'org-export-e-html
+ :group 'org-export-html
:type '(string :tag "File or URL"))
-(defcustom org-e-html-home/up-format
+(defcustom org-html-home/up-format
"<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
<a accesskey=\"h\" href=\"%s\"> UP </a>
|
@@ -870,36 +891,36 @@ like that: \"%%\"."
</div>"
"Snippet used to insert the HOME and UP links.
This is a format string, the first %s will receive the UP link,
-the second the HOME link. If both `org-e-html-link-up' and
-`org-e-html-link-home' are empty, the entire snippet will be
+the second the HOME link. If both `org-html-link-up' and
+`org-html-link-home' are empty, the entire snippet will be
ignored."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;;; Template :: Scripts
-(defcustom org-e-html-style-include-scripts t
+(defcustom org-html-style-include-scripts t
"Non-nil means include the JavaScript snippets in exported HTML files.
-The actual script is defined in `org-e-html-scripts' and should
+The actual script is defined in `org-html-scripts' and should
not be modified."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;; Template :: Styles
-(defcustom org-e-html-style-include-default t
+(defcustom org-html-style-include-default t
"Non-nil means include the default style in exported HTML files.
-The actual style is defined in `org-e-html-style-default' and should
-not be modified. Use the variables `org-e-html-style' to add
+The actual style is defined in `org-html-style-default' and should
+not be modified. Use the variables `org-html-style' to add
your own style information."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'boolean)
;;;###autoload
-(put 'org-e-html-style-include-default 'safe-local-variable 'booleanp)
+(put 'org-html-style-include-default 'safe-local-variable 'booleanp)
-(defcustom org-e-html-style ""
+(defcustom org-html-style ""
"Org-wide style definitions for exported HTML files.
This variable needs to contain the full HTML structure to provide a style,
@@ -925,40 +946,40 @@ If you'd like to refer to an external style file, use something like
As the value of this option simply gets inserted into the HTML <head> header,
you can \"misuse\" it to add arbitrary text to the header.
-See also the variable `org-e-html-style-extra'."
- :group 'org-export-e-html
+See also the variable `org-html-style-extra'."
+ :group 'org-export-html
:type 'string)
;;;###autoload
-(put 'org-e-html-style 'safe-local-variable 'stringp)
+(put 'org-html-style 'safe-local-variable 'stringp)
-(defcustom org-e-html-style-extra ""
+(defcustom org-html-style-extra ""
"Additional style information for HTML export.
The value of this variable is inserted into the HTML buffer right after
-the value of `org-e-html-style'. Use this variable for per-file
+the value of `org-html-style'. Use this variable for per-file
settings of style information, and do not forget to surround the style
settings with <style>...</style> tags."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;;###autoload
-(put 'org-e-html-style-extra 'safe-local-variable 'stringp)
+(put 'org-html-style-extra 'safe-local-variable 'stringp)
;;;; Todos
-(defcustom org-e-html-todo-kwd-class-prefix ""
+(defcustom org-html-todo-kwd-class-prefix ""
"Prefix to class names for TODO keywords.
Each TODO keyword gets a class given by the keyword itself, with this prefix.
The default prefix is empty because it is nice to just use the keyword
as a class name. But if you get into conflicts with other, existing
CSS classes, then this prefix can be very useful."
- :group 'org-export-e-html
+ :group 'org-export-html
:type 'string)
;;; Internal Functions
-(defun org-e-html-format-inline-image (src &optional
+(defun org-html-format-inline-image (src &optional
caption label attr standalone-p)
(let* ((id (if (not label) ""
(format " id=\"%s\"" (org-export-solidify-link-text label))))
@@ -967,7 +988,7 @@ CSS classes, then this prefix can be very useful."
((string-match "\\<alt=" (or attr "")) "")
((string-match "^ltxpng/" src)
(format " alt=\"%s\""
- (org-e-html-encode-plain-text
+ (org-html-encode-plain-text
(org-find-text-property-in-string
'org-latex-src src))))
(t (format " alt=\"%s\""
@@ -980,7 +1001,7 @@ CSS classes, then this prefix can be very useful."
(when caption (format "\n<p>%s</p>" caption)))))
(t (format "<img src=\"%s\" %s/>" src (concat attr id))))))
-(defun org-e-html--textarea-block (element)
+(defun org-html--textarea-block (element)
"Transcode ELEMENT into a textarea block.
ELEMENT is either a src block or an example block."
(let ((code (car (org-export-unravel-code element)))
@@ -993,7 +1014,7 @@ ELEMENT is either a src block or an example block."
;;;; Bibliography
-(defun org-e-html-bibliography ()
+(defun org-html-bibliography ()
"Find bibliography, cut it out and return it."
(catch 'exit
(let (beg end (cnt 1) bib)
@@ -1013,7 +1034,7 @@ ELEMENT is either a src block or an example block."
;;;; Table
-(defun org-e-html-splice-attributes (tag attributes)
+(defun org-html-splice-attributes (tag attributes)
"Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
(if (not attributes)
tag
@@ -1039,12 +1060,12 @@ ELEMENT is either a src block or an example block."
(substring style (match-beginning 0)))
style))
-(defun org-export-e-htmlize-region-for-paste (beg end)
+(defun org-export-htmlize-region-for-paste (beg end)
"Convert the region to HTML, using htmlize.el.
This is much like `htmlize-region-for-paste', only that it uses
the settings define in the org-... variables."
- (let* ((htmlize-output-type org-export-e-htmlize-output-type)
- (htmlize-css-name-prefix org-export-e-htmlize-css-font-prefix)
+ (let* ((htmlize-output-type org-export-htmlize-output-type)
+ (htmlize-css-name-prefix org-export-htmlize-font-prefix)
(htmlbuf (htmlize-region beg end)))
(unwind-protect
(with-current-buffer htmlbuf
@@ -1053,7 +1074,7 @@ the settings define in the org-... variables."
(kill-buffer htmlbuf))))
;;;###autoload
-(defun org-export-e-htmlize-generate-css ()
+(defun org-export-htmlize-generate-css ()
"Create the CSS for all font definitions in the current Emacs session.
Use this to create face definitions in your CSS style file that can then
be used by code snippets transformed by htmlize.
@@ -1061,9 +1082,9 @@ This command just produces a buffer that contains class definitions for all
faces used in the current Emacs session. You can copy and paste the ones you
need into your CSS file.
-If you then set `org-export-e-htmlize-output-type' to `css', calls to
-the function `org-export-e-htmlize-region-for-paste' will produce code
-that uses these same face definitions."
+If you then set `org-export-htmlize-output-type' to `css', calls
+to the function `org-export-htmlize-region-for-paste' will
+produce code that uses these same face definitions."
(interactive)
(require 'htmlize)
(and (get-buffer "*html*") (kill-buffer "*html*"))
@@ -1087,11 +1108,11 @@ that uses these same face definitions."
(if (looking-at " +") (replace-match ""))
(goto-char (point-min)))
-(defun org-e-html--make-string (n string)
+(defun org-html--make-string (n string)
"Build a string by concatenating N times STRING."
(let (out) (dotimes (i n out) (setq out (concat string out)))))
-(defun org-e-html-toc-text (toc-entries)
+(defun org-html-toc-text (toc-entries)
(let* ((prev-level (1- (nth 1 (car toc-entries))))
(start-level prev-level))
(concat
@@ -1105,46 +1126,46 @@ that uses these same face definitions."
rtn)
(setq prev-level level)
(concat
- (org-e-html--make-string
+ (org-html--make-string
times (cond ((> cnt 0) "\n<ul>\n<li>")
((< cnt 0) "</li>\n</ul>\n")))
(if (> cnt 0) "\n<ul>\n<li>" "</li>\n<li>")))
headline)))
toc-entries "")
- (org-e-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
+ (org-html--make-string (- prev-level start-level) "</li>\n</ul>\n"))))
-(defun* org-e-html-format-toc-headline
+(defun* org-html-format-toc-headline
(todo todo-type priority text tags
&key level section-number headline-label &allow-other-keys)
(let ((headline (concat
section-number (and section-number ". ")
text
- (and tags "&nbsp;&nbsp;&nbsp;") (org-e-html--tags tags))))
+ (and tags "&nbsp;&nbsp;&nbsp;") (org-html--tags tags))))
(format "<a href=\"#%s\">%s</a>"
(org-export-solidify-link-text headline-label)
(if (not nil) headline
(format "<span class=\"%s\">%s</span>" todo-type headline)))))
-(defun org-e-html-toc (depth info)
+(defun org-html-toc (depth info)
(let* ((headlines (org-export-collect-headlines info depth))
(toc-entries
(loop for headline in headlines collect
- (list (org-e-html-format-headline--wrap
- headline info 'org-e-html-format-toc-headline)
+ (list (org-html-format-headline--wrap
+ headline info 'org-html-format-toc-headline)
(org-export-get-relative-level headline info)))))
(when toc-entries
(concat
"<div id=\"table-of-contents\">\n"
(format "<h%d>%s</h%d>\n"
- org-e-html-toplevel-hlevel
- (org-e-html--translate "Table of Contents" info)
- org-e-html-toplevel-hlevel)
+ org-html-toplevel-hlevel
+ (org-html--translate "Table of Contents" info)
+ org-html-toplevel-hlevel)
"<div id=\"text-table-of-contents\">"
- (org-e-html-toc-text toc-entries)
+ (org-html-toc-text toc-entries)
"</div>\n"
"</div>\n"))))
-(defun org-e-html-fix-class-name (kwd) ; audit callers of this function
+(defun org-html-fix-class-name (kwd) ; audit callers of this function
"Turn todo keyword into a valid class name.
Replaces invalid characters with \"_\"."
(save-match-data
@@ -1152,30 +1173,30 @@ Replaces invalid characters with \"_\"."
(setq kwd (replace-match "_" t t kwd))))
kwd)
-(defun org-e-html-format-footnote-reference (n def refcnt)
+(defun org-html-format-footnote-reference (n def refcnt)
(let ((extra (if (= refcnt 1) "" (format ".%d" refcnt))))
- (format org-e-html-footnote-format
+ (format org-html-footnote-format
(let* ((id (format "fnr.%s%s" n extra))
(href (format " href=\"#fn.%s\"" n))
(attributes (concat " class=\"footref\"" href)))
- (org-e-html--anchor id n attributes)))))
+ (org-html--anchor id n attributes)))))
-(defun org-e-html-format-footnotes-section (section-name definitions)
+(defun org-html-format-footnotes-section (section-name definitions)
(if (not definitions) ""
- (format org-e-html-footnotes-section section-name definitions)))
+ (format org-html-footnotes-section section-name definitions)))
-(defun org-e-html-format-footnote-definition (fn)
+(defun org-html-format-footnote-definition (fn)
(let ((n (car fn)) (def (cdr fn)))
(format
"<tr>\n<td>%s</td>\n<td>%s</td>\n</tr>\n"
- (format org-e-html-footnote-format
+ (format org-html-footnote-format
(let* ((id (format "fn.%s" n))
(href (format " href=\"#fnr.%s\"" n))
(attributes (concat " class=\"footnum\"" href)))
- (org-e-html--anchor id n attributes)))
+ (org-html--anchor id n attributes)))
def)))
-(defun org-e-html-footnote-section (info)
+(defun org-html-footnote-section (info)
(let* ((fn-alist (org-export-collect-footnote-definitions
(plist-get info :parse-tree) info))
@@ -1186,17 +1207,17 @@ Replaces invalid characters with \"_\"."
(format "<p>%s</p>"
(org-trim (org-export-data raw info))))))))
(when fn-alist
- (org-e-html-format-footnotes-section
- (org-e-html--translate "Footnotes" info)
+ (org-html-format-footnotes-section
+ (org-html--translate "Footnotes" info)
(format
"<table>\n%s\n</table>\n"
- (mapconcat 'org-e-html-format-footnote-definition fn-alist "\n"))))))
+ (mapconcat 'org-html-format-footnote-definition fn-alist "\n"))))))
;;; Template
-(defun org-e-html--build-meta-info (info)
+(defun org-html--build-meta-info (info)
"Return meta tags for exported document.
INFO is a plist used as a communication channel."
(let* ((title (org-export-data (plist-get info :title) info))
@@ -1212,9 +1233,9 @@ INFO is a plist used as a communication channel."
(format "<title>%s</title>\n" title)
(format
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>"
- (or (and org-e-html-coding-system
+ (or (and org-html-coding-system
(fboundp 'coding-system-get)
- (coding-system-get org-e-html-coding-system 'mime-charset))
+ (coding-system-get org-html-coding-system 'mime-charset))
"iso-8859-1"))
(format "<meta name=\"title\" content=\"%s\"/>\n" title)
(format "<meta name=\"generator\" content=\"Org-mode\"/>\n")
@@ -1225,23 +1246,23 @@ INFO is a plist used as a communication channel."
(and keywords
(format "<meta name=\"keywords\" content=\"%s\"/>\n" keywords)))))
-(defun org-e-html--build-style (info)
+(defun org-html--build-style (info)
"Return style information for exported document.
INFO is a plist used as a communication channel."
(org-element-normalize-string
(concat
- (when (plist-get info :style-include-default) org-e-html-style-default)
- (org-element-normalize-string (plist-get info :style))
- (org-element-normalize-string (plist-get info :style-extra))
- (when (plist-get info :style-include-scripts) org-e-html-scripts))))
+ (when (plist-get info :html-style-include-default) org-html-style-default)
+ (org-element-normalize-string (plist-get info :html-style))
+ (org-element-normalize-string (plist-get info :html-style-extra))
+ (when (plist-get info :html-style-include-scripts) org-html-scripts))))
-(defun org-e-html--build-mathjax-config (info)
+(defun org-html--build-mathjax-config (info)
"Insert the user setup into the mathjax template.
INFO is a plist used as a communication channel."
- (when (member (plist-get info :LaTeX-fragments) '(mathjax t))
- (let ((template org-e-html-mathjax-template)
- (options org-e-html-mathjax-options)
- (in-buffer (or (plist-get info :mathjax) ""))
+ (when (memq (plist-get info :with-latex) '(mathjax t))
+ (let ((template org-html-mathjax-template)
+ (options org-html-mathjax-options)
+ (in-buffer (or (plist-get info :html-mathjax) ""))
name val (yes " ") (no "// ") x)
(mapc
(lambda (e)
@@ -1267,7 +1288,7 @@ INFO is a plist used as a communication channel."
;; Return the modified template.
(org-element-normalize-string template))))
-(defun org-e-html--build-preamble (info)
+(defun org-html--build-preamble (info)
"Return document preamble as a string, or nil.
INFO is a plist used as a communication channel."
(let ((preamble (plist-get info :html-preamble)))
@@ -1287,16 +1308,16 @@ INFO is a plist used as a communication channel."
(?d . ,date) (?e . ,email)))
(format-spec
(or (cadr (assoc (plist-get info :language)
- org-e-html-preamble-format))
- (cadr (assoc "en" org-e-html-preamble-format)))
+ org-html-preamble-format))
+ (cadr (assoc "en" org-html-preamble-format)))
`((?t . ,title) (?a . ,author)
(?d . ,date) (?e . ,email))))))))
(when (org-string-nw-p preamble-contents)
- (concat (format "<div id=\"%s\">\n" (nth 0 org-e-html-divs))
+ (concat (format "<div id=\"%s\">\n" (nth 0 org-html-divs))
(org-element-normalize-string preamble-contents)
"</div>\n"))))))
-(defun org-e-html--build-postamble (info)
+(defun org-html--build-postamble (info)
"Return document postamble as a string, or nil.
INFO is a plist used as a communication channel."
(let ((postamble (plist-get info :html-postamble)))
@@ -1312,7 +1333,7 @@ INFO is a plist used as a communication channel."
(format "<a href=\"mailto:%s\">%s</a>" e e))
(split-string (plist-get info :email) ",+ *")
", "))
- (html-validation-link (or org-e-html-validation-link ""))
+ (html-validation-link (or org-html-validation-link ""))
(creator-info (plist-get info :creator)))
(cond ((stringp postamble)
(format-spec postamble
@@ -1323,11 +1344,11 @@ INFO is a plist used as a communication channel."
(concat
(when (plist-get info :time-stamp-file)
(format "<p class=\"date\">%s: %s</p>\n"
- (org-e-html--translate "Date" info)
+ (org-html--translate "Date" info)
date))
(when (and (plist-get info :with-author) author)
(format "<p class=\"author\">%s : %s</p>\n"
- (org-e-html--translate "Author" info)
+ (org-html--translate "Author" info)
author))
(when (and (plist-get info :with-email) email)
(format "<p class=\"email\">%s </p>\n" email))
@@ -1337,33 +1358,33 @@ INFO is a plist used as a communication channel."
html-validation-link "\n"))
(t (format-spec
(or (cadr (assoc (plist-get info :language)
- org-e-html-postamble-format))
- (cadr (assoc "en" org-e-html-postamble-format)))
+ org-html-postamble-format))
+ (cadr (assoc "en" org-html-postamble-format)))
`((?a . ,author) (?e . ,email)
(?d . ,date) (?c . ,creator-info)
(?v . ,html-validation-link)))))))))
(when (org-string-nw-p postamble-contents)
(concat
- (format "<div id=\"%s\">\n" (nth 2 org-e-html-divs))
+ (format "<div id=\"%s\">\n" (nth 2 org-html-divs))
(org-element-normalize-string postamble-contents)
"</div>\n"))))))
-(defun org-e-html-template (contents info)
+(defun org-html-template (contents info)
"Return complete document string after HTML conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
(concat
(format
- (or (and (stringp org-e-html-xml-declaration)
- org-e-html-xml-declaration)
+ (or (and (stringp org-html-xml-declaration)
+ org-html-xml-declaration)
(cdr (assoc (plist-get info :html-extension)
- org-e-html-xml-declaration))
- (cdr (assoc "html" org-e-html-xml-declaration))
+ org-html-xml-declaration))
+ (cdr (assoc "html" org-html-xml-declaration))
"")
- (or (and org-e-html-coding-system
+ (or (and org-html-coding-system
(fboundp 'coding-system-get)
- (coding-system-get org-e-html-coding-system 'mime-charset))
+ (coding-system-get org-html-coding-system 'mime-charset))
"iso-8859-1"))
"\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
@@ -1371,49 +1392,49 @@ holding export options."
(format "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\">\n"
(plist-get info :language) (plist-get info :language))
"<head>\n"
- (org-e-html--build-meta-info info)
- (org-e-html--build-style info)
- (org-e-html--build-mathjax-config info)
+ (org-html--build-meta-info info)
+ (org-html--build-style info)
+ (org-html--build-mathjax-config info)
"</head>\n"
"<body>\n"
- (let ((link-up (org-trim (plist-get info :link-up)))
- (link-home (org-trim (plist-get info :link-home))))
+ (let ((link-up (org-trim (plist-get info :html-link-up)))
+ (link-home (org-trim (plist-get info :html-link-home))))
(unless (and (string= link-up "") (string= link-up ""))
- (format org-e-html-home/up-format
+ (format org-html-home/up-format
(or link-up link-home)
(or link-home link-up))))
;; Preamble.
- (org-e-html--build-preamble info)
+ (org-html--build-preamble info)
;; Begin content.
- (format "<div id=\"%s\">\n" (nth 1 org-e-html-divs))
+ (format "<div id=\"%s\">\n" (nth 1 org-html-divs))
;; Document title.
(format "<h1 class=\"title\">%s</h1>\n"
(org-export-data (plist-get info :title) info))
;; Table of contents.
(let ((depth (plist-get info :with-toc)))
- (when depth (org-e-html-toc depth info)))
+ (when depth (org-html-toc depth info)))
;; Document contents.
contents
;; Footnotes section.
- (org-e-html-footnote-section info)
+ (org-html-footnote-section info)
;; Bibliography.
- (org-e-html-bibliography)
+ (org-html-bibliography)
;; End content.
"\n</div>"
;; Postamble.
- (org-e-html--build-postamble info)
+ (org-html--build-postamble info)
;; Closing document.
"</body>\n</html>"))
-(defun org-e-html--translate (s info)
+(defun org-html--translate (s info)
"Translate string S according to specified language.
INFO is a plist used as a communication channel."
(org-export-translate s :html info))
;;;; Anchor
-(defun org-e-html--anchor (&optional id desc attributes)
- (let* ((name (and org-e-html-allow-name-attribute-in-anchors id))
+(defun org-html--anchor (&optional id desc attributes)
+ (let* ((name (and org-html-allow-name-attribute-in-anchors id))
(attributes (concat (and id (format " id=\"%s\"" id))
(and name (format " name=\"%s\"" name))
attributes)))
@@ -1421,43 +1442,43 @@ INFO is a plist used as a communication channel."
;;;; Todo
-(defun org-e-html--todo (todo)
+(defun org-html--todo (todo)
(when todo
(format "<span class=\"%s %s%s\">%s</span>"
(if (member todo org-done-keywords) "done" "todo")
- org-e-html-todo-kwd-class-prefix (org-e-html-fix-class-name todo)
+ org-html-todo-kwd-class-prefix (org-html-fix-class-name todo)
todo)))
;;;; Tags
-(defun org-e-html--tags (tags)
+(defun org-html--tags (tags)
(when tags
(format "<span class=\"tag\">%s</span>"
(mapconcat
(lambda (tag)
(format "<span class=\"%s\">%s</span>"
- (concat org-e-html-tag-class-prefix
- (org-e-html-fix-class-name tag))
+ (concat org-html-tag-class-prefix
+ (org-html-fix-class-name tag))
tag))
tags "&nbsp;"))))
;;;; Headline
-(defun* org-e-html-format-headline
+(defun* org-html-format-headline
(todo todo-type priority text tags
&key level section-number headline-label &allow-other-keys)
(let ((section-number
(when section-number
(format "<span class=\"section-number-%d\">%s</span> "
level section-number)))
- (todo (org-e-html--todo todo))
- (tags (org-e-html--tags tags)))
+ (todo (org-html--todo todo))
+ (tags (org-html--tags tags)))
(concat section-number todo (and todo " ") text
(and tags "&nbsp;&nbsp;&nbsp;") tags)))
;;;; Src Code
-(defun org-e-html-fontify-code (code lang)
+(defun org-html-fontify-code (code lang)
"Color CODE with htmlize library.
CODE is a string representing the source code to colorize. LANG
is the language used for CODE, as a string, or nil."
@@ -1466,13 +1487,13 @@ is the language used for CODE, as a string, or nil."
;; Case 1: No lang. Possibly an example block.
((not lang)
;; Simple transcoding.
- (org-e-html-encode-plain-text code))
+ (org-html-encode-plain-text code))
;; Case 2: No htmlize or an inferior version of htmlize
((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
;; Emit a warning.
(message "Cannot fontify src block (htmlize.el >= 1.34 required)")
;; Simple transcoding.
- (org-e-html-encode-plain-text code))
+ (org-html-encode-plain-text code))
(t
;; Map language
(setq lang (or (assoc-default lang org-src-lang-modes) lang))
@@ -1481,7 +1502,7 @@ is the language used for CODE, as a string, or nil."
;; Case 1: Language is not associated with any Emacs mode
((not (functionp lang-mode))
;; Simple transcoding.
- (org-e-html-encode-plain-text code))
+ (org-html-encode-plain-text code))
;; Case 2: Default. Fontify code.
(t
;; htmlize
@@ -1502,14 +1523,14 @@ is the language used for CODE, as a string, or nil."
(org-src-mode)
(set-buffer-modified-p nil)
;; Htmlize region.
- (org-export-e-htmlize-region-for-paste
+ (org-export-htmlize-region-for-paste
(point-min) (point-max))))
;; Strip any encolosing <pre></pre> tags.
(if (string-match "<pre[^>]*>\n*\\([^\000]*\\)</pre>" code)
(match-string 1 code)
code))))))))
-(defun org-e-html-do-format-code
+(defun org-html-do-format-code
(code &optional lang refs retain-labels num-start)
"Format CODE string as source code.
Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
@@ -1524,7 +1545,7 @@ line of code."
(and num-start
(format "%%%ds: "
(length (number-to-string (+ code-length num-start))))))
- (code (org-e-html-fontify-code code lang)))
+ (code (org-html-fontify-code code lang)))
(org-export-format-code
code
(lambda (loc line-num ref)
@@ -1544,7 +1565,7 @@ line of code."
ref loc)))
num-start refs)))
-(defun org-e-html-format-code (element info)
+(defun org-html-format-code (element info)
"Format contents of ELEMENT as source code.
ELEMENT is either an example block or a src block. INFO is
a plist used as a communication channel."
@@ -1559,7 +1580,7 @@ a plist used as a communication channel."
(num-start (case (org-element-property :number-lines element)
(continued (org-export-get-loc element info))
(new 0))))
- (org-e-html-do-format-code code lang refs retain-labels num-start)))
+ (org-html-do-format-code code lang refs retain-labels num-start)))
@@ -1567,17 +1588,17 @@ a plist used as a communication channel."
;;;; Bold
-(defun org-e-html-bold (bold contents info)
+(defun org-html-bold (bold contents info)
"Transcode BOLD from Org to HTML.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
- (format (or (cdr (assq 'bold org-e-html-text-markup-alist)) "%s")
+ (format (or (cdr (assq 'bold org-html-text-markup-alist)) "%s")
contents))
;;;; Center Block
-(defun org-e-html-center-block (center-block contents info)
+(defun org-html-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1586,7 +1607,7 @@ holding contextual information."
;;;; Clock
-(defun org-e-html-clock (clock contents info)
+(defun org-html-clock (clock contents info)
"Transcode a CLOCK element from Org to HTML.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -1605,22 +1626,22 @@ channel."
;;;; Code
-(defun org-e-html-code (code contents info)
+(defun org-html-code (code contents info)
"Transcode CODE from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (format (or (cdr (assq 'code org-e-html-text-markup-alist)) "%s")
+ (format (or (cdr (assq 'code org-html-text-markup-alist)) "%s")
(org-element-property :value code)))
;;;; Drawer
-(defun org-e-html-drawer (drawer contents info)
+(defun org-html-drawer (drawer contents info)
"Transcode a DRAWER element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (if (functionp org-e-html-format-drawer-function)
- (funcall org-e-html-format-drawer-function
+ (if (functionp org-html-format-drawer-function)
+ (funcall org-html-format-drawer-function
(org-element-property :drawer-name drawer)
contents)
;; If there's no user defined function: simply
@@ -1630,7 +1651,7 @@ holding contextual information."
;;;; Dynamic Block
-(defun org-e-html-dynamic-block (dynamic-block contents info)
+(defun org-html-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
@@ -1639,7 +1660,7 @@ holding contextual information. See `org-export-data'."
;;;; Entity
-(defun org-e-html-entity (entity contents info)
+(defun org-html-entity (entity contents info)
"Transcode an ENTITY object from Org to HTML.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -1648,29 +1669,29 @@ contextual information."
;;;; Example Block
-(defun org-e-html-example-block (example-block contents info)
+(defun org-html-example-block (example-block contents info)
"Transcode a EXAMPLE-BLOCK element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
(if (org-export-read-attribute :attr_html example-block :textarea)
- (org-e-html--textarea-block example-block)
+ (org-html--textarea-block example-block)
(format "<pre class=\"example\">\n%s</pre>"
- (org-e-html-format-code example-block info))))
+ (org-html-format-code example-block info))))
;;;; Export Snippet
-(defun org-e-html-export-snippet (export-snippet contents info)
+(defun org-html-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-html)
+ (when (eq (org-export-snippet-backend export-snippet) 'html)
(org-element-property :value export-snippet)))
;;;; Export Block
-(defun org-e-html-export-block (export-block contents info)
+(defun org-html-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "HTML")
@@ -1679,51 +1700,51 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Fixed Width
-(defun org-e-html-fixed-width (fixed-width contents info)
+(defun org-html-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(format "<pre class=\"example\">\n%s</pre>"
- (org-e-html-do-format-code
+ (org-html-do-format-code
(org-remove-indentation
(org-element-property :value fixed-width)))))
;;;; Footnote Reference
-(defun org-e-html-footnote-reference (footnote-reference contents info)
+(defun org-html-footnote-reference (footnote-reference contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(concat
;; Insert separator between two footnotes in a row.
(let ((prev (org-export-get-previous-element footnote-reference info)))
(when (eq (org-element-type prev) 'footnote-reference)
- org-e-html-footnote-separator))
+ org-html-footnote-separator))
(cond
((not (org-export-footnote-first-reference-p footnote-reference info))
- (org-e-html-format-footnote-reference
+ (org-html-format-footnote-reference
(org-export-get-footnote-number footnote-reference info)
"IGNORED" 100))
;; Inline definitions are secondary strings.
((eq (org-element-property :type footnote-reference) 'inline)
- (org-e-html-format-footnote-reference
+ (org-html-format-footnote-reference
(org-export-get-footnote-number footnote-reference info)
"IGNORED" 1))
;; Non-inline footnotes definitions are full Org data.
- (t (org-e-html-format-footnote-reference
+ (t (org-html-format-footnote-reference
(org-export-get-footnote-number footnote-reference info)
"IGNORED" 1)))))
;;;; Headline
-(defun org-e-html-format-headline--wrap (headline info
+(defun org-html-format-headline--wrap (headline info
&optional format-function
&rest extra-keys)
"Transcode an HEADLINE element from Org to HTML.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
(let* ((level (+ (org-export-get-relative-level headline info)
- (1- org-e-html-toplevel-hlevel)))
+ (1- org-html-toplevel-hlevel)))
(headline-number (org-export-get-headline-number headline info))
(section-number (and (not (org-export-low-level-p headline info))
(org-export-numbered-headline-p headline info)
@@ -1743,19 +1764,19 @@ holding contextual information."
headline-number "-"))))
(format-function (cond
((functionp format-function) format-function)
- ((functionp org-e-html-format-headline-function)
+ ((functionp org-html-format-headline-function)
(function*
(lambda (todo todo-type priority text tags
&allow-other-keys)
- (funcall org-e-html-format-headline-function
+ (funcall org-html-format-headline-function
todo todo-type priority text tags))))
- (t 'org-e-html-format-headline))))
+ (t 'org-html-format-headline))))
(apply format-function
todo todo-type priority text tags
:headline-label headline-label :level level
:section-number section-number extra-keys)))
-(defun org-e-html-headline (headline contents info)
+(defun org-html-headline (headline contents info)
"Transcode an HEADLINE element from Org to HTML.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
@@ -1777,7 +1798,7 @@ holding contextual information."
(org-export-get-headline-number
headline info) ".")))
;; Create the headline text.
- (full-text (org-e-html-format-headline--wrap headline info)))
+ (full-text (org-html-format-headline--wrap headline info)))
(cond
;; Case 1: This is a footnote section: ignore it.
((org-element-property :footnote-section-p headline) nil)
@@ -1787,14 +1808,14 @@ holding contextual information."
((org-export-low-level-p headline info)
;; Build the real contents of the sub-tree.
(let* ((type (if numberedp 'ordered 'unordered))
- (itemized-body (org-e-html-format-list-item
+ (itemized-body (org-html-format-list-item
contents type nil nil full-text)))
(concat
(and (org-export-first-sibling-p headline info)
- (org-e-html-begin-plain-list type))
+ (org-html-begin-plain-list type))
itemized-body
(and (org-export-last-sibling-p headline info)
- (org-e-html-end-plain-list type)))))
+ (org-html-end-plain-list type)))))
;; Case 3. Standard headline. Export it as a section.
(t
(let* ((section-number (mapconcat 'number-to-string
@@ -1807,7 +1828,7 @@ holding contextual information."
(preferred-id (car ids))
(extra-ids (cdr ids))
(extra-class (org-element-property :html-container-class headline))
- (level1 (+ level (1- org-e-html-toplevel-hlevel))))
+ (level1 (+ level (1- org-html-toplevel-hlevel))))
(format "<div id=\"%s\" class=\"%s\">%s%s</div>\n"
(format "outline-container-%s"
(or (org-element-property :custom-id headline)
@@ -1822,7 +1843,7 @@ holding contextual information."
(let ((id (org-export-solidify-link-text
(if (org-uuidgen-p x) (concat "ID-" x)
x))))
- (org-e-html--anchor id)))
+ (org-html--anchor id)))
extra-ids "")
full-text
level1)
@@ -1831,7 +1852,7 @@ holding contextual information."
;;;; Horizontal Rule
-(defun org-e-html-horizontal-rule (horizontal-rule contents info)
+(defun org-html-horizontal-rule (horizontal-rule contents info)
"Transcode an HORIZONTAL-RULE object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
"<hr/>")
@@ -1839,7 +1860,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Inline Src Block
-(defun org-e-html-inline-src-block (inline-src-block contents info)
+(defun org-html-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1850,53 +1871,53 @@ contextual information."
;;;; Inlinetask
-(defun org-e-html-format-section (text class &optional id)
+(defun org-html-format-section (text class &optional id)
(let ((extra (concat (when id (format " id=\"%s\"" id)))))
(concat (format "<div class=\"%s\"%s>\n" class extra) text "</div>\n")))
-(defun org-e-html-inlinetask (inlinetask contents info)
+(defun org-html-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(cond
- ;; If `org-e-html-format-inlinetask-function' is provided, call it
+ ;; If `org-html-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- ((functionp org-e-html-format-inlinetask-function)
+ ((functionp org-html-format-inlinetask-function)
(let ((format-function
(function*
(lambda (todo todo-type priority text tags
&key contents &allow-other-keys)
- (funcall org-e-html-format-inlinetask-function
+ (funcall org-html-format-inlinetask-function
todo todo-type priority text tags contents)))))
- (org-e-html-format-headline--wrap
+ (org-html-format-headline--wrap
inlinetask info format-function :contents contents)))
;; Otherwise, use a default template.
(t (format "<div class=\"inlinetask\">\n<b>%s</b><br/>\n%s</div>"
- (org-e-html-format-headline--wrap inlinetask info)
+ (org-html-format-headline--wrap inlinetask info)
contents))))
;;;; Italic
-(defun org-e-html-italic (italic contents info)
+(defun org-html-italic (italic contents info)
"Transcode ITALIC from Org to HTML.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
- (format (or (cdr (assq 'italic org-e-html-text-markup-alist)) "%s") contents))
+ (format (or (cdr (assq 'italic org-html-text-markup-alist)) "%s") contents))
;;;; Item
-(defun org-e-html-checkbox (checkbox)
+(defun org-html-checkbox (checkbox)
(case checkbox (on "<code>[X]</code>")
(off "<code>[&nbsp;]</code>")
(trans "<code>[-]</code>")
(t "")))
-(defun org-e-html-format-list-item (contents type checkbox
+(defun org-html-format-list-item (contents type checkbox
&optional term-counter-id
headline)
- (let ((checkbox (concat (org-e-html-checkbox checkbox) (and checkbox " "))))
+ (let ((checkbox (concat (org-html-checkbox checkbox) (and checkbox " "))))
(concat
(case type
(ordered
@@ -1925,7 +1946,7 @@ contextual information."
(unordered "</li>")
(descriptive "</dd>")))))
-(defun org-e-html-item (item contents info)
+(defun org-html-item (item contents info)
"Transcode an ITEM element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1935,13 +1956,13 @@ contextual information."
(checkbox (org-element-property :checkbox item))
(tag (let ((tag (org-element-property :tag item)))
(and tag (org-export-data tag info)))))
- (org-e-html-format-list-item
+ (org-html-format-list-item
contents type checkbox (or tag counter))))
;;;; Keyword
-(defun org-e-html-keyword (keyword contents info)
+(defun org-html-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword))
@@ -1958,7 +1979,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((depth (or (and (string-match "[0-9]+" value)
(string-to-number (match-string 0 value)))
(plist-get info :with-toc))))
- (org-e-html-toc depth info)))
+ (org-html-toc depth info)))
((string= "tables" value) "\\listoftables")
((string= "figures" value) "\\listoffigures")
((string= "listings" value)
@@ -1970,7 +1991,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Latex Environment
-(defun org-e-html-format-latex (latex-frag processing-type)
+(defun org-html-format-latex (latex-frag processing-type)
(let* ((cache-relpath
(concat "ltxpng/" (file-name-sans-extension
(file-name-nondirectory (buffer-file-name)))))
@@ -1983,10 +2004,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
nil nil processing-type)
(buffer-string))))
-(defun org-e-html-latex-environment (latex-environment contents info)
+(defun org-html-latex-environment (latex-environment contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((processing-type (plist-get info :LaTeX-fragments))
+ (let ((processing-type (plist-get info :with-latex))
(latex-frag (org-remove-indentation
(org-element-property :value latex-environment)))
(caption (org-export-data
@@ -1995,40 +2016,40 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(label (org-element-property :name latex-environment)))
(cond
((memq processing-type '(t mathjax))
- (org-e-html-format-latex latex-frag 'mathjax))
+ (org-html-format-latex latex-frag 'mathjax))
((eq processing-type 'dvipng)
- (let* ((formula-link (org-e-html-format-latex
+ (let* ((formula-link (org-html-format-latex
latex-frag processing-type)))
(when (and formula-link
(string-match "file:\\([^]]*\\)" formula-link))
- (org-e-html-format-inline-image
+ (org-html-format-inline-image
(match-string 1 formula-link) caption label attr t))))
(t latex-frag))))
;;;; Latex Fragment
-(defun org-e-html-latex-fragment (latex-fragment contents info)
+(defun org-html-latex-fragment (latex-fragment contents info)
"Transcode a LATEX-FRAGMENT object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((latex-frag (org-element-property :value latex-fragment))
- (processing-type (plist-get info :LaTeX-fragments)))
+ (processing-type (plist-get info :with-latex)))
(case processing-type
((t mathjax)
- (org-e-html-format-latex latex-frag 'mathjax))
+ (org-html-format-latex latex-frag 'mathjax))
(dvipng
- (let* ((formula-link (org-e-html-format-latex
+ (let* ((formula-link (org-html-format-latex
latex-frag processing-type)))
(when (and formula-link
(string-match "file:\\([^]]*\\)" formula-link))
- (org-e-html-format-inline-image
+ (org-html-format-inline-image
(match-string 1 formula-link)))))
(t latex-frag))))
;;;; Line Break
-(defun org-e-html-line-break (line-break contents info)
+(defun org-html-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
"<br/>\n")
@@ -2036,7 +2057,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Link
-(defun org-e-html-link--inline-image (link desc info)
+(defun org-html-link--inline-image (link desc info)
"Return HTML code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel."
@@ -2060,11 +2081,11 @@ used as a communication channel."
;; value if nothing is left.
(setq attr (if (not attr) "" (org-trim attr)))
;; Return proper string, depending on DISPOSITION.
- (org-e-html-format-inline-image
- path caption label attr (org-e-html-standalone-image-p link info))))
+ (org-html-format-inline-image
+ path caption label attr (org-html-standalone-image-p link info))))
-(defvar org-e-html-standalone-image-predicate)
-(defun org-e-html-standalone-image-p (element info &optional predicate)
+(defvar org-html-standalone-image-predicate)
+(defun org-html-standalone-image-p (element info &optional predicate)
"Test if ELEMENT is a standalone image for the purpose HTML export.
INFO is a plist holding contextual information.
@@ -2078,23 +2099,23 @@ whitespaces.
Return nil, otherwise.
-Bind `org-e-html-standalone-image-predicate' to constrain
+Bind `org-html-standalone-image-predicate' to constrain
paragraph further. For example, to check for only captioned
standalone images, do the following.
- \(setq org-e-html-standalone-image-predicate
+ \(setq org-html-standalone-image-predicate
\(lambda \(paragraph\)
\(org-element-property :caption paragraph\)\)\)"
(let ((paragraph (case (org-element-type element)
(paragraph element)
(link (and (org-export-inline-image-p
- element org-e-html-inline-image-rules)
+ element org-html-inline-image-rules)
(org-export-get-parent element)))
(t nil))))
(when (eq (org-element-type paragraph) 'paragraph)
- (when (or (not (and (boundp 'org-e-html-standalone-image-predicate)
- (functionp org-e-html-standalone-image-predicate)))
- (funcall org-e-html-standalone-image-predicate paragraph))
+ (when (or (not (and (boundp 'org-html-standalone-image-predicate)
+ (functionp org-html-standalone-image-predicate)))
+ (funcall org-html-standalone-image-predicate paragraph))
(let ((contents (org-element-contents paragraph)))
(loop for x in contents
with inline-image-count = 0
@@ -2103,11 +2124,11 @@ standalone images, do the following.
(not (org-string-nw-p x)))
((eq (org-element-type x) 'link)
(when (org-export-inline-image-p
- x org-e-html-inline-image-rules)
+ x org-html-inline-image-rules)
(= (incf inline-image-count) 1)))
(t nil))))))))
-(defun org-e-html-link (link desc info)
+(defun org-html-link (link desc info)
"Transcode a LINK object from Org to HTML.
DESC is the description part of the link, or the empty string.
@@ -2117,9 +2138,9 @@ INFO is a plist holding contextual information. See
(function
(lambda (raw-path info)
"Treat links to `file.org' as links to `file.html', if needed.
- See `org-e-html-link-org-files-as-html'."
+ See `org-html-link-org-files-as-html'."
(cond
- ((and org-e-html-link-org-files-as-html
+ ((and org-html-link-org-files-as-html
(string= ".org"
(downcase (file-name-extension raw-path "."))))
(concat (file-name-sans-extension raw-path) "."
@@ -2154,10 +2175,10 @@ INFO is a plist holding contextual information. See
(cond
;; Image file.
- ((and (or (eq t org-e-html-inline-images)
- (and org-e-html-inline-images (not desc)))
- (org-export-inline-image-p link org-e-html-inline-image-rules))
- (org-e-html-link--inline-image link desc info))
+ ((and (or (eq t org-html-inline-images)
+ (and org-html-inline-images (not desc)))
+ (org-export-inline-image-p link org-html-inline-image-rules))
+ (org-html-link--inline-image link desc info))
;; Radio target: Transcode target's contents and use them as
;; link's description.
((string= type "radio")
@@ -2232,10 +2253,10 @@ INFO is a plist holding contextual information. See
(let ((path (org-export-solidify-link-text path)) number)
(unless desc
(setq number (cond
- ((org-e-html-standalone-image-p destination info)
+ ((org-html-standalone-image-p destination info)
(org-export-get-ordinal
(assoc 'link (org-element-contents destination))
- info 'link 'org-e-html-standalone-image-p))
+ info 'link 'org-html-standalone-image-p))
(t (org-export-get-ordinal destination info))))
(setq desc (when number
(if (atom number) (number-to-string number)
@@ -2268,7 +2289,7 @@ INFO is a plist holding contextual information. See
;;;; Paragraph
-(defun org-e-html-paragraph (paragraph contents info)
+(defun org-html-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to HTML.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
@@ -2283,7 +2304,7 @@ the plist used as a communication channel."
(org-element-property :contents-begin parent)))
;; leading paragraph in a list item have no tags
contents)
- ((org-e-html-standalone-image-p paragraph info)
+ ((org-html-standalone-image-p paragraph info)
;; standalone image
contents)
(t (format "<p%s>\n%s</p>" extra contents)))))
@@ -2291,7 +2312,7 @@ the plist used as a communication channel."
;;;; Plain List
-(defun org-e-html-begin-plain-list (type &optional arg1)
+(defun org-html-begin-plain-list (type &optional arg1)
(case type
(ordered
(format "<ol class=\"org-ol\"%s>" (if arg1 ; FIXME
@@ -2300,27 +2321,27 @@ the plist used as a communication channel."
(unordered "<ul class=\"org-ul\">")
(descriptive "<dl class=\"org-dl\">")))
-(defun org-e-html-end-plain-list (type)
+(defun org-html-end-plain-list (type)
(case type
(ordered "</ol>")
(unordered "</ul>")
(descriptive "</dl>")))
-(defun org-e-html-plain-list (plain-list contents info)
+(defun org-html-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to HTML.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
(let* (arg1 ;; FIXME
(type (org-element-property :type plain-list)))
(format "%s\n%s%s"
- (org-e-html-begin-plain-list type)
- contents (org-e-html-end-plain-list type))))
+ (org-html-begin-plain-list type)
+ contents (org-html-end-plain-list type))))
;;;; Plain Text
-(defun org-e-html-convert-special-strings (string)
+(defun org-html-convert-special-strings (string)
"Convert special characters in STRING to HTML."
- (let ((all org-e-html-special-string-regexps)
+ (let ((all org-html-special-string-regexps)
e a re rpl start)
(while (setq a (pop all))
(setq re (car a) rpl (cdr a) start 0)
@@ -2328,29 +2349,29 @@ contextual information."
(setq string (replace-match rpl t nil string))))
string))
-(defun org-e-html-encode-plain-text (text)
+(defun org-html-encode-plain-text (text)
"Convert plain text characters to HTML equivalent.
Possible conversions are set in `org-export-html-protect-char-alist'."
(mapc
(lambda (pair)
(setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))
- org-e-html-protect-char-alist)
+ org-html-protect-char-alist)
text)
-(defun org-e-html-plain-text (text info)
+(defun org-html-plain-text (text info)
"Transcode a TEXT string from Org to HTML.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
(let ((output text))
;; Protect following characters: <, >, &.
- (setq output (org-e-html-encode-plain-text output))
+ (setq output (org-html-encode-plain-text output))
;; Handle smart quotes. Be sure to provide original string since
;; OUTPUT may have been modified.
(when (plist-get info :with-smart-quotes)
(setq output (org-export-activate-smart-quotes output :html info text)))
;; Handle special strings.
(when (plist-get info :with-special-strings)
- (setq output (org-e-html-convert-special-strings output)))
+ (setq output (org-html-convert-special-strings output)))
;; Handle break preservation if required.
(when (plist-get info :preserve-breaks)
(setq output
@@ -2362,7 +2383,7 @@ contextual information."
;; Planning
-(defun org-e-html-planning (planning contents info)
+(defun org-html-planning (planning contents info)
"Transcode a PLANNING element from Org to HTML.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -2393,7 +2414,7 @@ channel."
;;;; Property Drawer
-(defun org-e-html-property-drawer (property-drawer contents info)
+(defun org-html-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -2404,7 +2425,7 @@ information."
;;;; Quote Block
-(defun org-e-html-quote-block (quote-block contents info)
+(defun org-html-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -2413,7 +2434,7 @@ holding contextual information."
;;;; Quote Section
-(defun org-e-html-quote-section (quote-section contents info)
+(defun org-html-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
@@ -2423,7 +2444,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Section
-(defun org-e-html-section (section contents info)
+(defun org-html-section (section contents info)
"Transcode a SECTION element from Org to HTML.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -2432,7 +2453,7 @@ holding contextual information."
(if (not parent) contents
;; Get div's class and id references.
(let* ((class-num (+ (org-export-get-relative-level parent info)
- (1- org-e-html-toplevel-hlevel)))
+ (1- org-html-toplevel-hlevel)))
(section-number
(mapconcat
'number-to-string
@@ -2445,18 +2466,18 @@ holding contextual information."
;;;; Radio Target
-(defun org-e-html-radio-target (radio-target text info)
+(defun org-html-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to HTML.
TEXT is the text of the target. INFO is a plist holding
contextual information."
(let ((id (org-export-solidify-link-text
(org-element-property :value radio-target))))
- (org-e-html--anchor id text)))
+ (org-html--anchor id text)))
;;;; Special Block
-(defun org-e-html-special-block (special-block contents info)
+(defun org-html-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -2467,15 +2488,15 @@ holding contextual information."
;;;; Src Block
-(defun org-e-html-src-block (src-block contents info)
+(defun org-html-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(if (org-export-read-attribute :attr_html src-block :textarea)
- (org-e-html--textarea-block src-block)
+ (org-html--textarea-block src-block)
(let ((lang (org-element-property :language src-block))
(caption (org-export-get-caption src-block))
- (code (org-e-html-format-code src-block info)))
+ (code (org-html-format-code src-block info)))
(if (not lang) (format "<pre class=\"example\">\n%s</pre>" code)
(format "<div class=\"org-src-container\">\n%s%s\n</div>"
(if (not caption) ""
@@ -2486,7 +2507,7 @@ contextual information."
;;;; Statistics Cookie
-(defun org-e-html-statistics-cookie (statistics-cookie contents info)
+(defun org-html-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((cookie-value (org-element-property :value statistics-cookie)))
@@ -2495,17 +2516,17 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Strike-Through
-(defun org-e-html-strike-through (strike-through contents info)
+(defun org-html-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to HTML.
CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information."
- (format (or (cdr (assq 'strike-through org-e-html-text-markup-alist)) "%s")
+ (format (or (cdr (assq 'strike-through org-html-text-markup-alist)) "%s")
contents))
;;;; Subscript
-(defun org-e-html-subscript (subscript contents info)
+(defun org-html-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to HTML.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -2514,7 +2535,7 @@ contextual information."
;;;; Superscript
-(defun org-e-html-superscript (superscript contents info)
+(defun org-html-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to HTML.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -2523,16 +2544,16 @@ contextual information."
;;;; Tabel Cell
-(defun org-e-html-table-cell (table-cell contents info)
+(defun org-html-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to HTML.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let* ((table-row (org-export-get-parent table-cell))
(table (org-export-get-parent-table table-cell))
(cell-attrs
- (if (not org-e-html-table-align-individual-fields) ""
- (format (if (and (boundp 'org-e-html-format-table-no-css)
- org-e-html-format-table-no-css)
+ (if (not org-html-table-align-individual-fields) ""
+ (format (if (and (boundp 'org-html-format-table-no-css)
+ org-html-format-table-no-css)
" align=\"%s\"" " class=\"%s\"")
(org-export-table-cell-alignment table-cell info)))))
(when (or (not contents) (string= "" (org-trim contents)))
@@ -2540,19 +2561,19 @@ channel."
(cond
((and (org-export-table-has-header-p table info)
(= 1 (org-export-table-row-group table-row info)))
- (concat "\n" (format (car org-e-html-table-header-tags) "col" cell-attrs)
- contents (cdr org-e-html-table-header-tags)))
- ((and org-e-html-table-use-header-tags-for-first-column
+ (concat "\n" (format (car org-html-table-header-tags) "col" cell-attrs)
+ contents (cdr org-html-table-header-tags)))
+ ((and org-html-table-use-header-tags-for-first-column
(zerop (cdr (org-export-table-cell-address table-cell info))))
- (concat "\n" (format (car org-e-html-table-header-tags) "row" cell-attrs)
- contents (cdr org-e-html-table-header-tags)))
- (t (concat "\n" (format (car org-e-html-table-data-tags) cell-attrs)
- contents (cdr org-e-html-table-data-tags))))))
+ (concat "\n" (format (car org-html-table-header-tags) "row" cell-attrs)
+ contents (cdr org-html-table-header-tags)))
+ (t (concat "\n" (format (car org-html-table-data-tags) cell-attrs)
+ contents (cdr org-html-table-data-tags))))))
;;;; Table Row
-(defun org-e-html-table-row (table-row contents info)
+(defun org-html-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to HTML.
CONTENTS is the contents of the row. INFO is a plist used as a
communication channel."
@@ -2560,7 +2581,7 @@ communication channel."
;; borders of the current row.
(when (eq (org-element-property :type table-row) 'standard)
(let* ((first-rowgroup-p (= 1 (org-export-table-row-group table-row info)))
- (rowgroup-tags
+ (rowgroup-tags
(cond
;; Case 1: Row belongs to second or subsequent rowgroups.
((not (= 1 (org-export-table-row-group table-row info)))
@@ -2574,31 +2595,30 @@ communication channel."
(concat
;; Begin a rowgroup?
(when (org-export-table-row-starts-rowgroup-p table-row info)
- (car rowgroup-tags))
+ (car rowgroup-tags))
;; Actual table row
- (concat "\n" (eval (car org-e-html-table-row-tags))
+ (concat "\n" (eval (car org-html-table-row-tags))
contents
"\n"
- (eval (cdr org-e-html-table-row-tags)))
+ (eval (cdr org-html-table-row-tags)))
;; End a rowgroup?
(when (org-export-table-row-ends-rowgroup-p table-row info)
- (cdr rowgroup-tags))))))
+ (cdr rowgroup-tags))))))
;;;; Table
-(defun org-e-html-table-first-row-data-cells (table info)
+(defun org-html-table-first-row-data-cells (table info)
(let ((table-row
- (org-element-map
- table 'table-row
- (lambda (row)
- (unless (eq (org-element-property :type row) 'rule) row))
- info 'first-match))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (unless (eq (org-element-property :type row) 'rule) row))
+ info 'first-match))
(special-column-p (org-export-table-has-special-column-p table)))
(if (not special-column-p) (org-element-contents table-row)
(cdr (org-element-contents table-row)))))
-(defun org-e-html-table--table.el-table (table info)
+(defun org-html-table--table.el-table (table info)
(when (eq (org-element-property :type table) 'table.el)
(require 'table)
(let ((outbuf (with-current-buffer
@@ -2613,79 +2633,79 @@ communication channel."
(prog1 (org-trim (buffer-string))
(kill-buffer) )))))
-(defun org-e-html-table (table contents info)
+(defun org-html-table (table contents info)
"Transcode a TABLE element from Org to HTML.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
(case (org-element-property :type table)
;; Case 1: table.el table. Convert it using appropriate tools.
- (table.el (org-e-html-table--table.el-table table info))
+ (table.el (org-html-table--table.el-table table info))
;; Case 2: Standard table.
(t
(let* ((label (org-element-property :name table))
- (caption (org-export-get-caption table))
- (attributes (mapconcat #'identity
- (org-element-property :attr_html table)
- " "))
- (alignspec
- (if (and (boundp 'org-e-html-format-table-no-css)
- org-e-html-format-table-no-css)
- "align=\"%s\"" "class=\"%s\""))
- (table-column-specs
- (function
- (lambda (table info)
- (mapconcat
- (lambda (table-cell)
- (let ((alignment (org-export-table-cell-alignment
- table-cell info)))
- (concat
- ;; Begin a colgroup?
- (when (org-export-table-cell-starts-colgroup-p
- table-cell info)
- "\n<colgroup>")
- ;; Add a column. Also specify it's alignment.
- (format "\n<col %s/>" (format alignspec alignment))
- ;; End a colgroup?
- (when (org-export-table-cell-ends-colgroup-p
- table-cell info)
- "\n</colgroup>"))))
- (org-e-html-table-first-row-data-cells table info) "\n"))))
- (table-attributes
- (let ((table-tag (plist-get info :html-table-tag)))
- (concat
- (and (string-match "<table\\(.*\\)>" table-tag)
- (match-string 1 table-tag))
- (and label (format " id=\"%s\""
- (org-export-solidify-link-text label)))))))
+ (caption (org-export-get-caption table))
+ (attributes (mapconcat #'identity
+ (org-element-property :attr_html table)
+ " "))
+ (alignspec
+ (if (and (boundp 'org-html-format-table-no-css)
+ org-html-format-table-no-css)
+ "align=\"%s\"" "class=\"%s\""))
+ (table-column-specs
+ (function
+ (lambda (table info)
+ (mapconcat
+ (lambda (table-cell)
+ (let ((alignment (org-export-table-cell-alignment
+ table-cell info)))
+ (concat
+ ;; Begin a colgroup?
+ (when (org-export-table-cell-starts-colgroup-p
+ table-cell info)
+ "\n<colgroup>")
+ ;; Add a column. Also specify it's alignment.
+ (format "\n<col %s/>" (format alignspec alignment))
+ ;; End a colgroup?
+ (when (org-export-table-cell-ends-colgroup-p
+ table-cell info)
+ "\n</colgroup>"))))
+ (org-html-table-first-row-data-cells table info) "\n"))))
+ (table-attributes
+ (let ((table-tag (plist-get info :html-table-tag)))
+ (concat
+ (and (string-match "<table\\(.*\\)>" table-tag)
+ (match-string 1 table-tag))
+ (and label (format " id=\"%s\""
+ (org-export-solidify-link-text label)))))))
;; Remove last blank line.
(setq contents (substring contents 0 -1))
(format "<table%s>\n%s\n%s\n%s\n</table>"
- table-attributes
+ table-attributes
(if (not caption) ""
(format "<caption>%s</caption>"
(org-export-data caption info)))
- (funcall table-column-specs table info)
- contents)))))
+ (funcall table-column-specs table info)
+ contents)))))
;;;; Target
-(defun org-e-html-target (target contents info)
+(defun org-html-target (target contents info)
"Transcode a TARGET object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
(let ((id (org-export-solidify-link-text
(org-element-property :value target))))
- (org-e-html--anchor id)))
+ (org-html--anchor id)))
;;;; Timestamp
-(defun org-e-html-timestamp (timestamp contents info)
+(defun org-html-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (let ((value (org-e-html-plain-text
+ (let ((value (org-html-plain-text
(org-timestamp-translate timestamp) info)))
(format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
(replace-regexp-in-string "--" "&ndash;" value))))
@@ -2693,27 +2713,27 @@ information."
;;;; Underline
-(defun org-e-html-underline (underline contents info)
+(defun org-html-underline (underline contents info)
"Transcode UNDERLINE from Org to HTML.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
- (format (or (cdr (assq 'underline org-e-html-text-markup-alist)) "%s")
+ (format (or (cdr (assq 'underline org-html-text-markup-alist)) "%s")
contents))
;;;; Verbatim
-(defun org-e-html-verbatim (verbatim contents info)
+(defun org-html-verbatim (verbatim contents info)
"Transcode VERBATIM from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (format (or (cdr (assq 'verbatim org-e-html-text-markup-alist)) "%s")
+ (format (or (cdr (assq 'verbatim org-html-text-markup-alist)) "%s")
(org-element-property :value verbatim)))
;;;; Verse Block
-(defun org-e-html-verse-block (verse-block contents info)
+(defun org-html-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to HTML.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
@@ -2736,8 +2756,8 @@ contextual information."
;;; Filter Functions
-(defun org-e-html-final-function (contents backend info)
- (if (not org-e-html-pretty-output) contents
+(defun org-html-final-function (contents backend info)
+ (if (not org-html-pretty-output) contents
(with-temp-buffer
(html-mode)
(insert contents)
@@ -2749,7 +2769,7 @@ contextual information."
;;; End-user functions
;;;###autoload
-(defun org-e-html-export-as-html
+(defun org-html-export-as-html
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to an HTML buffer.
@@ -2776,22 +2796,22 @@ EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
-Export is done in a buffer named \"*Org E-HTML Export*\", which
+Export is done in a buffer named \"*Org HTML Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(if async
(org-export-async-start
(lambda (output)
- (with-current-buffer (get-buffer-create "*Org E-HTML Export*")
+ (with-current-buffer (get-buffer-create "*Org HTML Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(nxml-mode)
- (org-export-add-to-stack (current-buffer) 'e-html)))
- `(org-export-as 'e-html ,subtreep ,visible-only ,body-only ',ext-plist))
+ (org-export-add-to-stack (current-buffer) 'html)))
+ `(org-export-as 'html ,subtreep ,visible-only ,body-only ',ext-plist))
(let ((outbuf (org-export-to-buffer
- 'e-html "*Org E-HTML Export*"
+ 'html "*Org HTML Export*"
subtreep visible-only body-only ext-plist)))
;; Set major mode.
(with-current-buffer outbuf (nxml-mode))
@@ -2799,7 +2819,7 @@ is non-nil."
(switch-to-buffer-other-window outbuf)))))
;;;###autoload
-(defun org-e-html-export-to-html
+(defun org-html-export-to-html
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a HTML file.
@@ -2828,22 +2848,22 @@ file-local settings.
Return output file's name."
(interactive)
- (let* ((extension (concat "." org-e-html-extension))
+ (let* ((extension (concat "." org-html-extension))
(file (org-export-output-file-name extension subtreep))
- (org-export-coding-system org-e-html-coding-system))
+ (org-export-coding-system org-html-coding-system))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-latex))
- (let ((org-export-coding-system org-e-html-coding-system))
+ (lambda (f) (org-export-add-to-stack f 'html))
+ (let ((org-export-coding-system org-html-coding-system))
`(expand-file-name
(org-export-to-file
- 'e-html ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
- (let ((org-export-coding-system org-e-html-coding-system))
+ 'html ,file ,subtreep ,visible-only ,body-only ',ext-plist))))
+ (let ((org-export-coding-system org-html-coding-system))
(org-export-to-file
- 'e-html file subtreep visible-only body-only ext-plist)))))
+ 'html file subtreep visible-only body-only ext-plist)))))
;;;###autoload
-(defun org-e-html-publish-to-html (plist filename pub-dir)
+(defun org-html-publish-to-html (plist filename pub-dir)
"Publish an org file to HTML.
FILENAME is the filename of the Org file to be published. PLIST
@@ -2851,7 +2871,7 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to 'e-html filename ".html" plist pub-dir))
+ (org-publish-org-to 'html filename ".html" plist pub-dir))
@@ -2862,10 +2882,10 @@ Return output file name."
;;;; org-format-table-table-html
;;;; org-table-number-fraction
;;;; org-table-number-regexp
-;;;; org-e-html-table-caption-above
+;;;; org-html-table-caption-above
-;;;; org-e-html-with-timestamp
-;;;; org-e-html-html-helper-timestamp
+;;;; org-html-with-timestamp
+;;;; org-html-html-helper-timestamp
;;;; org-export-as-html-and-open
;;;; org-export-as-html-batch
@@ -2876,15 +2896,15 @@ Return output file name."
;;;; (org-export-directory :html opt-plist)
;;;; (plist-get opt-plist :html-extension)
-;;;; org-e-html-toplevel-hlevel
-;;;; org-e-html-special-string-regexps
-;;;; org-e-html-inline-images
-;;;; org-e-html-inline-image-extensions
-;;;; org-e-html-protect-char-alist
-;;;; org-e-html-table-use-header-tags-for-first-column
-;;;; org-e-html-todo-kwd-class-prefix
-;;;; org-e-html-tag-class-prefix
-;;;; org-e-html-footnote-separator
+;;;; org-html-toplevel-hlevel
+;;;; org-html-special-string-regexps
+;;;; org-html-inline-images
+;;;; org-html-inline-image-extensions
+;;;; org-html-protect-char-alist
+;;;; org-html-table-use-header-tags-for-first-column
+;;;; org-html-todo-kwd-class-prefix
+;;;; org-html-tag-class-prefix
+;;;; org-html-footnote-separator
;;;; org-export-preferred-target-alist
;;;; org-export-solidify-link-text
@@ -2892,11 +2912,16 @@ Return output file name."
;;;; org-export-with-section-numbers, body-only
;;;; org-export-mark-todo-in-toc
-;;;; org-e-html-format-org-link
+;;;; org-html-format-org-link
;;;; (caption (and caption (org-xml-encode-org-text caption)))
;;;; alt = (file-name-nondirectory path)
;;;; org-export-time-stamp-file'
-(provide 'org-e-html)
-;;; org-e-html.el ends here
+(provide 'ox-html)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-html.el ends here
diff --git a/contrib/lisp/org-e-icalendar.el b/lisp/ox-icalendar.el
index ff69d5e..498a43f 100644
--- a/contrib/lisp/org-e-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -1,4 +1,4 @@
-;;; org-e-icalendar.el --- iCalendar Back-End for Org Export Engine
+;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine
;; Copyright (C) 2004-2012 Free Software Foundation, Inc.
@@ -26,14 +26,14 @@
;; exporter.
;;
;; It provides three commands for export, depending on the chosen
-;; source and desired output: `org-e-icalendar-export-to-ics' (current
-;; file), `org-e-icalendar-export-agenda-files' (agenda files into
-;; separate calendars) and `org-e-icalendar-combined-agenda-file'
+;; source and desired output: `org-icalendar-export-to-ics' (current
+;; file), `org-icalendar-export-agenda-files' (agenda files into
+;; separate calendars) and `org-icalendar-combined-agenda-file'
;; (agenda files into one combined calendar).
;;
-;; It also provides the `org-e-icalendar-export-current-agenda'
-;; function, which will create a calendar file from current agenda
-;; view. It is meant to be called through `org-agenda-write'.
+;; It also provides `org-icalendar-export-current-agenda' function,
+;; which will create a calendar file from current agenda view. It is
+;; meant to be called through `org-agenda-write'.
;;
;; This back-end introduces a new keyword, ICALENDAR_EXCLUDE_TAGS,
;; which allows to specify a different set of exclude tags from other
@@ -43,26 +43,26 @@
;;; Code:
-(require 'org-e-ascii)
+(require 'ox-ascii)
(declare-function org-bbdb-anniv-export-ical "org-bbdb" nil)
;;; User-Configurable Variables
-(defgroup org-export-e-icalendar nil
+(defgroup org-export-icalendar nil
"Options specific for iCalendar export back-end."
:tag "Org iCalendar"
:group 'org-export)
-(defcustom org-e-icalendar-combined-agenda-file "~/org.ics"
+(defcustom org-icalendar-combined-agenda-file "~/org.ics"
"The file name for the iCalendar file covering all agenda files.
-This file is created with the command \\[org-e-icalendar-combine-agenda-files].
+This file is created with the command \\[org-icalendar-combine-agenda-files].
The file name should be absolute. It will be overwritten without warning."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'file)
-(defcustom org-e-icalendar-alarm-time 0
+(defcustom org-icalendar-alarm-time 0
"Number of minutes for triggering an alarm for exported timed events.
A zero value (the default) turns off the definition of an alarm trigger
@@ -71,36 +71,36 @@ for timed events. If non-zero, alarms are created.
- a single alarm per entry is defined
- The alarm will go off N minutes before the event
- only a DISPLAY action is defined."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:version "24.1"
:type 'integer)
-(defcustom org-e-icalendar-combined-name "OrgMode"
+(defcustom org-icalendar-combined-name "OrgMode"
"Calendar name for the combined iCalendar representing all agenda files."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'string)
-(defcustom org-e-icalendar-combined-description ""
+(defcustom org-icalendar-combined-description ""
"Calendar description for the combined iCalendar (all agenda files)."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'string)
-(defcustom org-e-icalendar-exclude-tags nil
+(defcustom org-icalendar-exclude-tags nil
"Tags that exclude a tree from export.
This variable allows to specify different exclude tags from other
back-ends. It can also be set with the ICAL_EXCLUDE_TAGS
keyword."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(repeat (string :tag "Tag")))
-(defcustom org-e-icalendar-use-deadline '(event-if-not-todo todo-due)
+(defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
"Contexts where iCalendar export should use a deadline time stamp.
This is a list with several symbols in it. Valid symbol are:
`event-if-todo' Deadlines in TODO entries become calendar events.
`event-if-not-todo' Deadlines in non-TODO entries become calendar events.
`todo-due' Use deadlines in TODO entries as due-dates"
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(set :greedy t
(const :tag "Deadlines in non-TODO entries become events"
event-if-not-todo)
@@ -109,7 +109,7 @@ This is a list with several symbols in it. Valid symbol are:
(const :tag "Deadlines in TODO entries become due-dates"
todo-due)))
-(defcustom org-e-icalendar-use-scheduled '(todo-start)
+(defcustom org-icalendar-use-scheduled '(todo-start)
"Contexts where iCalendar export should use a scheduling time stamp.
This is a list with several symbols in it. Valid symbol are:
@@ -118,7 +118,7 @@ This is a list with several symbols in it. Valid symbol are:
`todo-start' Scheduling time stamps in TODO entries become start date.
Some calendar applications show TODO entries only after
that date."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(set :greedy t
(const :tag
"SCHEDULED timestamps in non-TODO entries become events"
@@ -128,7 +128,7 @@ This is a list with several symbols in it. Valid symbol are:
(const :tag "SCHEDULED in TODO entries become start date"
todo-start)))
-(defcustom org-e-icalendar-categories '(local-tags category)
+(defcustom org-icalendar-categories '(local-tags category)
"Items that should be entered into the \"categories\" field.
This is a list of symbols, the following are valid:
@@ -136,7 +136,7 @@ This is a list of symbols, the following are valid:
`todo-state' The todo state, if any
`local-tags' The tags, defined in the current line
`all-tags' All tags, including inherited ones."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(repeat
(choice
(const :tag "The file or tree category" category)
@@ -144,7 +144,7 @@ This is a list of symbols, the following are valid:
(const :tag "Tags defined in current line" local-tags)
(const :tag "All tags, including inherited ones" all-tags))))
-(defcustom org-e-icalendar-with-timestamps 'active
+(defcustom org-icalendar-with-timestamps 'active
"Non-nil means make an event from plain time stamps.
It can be set to `active', `inactive', t or nil, in order to make
@@ -153,14 +153,14 @@ inactive ones, all of them or none.
This variable has precedence over `org-export-with-timestamps'.
It can also be set with the #+OPTIONS line, e.g. \"<:t\"."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(choice
(const :tag "All timestamps" t)
(const :tag "Only active timestamps" active)
(const :tag "Only inactive timestamps" inactive)
(const :tag "No timestamp" nil)))
-(defcustom org-e-icalendar-include-todo nil
+(defcustom org-icalendar-include-todo nil
"Non-nil means create VTODO components from TODO items.
Valid values are:
@@ -168,7 +168,7 @@ nil don't include any task.
t include tasks that are not in DONE state.
`unblocked' include all TODO items that are not blocked.
`all' include both done and not done items."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(choice
(const :tag "None" nil)
(const :tag "Unfinished" t)
@@ -177,31 +177,31 @@ t include tasks that are not in DONE state.
(repeat :tag "Specific TODO keywords"
(string :tag "Keyword"))))
-(defcustom org-e-icalendar-include-bbdb-anniversaries nil
+(defcustom org-icalendar-include-bbdb-anniversaries nil
"Non-nil means a combined iCalendar file should include anniversaries.
The anniversaries are defined in the BBDB database."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'boolean)
-(defcustom org-e-icalendar-include-sexps t
+(defcustom org-icalendar-include-sexps t
"Non-nil means export to iCalendar files should also cover sexp entries.
These are entries like in the diary, but directly in an Org mode
file."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'boolean)
-(defcustom org-e-icalendar-include-body t
+(defcustom org-icalendar-include-body t
"Amount of text below headline to be included in iCalendar export.
This is a number of characters that should maximally be included.
Properties, scheduling and clocking lines will always be removed.
The text will be inserted into the DESCRIPTION field."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(choice
(const :tag "Nothing" nil)
(const :tag "Everything" t)
(integer :tag "Max characters")))
-(defcustom org-e-icalendar-store-UID nil
+(defcustom org-icalendar-store-UID nil
"Non-nil means store any created UIDs in properties.
The iCalendar standard requires that all entries have a unique identifier.
@@ -214,29 +214,29 @@ synchronization services.
This variable is not turned on by default because we want to avoid creating
a property drawer in every entry if people are only playing with this feature,
or if they are only using it locally."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type 'boolean)
-(defcustom org-e-icalendar-timezone (getenv "TZ")
+(defcustom org-icalendar-timezone (getenv "TZ")
"The time zone string for iCalendar export.
When nil or the empty string, use output
from (current-time-zone)."
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:type '(choice
(const :tag "Unspecified" nil)
(string :tag "Time zone")))
-(defcustom org-e-icalendar-date-time-format ":%Y%m%dT%H%M%S"
+(defcustom org-icalendar-date-time-format ":%Y%m%dT%H%M%S"
"Format-string for exporting icalendar DATE-TIME.
See `format-time-string' for a full documentation. The only
-difference is that `org-e-icalendar-timezone' is used for %Z.
+difference is that `org-icalendar-timezone' is used for %Z.
Interesting value are:
- \":%Y%m%dT%H%M%S\" for local time
- \";TZID=%Z:%Y%m%dT%H%M%S\" for local time with explicit timezone
- \":%Y%m%dT%H%M%SZ\" for time expressed in Universal Time"
- :group 'org-export-e-icalendar
+ :group 'org-export-icalendar
:version "24.1"
:type '(choice
(const :tag "Local time" ":%Y%m%dT%H%M%S")
@@ -244,7 +244,7 @@ Interesting value are:
(const :tag "Universal time" ":%Y%m%dT%H%M%SZ")
(string :tag "Explicit format")))
-(defvar org-e-icalendar-after-save-hook nil
+(defvar org-icalendar-after-save-hook nil
"Hook run after an iCalendar file has been saved.
This hook is run with the name of the file as argument. A good
way to use this is to tell a desktop calendar application to
@@ -254,37 +254,37 @@ re-read the iCalendar file.")
;;; Define Back-End
-(org-export-define-derived-backend e-icalendar e-ascii
+(org-export-define-derived-backend icalendar ascii
:translate-alist ((clock . ignore)
- (headline . org-e-icalendar-entry)
+ (headline . org-icalendar-entry)
(inlinetask . ignore)
(planning . ignore)
(section . ignore)
- (template . org-e-icalendar-template))
+ (template . org-icalendar-template))
:options-alist
((:exclude-tags
- "ICALENDAR_EXCLUDE_TAGS" nil org-e-icalendar-exclude-tags split)
- (:with-timestamps nil "<" org-e-icalendar-with-timestamps)
- (:with-vtodo nil nil org-e-icalendar-include-todo)
+ "ICALENDAR_EXCLUDE_TAGS" nil org-icalendar-exclude-tags split)
+ (:with-timestamps nil "<" org-icalendar-with-timestamps)
+ (:with-vtodo nil nil org-icalendar-include-todo)
;; The following property will be non-nil when export has been
;; started from org-agenda-mode. In this case, any entry without
;; a non-nil "ICALENDAR_MARK" property will be ignored.
(:icalendar-agenda-view nil nil nil))
:filters-alist
- ((:filter-headline . org-e-icalendar-clear-blank-lines))
+ ((:filter-headline . org-icalendar-clear-blank-lines))
:menu-entry
(?c "Export to iCalendar"
- ((?f "Current file" org-e-icalendar-export-to-ics)
+ ((?f "Current file" org-icalendar-export-to-ics)
(?a "All agenda files"
- (lambda (a s v b) (org-e-icalendar-export-agenda-files a)))
+ (lambda (a s v b) (org-icalendar-export-agenda-files a)))
(?c "Combine all agenda files"
- (lambda (a s v b) (org-e-icalendar-combine-agenda-files a))))))
+ (lambda (a s v b) (org-icalendar-combine-agenda-files a))))))
;;; Internal Functions
-(defun org-e-icalendar-create-uid (file &optional bell)
+(defun org-icalendar-create-uid (file &optional bell)
"Set ID property on headlines missing it in FILE.
When optional argument BELL is non-nil, inform the user with
a message if the file was modified."
@@ -303,7 +303,7 @@ a message if the file was modified."
(message "ID properties created in file \"%s\"" file)
(sit-for 2))))
-(defun org-e-icalendar-blocked-headline-p (headline info)
+(defun org-icalendar-blocked-headline-p (headline info)
"Non-nil when HEADLINE is considered to be blocked.
INFO is a plist used as a communication channel.
@@ -319,10 +319,9 @@ An headline is blocked when either:
done first or is a child of a blocked grandparent entry."
(or
;; Check if any child is not done.
- (org-element-map
- headline 'headline
- (lambda (hl) (eq (org-element-property :todo-type hl) 'todo))
- info 'first-match)
+ (org-element-map headline 'headline
+ (lambda (hl) (eq (org-element-property :todo-type hl) 'todo))
+ info 'first-match)
;; Check :ORDERED: node property.
(catch 'blockedp
(let ((current headline))
@@ -340,13 +339,13 @@ An headline is blocked when either:
(org-export-get-genealogy headline))
nil))))
-(defun org-e-icalendar-use-UTC-date-time-p ()
- "Non-nil when `org-e-icalendar-date-time-format' requires UTC time."
- (char-equal (elt org-e-icalendar-date-time-format
- (1- (length org-e-icalendar-date-time-format))) ?Z))
+(defun org-icalendar-use-UTC-date-time-p ()
+ "Non-nil when `org-icalendar-date-time-format' requires UTC time."
+ (char-equal (elt org-icalendar-date-time-format
+ (1- (length org-icalendar-date-time-format))) ?Z))
(defvar org-agenda-default-appointment-duration) ; From org-agenda.el.
-(defun org-e-icalendar-convert-timestamp (timestamp keyword &optional end utc)
+(defun org-icalendar-convert-timestamp (timestamp keyword &optional end utc)
"Convert TIMESTAMP to iCalendar format.
TIMESTAMP is a timestamp object. KEYWORD is added in front of
@@ -358,7 +357,7 @@ or the day by one (if it does not contain a time) when no
explicit ending time is specified.
When optional argument UTC is non-nil, time will be expressed in
-Universal Time, ignoring `org-e-icalendar-date-time-format'.
+Universal Time, ignoring `org-icalendar-date-time-format'.
This is mandatory for \"DTSTAMP\" property."
(let* ((year-start (org-element-property :year-start timestamp))
(year-end (org-element-property :year-end timestamp))
@@ -396,16 +395,16 @@ This is mandatory for \"DTSTAMP\" property."
(cond (utc ":%Y%m%dT%H%M%SZ")
((not with-time-p) ";VALUE=DATE:%Y%m%d")
(t (replace-regexp-in-string "%Z"
- org-e-icalendar-timezone
- org-e-icalendar-date-time-format
+ org-icalendar-timezone
+ org-icalendar-date-time-format
t)))
;; Convert timestamp into internal time in order to use
;; `format-time-string' and fix any mistake (i.e. MI >= 60).
(encode-time 0 mi h d m y)
- (or utc (and with-time-p (org-e-icalendar-use-UTC-date-time-p)))))))
+ (or utc (and with-time-p (org-icalendar-use-UTC-date-time-p)))))))
-(defun org-e-icalendar-get-categories (entry info)
- "Return categories according to `org-e-icalendar-categories'.
+(defun org-icalendar-get-categories (entry info)
+ "Return categories according to `org-icalendar-categories'.
ENTRY is an headline or an inlinetask element. INFO is a plist
used as a communication channel."
(mapconcat
@@ -427,11 +426,11 @@ used as a communication channel."
(setq categories
(append (nreverse (org-export-get-tags entry info nil t))
categories)))))
- org-e-icalendar-categories)
+ org-icalendar-categories)
;; Return list of categories, following specified order.
(nreverse categories))) ","))
-(defun org-e-icalendar-transcode-diary-sexp (sexp uid summary)
+(defun org-icalendar-transcode-diary-sexp (sexp uid summary)
"Transcode a diary sexp into iCalendar format.
SEXP is the diary sexp being transcoded, as a string. UID is the
unique identifier for the entry. SUMMARY defines a short summary
@@ -445,7 +444,7 @@ or subject for the event."
(insert sexp "\n"))
(org-diary-to-ical-string (current-buffer))))))
-(defun org-e-icalendar-cleanup-string (s)
+(defun org-icalendar-cleanup-string (s)
"Cleanup string S according to RFC 5545."
(when s
;; Protect "\", "," and ";" characters. and replace newline
@@ -455,7 +454,7 @@ or subject for the event."
(replace-regexp-in-string "[\\,;]" "\\\&" s)
nil t)))
-(defun org-e-icalendar-fold-string (s)
+(defun org-icalendar-fold-string (s)
"Fold string S according to RFC 5545."
(org-element-normalize-string
(mapconcat
@@ -481,7 +480,7 @@ or subject for the event."
;;; Filters
-(defun org-e-icalendar-clear-blank-lines (headline back-end info)
+(defun org-icalendar-clear-blank-lines (headline back-end info)
"Remove trailing blank lines in HEADLINE export.
HEADLINE is a string representing a transcoded headline.
BACK-END and INFO are ignored."
@@ -493,16 +492,16 @@ BACK-END and INFO are ignored."
;;;; Headline and Inlinetasks
-;; The main function is `org-e-icalendar-entry', which extracts
+;; The main function is `org-icalendar-entry', which extracts
;; information from an headline or an inlinetask (summary,
;; description...) and then delegates code generation to
-;; `org-e-icalendar--vtodo' and `org-e-icalendar--vevent', depending
+;; `org-icalendar--vtodo' and `org-icalendar--vevent', depending
;; on the component needed.
-;; Obviously, `org-e-icalendar--valarm' handles alarms, which can
+;; Obviously, `org-icalendar--valarm' handles alarms, which can
;; happen within a VTODO component.
-(defun org-e-icalendar-entry (entry contents info)
+(defun org-icalendar-entry (entry contents info)
"Transcode ENTRY element into iCalendar format.
ENTRY is either an headline or an inlinetask. CONTENTS is
@@ -530,43 +529,43 @@ inlinetask within the section."
(not (org-element-property :icalendar-mark entry)))
(let ((todo-type (org-element-property :todo-type entry))
(uid (or (org-element-property :id entry) (org-id-new)))
- (summary (org-e-icalendar-cleanup-string
+ (summary (org-icalendar-cleanup-string
(or (org-element-property :summary entry)
(org-export-data
(org-element-property :title entry) info))))
- (loc (org-e-icalendar-cleanup-string
+ (loc (org-icalendar-cleanup-string
(org-element-property :location entry)))
;; Build description of the entry from associated
;; section (headline) or contents (inlinetask).
(desc
- (org-e-icalendar-cleanup-string
+ (org-icalendar-cleanup-string
(or (org-element-property :description entry)
(let ((contents (org-export-data inside info)))
(cond
((not (org-string-nw-p contents)) nil)
- ((wholenump org-e-icalendar-include-body)
+ ((wholenump org-icalendar-include-body)
(let ((contents (org-trim contents)))
(substring
contents 0 (min (length contents)
- org-e-icalendar-include-body))))
- (org-e-icalendar-include-body (org-trim contents)))))))
- (cat (org-e-icalendar-get-categories entry info)))
+ org-icalendar-include-body))))
+ (org-icalendar-include-body (org-trim contents)))))))
+ (cat (org-icalendar-get-categories entry info)))
(concat
- ;; Events: Delegate to `org-e-icalendar--vevent' to
+ ;; Events: Delegate to `org-icalendar--vevent' to
;; generate "VEVENT" component from scheduled, deadline,
;; or any timestamp in the entry.
(let ((deadline (org-element-property :deadline entry)))
(and deadline
(memq (if todo-type 'event-if-todo 'event-if-not-todo)
- org-e-icalendar-use-deadline)
- (org-e-icalendar--vevent
+ org-icalendar-use-deadline)
+ (org-icalendar--vevent
entry deadline (concat "DL-" uid)
(concat "DL: " summary) loc desc cat)))
(let ((scheduled (org-element-property :scheduled entry)))
(and scheduled
(memq (if todo-type 'event-if-todo 'event-if-not-todo)
- org-e-icalendar-use-scheduled)
- (org-e-icalendar--vevent
+ org-icalendar-use-scheduled)
+ (org-icalendar--vevent
entry scheduled (concat "SC-" uid)
(concat "S: " summary) loc desc cat)))
;; When collecting plain timestamps from an headline and
@@ -575,58 +574,56 @@ inlinetask within the section."
(let ((counter 0))
(mapconcat
'identity
- (org-element-map
- (cons (org-element-property :title entry)
- (org-element-contents inside))
- 'timestamp
- (lambda (ts)
- (let ((uid (format "TS%d-%s" (incf counter) uid)))
- (org-e-icalendar--vevent entry ts uid summary loc desc cat)))
- info nil (and (eq type 'headline) 'inlinetask))
+ (org-element-map (cons (org-element-property :title entry)
+ (org-element-contents inside))
+ 'timestamp
+ (lambda (ts)
+ (let ((uid (format "TS%d-%s" (incf counter) uid)))
+ (org-icalendar--vevent entry ts uid summary loc desc cat)))
+ info nil (and (eq type 'headline) 'inlinetask))
""))
;; Task: First check if it is appropriate to export it.
- ;; If so, call `org-e-icalendar--vtodo' to transcode it
+ ;; If so, call `org-icalendar--vtodo' to transcode it
;; into a "VTODO" component.
(when (and todo-type
(case (plist-get info :with-vtodo)
(all t)
(unblocked
(and (eq type 'headline)
- (not (org-e-icalendar-blocked-headline-p
+ (not (org-icalendar-blocked-headline-p
entry info))))
('t (eq todo-type 'todo))))
- (org-e-icalendar--vtodo entry uid summary loc desc cat))
+ (org-icalendar--vtodo entry uid summary loc desc cat))
;; Diary-sexp: Collect every diary-sexp element within
;; ENTRY and its title, and transcode them. If ENTRY is
;; an headline, skip inlinetasks: they will be handled
;; separately.
- (when org-e-icalendar-include-sexps
+ (when org-icalendar-include-sexps
(let ((counter 0))
(mapconcat 'identity
(org-element-map
- (cons (org-element-property :title entry)
- (org-element-contents inside))
- 'diary-sexp
- (lambda (sexp)
- (org-e-icalendar-transcode-diary-sexp
- (org-element-property :value sexp)
- (format "DS%d-%s" (incf counter) uid)
- summary))
- info nil (and (eq type 'headline) 'inlinetask))
+ (cons (org-element-property :title entry)
+ (org-element-contents inside))
+ 'diary-sexp
+ (lambda (sexp)
+ (org-icalendar-transcode-diary-sexp
+ (org-element-property :value sexp)
+ (format "DS%d-%s" (incf counter) uid)
+ summary))
+ info nil (and (eq type 'headline) 'inlinetask))
""))))))
;; If ENTRY is an headline, call current function on every
;; inlinetask within it. In agenda export, this is independent
;; from the mark (or lack thereof) on the entry.
(when (eq type 'headline)
(mapconcat 'identity
- (org-element-map
- inside 'inlinetask
- (lambda (task) (org-e-icalendar-entry task nil info))
- info) ""))
+ (org-element-map inside 'inlinetask
+ (lambda (task) (org-icalendar-entry task nil info))
+ info) ""))
;; Don't forget components from inner entries.
contents))))
-(defun org-e-icalendar--vevent
+(defun org-icalendar--vevent
(entry timestamp uid summary location description categories)
"Create a VEVENT component.
@@ -639,15 +636,15 @@ description of the event. CATEGORIES defines the categories the
event belongs to.
Return VEVENT component as a string."
- (org-e-icalendar-fold-string
+ (org-icalendar-fold-string
(if (eq (org-element-property :type timestamp) 'diary)
- (org-e-icalendar-transcode-diary-sexp
+ (org-icalendar-transcode-diary-sexp
(org-element-property :raw-value timestamp) uid summary)
(concat "BEGIN:VEVENT\n"
- (org-e-icalendar-convert-timestamp timestamp "DTSTAMP" nil t) "\n"
+ (org-icalendar-convert-timestamp timestamp "DTSTAMP" nil t) "\n"
"UID:" uid "\n"
- (org-e-icalendar-convert-timestamp timestamp "DTSTART") "\n"
- (org-e-icalendar-convert-timestamp timestamp "DTEND" t) "\n"
+ (org-icalendar-convert-timestamp timestamp "DTSTART") "\n"
+ (org-icalendar-convert-timestamp timestamp "DTEND" t) "\n"
;; RRULE.
(when (org-element-property :repeater-type timestamp)
(format "RRULE:FREQ=%s;INTERVAL=%d\n"
@@ -661,10 +658,10 @@ Return VEVENT component as a string."
(format "DESCRIPTION:%s\n" description))
"CATEGORIES:" categories "\n"
;; VALARM.
- (org-e-icalendar--valarm entry timestamp summary)
+ (org-icalendar--valarm entry timestamp summary)
"END:VEVENT"))))
-(defun org-e-icalendar--vtodo
+(defun org-icalendar--vtodo
(entry uid summary location description categories)
"Create a VTODO component.
@@ -675,7 +672,7 @@ the task. DESCRIPTION provides the complete description of the
task. CATEGORIES defines the categories the task belongs to.
Return VTODO component as a string."
- (let ((start (or (and (memq 'todo-start org-e-icalendar-use-scheduled)
+ (let ((start (or (and (memq 'todo-start org-icalendar-use-scheduled)
(org-element-property :scheduled entry))
;; If we can't use a scheduled time for some
;; reason, start task now.
@@ -687,14 +684,14 @@ Return VTODO component as a string."
:day-start (nth 3 now)
:month-start (nth 4 now)
:year-start (nth 5 now)))))))
- (org-e-icalendar-fold-string
+ (org-icalendar-fold-string
(concat "BEGIN:VTODO\n"
"UID:TODO-" uid "\n"
- (org-e-icalendar-convert-timestamp start "DTSTAMP" nil t) "\n"
- (org-e-icalendar-convert-timestamp start "DTSTART") "\n"
- (and (memq 'todo-due org-e-icalendar-use-deadline)
+ (org-icalendar-convert-timestamp start "DTSTAMP" nil t) "\n"
+ (org-icalendar-convert-timestamp start "DTSTART") "\n"
+ (and (memq 'todo-due org-icalendar-use-deadline)
(org-element-property :deadline entry)
- (concat (org-e-icalendar-convert-timestamp
+ (concat (org-icalendar-convert-timestamp
(org-element-property :deadline entry) "DUE")
"\n"))
"SUMMARY:" summary "\n"
@@ -715,7 +712,7 @@ Return VTODO component as a string."
"COMPLETED"))
"END:VTODO"))))
-(defun org-e-icalendar--valarm (entry timestamp summary)
+(defun org-icalendar--valarm (entry timestamp summary)
"Create a VALARM component.
ENTRY is the calendar entry triggering the alarm. TIMESTAMP is
@@ -733,7 +730,7 @@ Return VALARM component as a string, or nil if it isn't allowed."
(let ((warntime
(org-element-property :appt-warntime entry)))
(if warntime (string-to-number warntime) 0))))
- (and (or (> alarm-time 0) (> org-e-icalendar-alarm-time 0))
+ (and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
(org-element-property :hour-start timestamp)
(format "BEGIN:VALARM
ACTION:DISPLAY
@@ -741,16 +738,16 @@ DESCRIPTION:%s
TRIGGER:-P0DT0H%dM0S
END:VALARM\n"
summary
- (if (zerop alarm-time) org-e-icalendar-alarm-time alarm-time)))))
+ (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)))))
;;;; Template
-(defun org-e-icalendar-template (contents info)
+(defun org-icalendar-template (contents info)
"Return complete document string after iCalendar conversion.
CONTENTS is the transcoded contents string. INFO is a plist used
as a communication channel."
- (org-e-icalendar--vcalendar
+ (org-icalendar--vcalendar
;; Name.
(if (not (plist-get info :input-file)) (buffer-name (buffer-base-buffer))
(file-name-nondirectory
@@ -759,13 +756,13 @@ as a communication channel."
(if (not (plist-get info :with-author)) ""
(org-export-data (plist-get info :author) info))
;; Timezone.
- (if (org-string-nw-p org-e-icalendar-timezone) org-e-icalendar-timezone
+ (if (org-string-nw-p org-icalendar-timezone) org-icalendar-timezone
(cadr (current-time-zone)))
;; Description.
(org-export-data (plist-get info :title) info)
contents))
-(defun org-e-icalendar--vcalendar (name owner tz description contents)
+(defun org-icalendar--vcalendar (name owner tz description contents)
"Create a VCALENDAR component.
NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving,
respectively, the name of the calendar, its owner, the timezone
@@ -777,10 +774,10 @@ PRODID:-//%s//Emacs with Org mode//EN
X-WR-TIMEZONE:%s
X-WR-CALDESC:%s
CALSCALE:GREGORIAN\n"
- (org-e-icalendar-cleanup-string name)
- (org-e-icalendar-cleanup-string owner)
- (org-e-icalendar-cleanup-string tz)
- (org-e-icalendar-cleanup-string description))
+ (org-icalendar-cleanup-string name)
+ (org-icalendar-cleanup-string owner)
+ (org-icalendar-cleanup-string tz)
+ (org-icalendar-cleanup-string description))
contents
"END:VCALENDAR\n"))
@@ -789,7 +786,7 @@ CALSCALE:GREGORIAN\n"
;;; Interactive Functions
;;;###autoload
-(defun org-e-icalendar-export-to-ics
+(defun org-icalendar-export-to-ics
(&optional async subtreep visible-only body-only)
"Export current buffer to an iCalendar file.
@@ -815,29 +812,29 @@ between \"BEGIN:VCALENDAR\" and \"END:VCALENDAR\".
Return ICS file name."
(interactive)
(let ((file (buffer-file-name (buffer-base-buffer))))
- (when (and file org-e-icalendar-store-UID)
- (org-e-icalendar-create-uid file 'warn-user)))
+ (when (and file org-icalendar-store-UID)
+ (org-icalendar-create-uid file 'warn-user)))
;; Export part. Since this back-end is backed up by `e-ascii',
;; ensure links will not be collected at the end of sections.
(let ((outfile (org-export-output-file-name ".ics" subtreep)))
(if async
(org-export-async-start
(lambda (f)
- (org-export-add-to-stack f 'e-icalendar)
- (run-hook-with-args 'org-e-icalendar-after-save-hook f))
- `(let ((org-e-ascii-links-to-notes nil))
+ (org-export-add-to-stack f 'icalendar)
+ (run-hook-with-args 'org-icalendar-after-save-hook f))
+ `(let ((org-ascii-links-to-notes nil))
(expand-file-name
(org-export-to-file
- 'e-icalendar ,outfile ,subtreep ,visible-only ,body-only
+ 'icalendar ,outfile ,subtreep ,visible-only ,body-only
'(:ascii-charset utf-8)))))
- (let ((org-e-ascii-links-to-notes nil))
- (org-export-to-file 'e-icalendar outfile subtreep visible-only body-only
+ (let ((org-ascii-links-to-notes nil))
+ (org-export-to-file 'icalendar outfile subtreep visible-only body-only
'(:ascii-charset utf-8)))
- (run-hook-with-args 'org-e-icalendar-after-save-hook outfile)
+ (run-hook-with-args 'org-icalendar-after-save-hook outfile)
outfile)))
;;;###autoload
-(defun org-e-icalendar-export-agenda-files (&optional async)
+(defun org-icalendar-export-agenda-files (&optional async)
"Export all agenda files to iCalendar files.
When optional argument ASYNC is non-nil, export happens in an
external process."
@@ -854,7 +851,7 @@ external process."
`(let (output-files)
(mapc (lambda (file)
(with-current-buffer (org-get-agenda-file-buffer file)
- (push (expand-file-name (org-e-icalendar-export-to-ics))
+ (push (expand-file-name (org-icalendar-export-to-ics))
output-files)))
',files)
output-files)))
@@ -865,12 +862,12 @@ external process."
(catch 'nextfile
(org-check-agenda-file file)
(with-current-buffer (org-get-agenda-file-buffer file)
- (org-e-icalendar-export-to-ics))))
+ (org-icalendar-export-to-ics))))
files)
(org-release-buffers org-agenda-new-buffers)))))
;;;###autoload
-(defun org-e-icalendar-combine-agenda-files (&optional async)
+(defun org-icalendar-combine-agenda-files (&optional async)
"Combine all agenda files into a single iCalendar file.
A non-nil optional argument ASYNC means the process should happen
@@ -878,28 +875,30 @@ asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
The file is stored under the name chosen in
-`org-e-icalendar-combined-agenda-file'."
+`org-icalendar-combined-agenda-file'."
(interactive)
(if async
(let ((files (org-remove-if-not 'file-exists-p (org-agenda-files t))))
(org-export-async-start
(lambda (dummy)
(org-export-add-to-stack
- (expand-file-name org-e-icalendar-combined-agenda-file)
- 'e-icalendar))
- `(apply 'org-e-icalendar--combine-files nil ',files)))
- (apply 'org-e-icalendar--combine-files nil (org-agenda-files t))))
-
-(defun org-e-icalendar-export-current-agenda ()
- "Export current agenda view to an iCalendar file.
-The file is stored under the name
-`org-e-icalendar-combined-agenda-file'. This function assumes
-major mode for current buffer is `org-agenda-mode'."
- (apply 'org-e-icalendar--combine-files
- (org-create-marker-find-array (org-agenda-collect-markers))
- (org-agenda-files nil 'ifmode)))
-
-(defun org-e-icalendar--combine-files (restriction &rest files)
+ (expand-file-name org-icalendar-combined-agenda-file)
+ 'icalendar))
+ `(apply 'org-icalendar--combine-files nil ',files)))
+ (apply 'org-icalendar--combine-files nil (org-agenda-files t))))
+
+(declare-function org-agenda-collect-markers "org-agenda" ())
+(declare-function org-create-marker-find-array "org-agenda" (marker-list))
+(defun org-icalendar-export-current-agenda (file)
+ "Export current agenda view to an iCalendar FILE.
+This function assumes major mode for current buffer is
+`org-agenda-mode'."
+ (let ((org-icalendar-combined-agenda-file file))
+ (apply 'org-icalendar--combine-files
+ (org-create-marker-find-array (org-agenda-collect-markers))
+ (org-agenda-files nil 'ifmode))))
+
+(defun org-icalendar--combine-files (restriction &rest files)
"Combine entries from multiple files into an iCalendar file.
RESTRICTION, when non-nil, is an alist where key is a file name
and value a list of buffer positions pointing to entries that
@@ -909,19 +908,19 @@ files to build the calendar from."
(org-agenda-prepare-buffers files)
(unwind-protect
(progn
- (with-temp-file org-e-icalendar-combined-agenda-file
+ (with-temp-file org-icalendar-combined-agenda-file
(insert
- (org-e-icalendar--vcalendar
+ (org-icalendar--vcalendar
;; Name.
- org-e-icalendar-combined-name
+ org-icalendar-combined-name
;; Owner.
user-full-name
;; Timezone.
- (if (org-string-nw-p org-e-icalendar-timezone)
- org-e-icalendar-timezone
+ (if (org-string-nw-p org-icalendar-timezone)
+ org-icalendar-timezone
(cadr (current-time-zone)))
;; Description.
- org-e-icalendar-combined-description
+ org-icalendar-combined-description
;; Contents.
(concat
;; Agenda contents.
@@ -931,8 +930,8 @@ files to build the calendar from."
(org-check-agenda-file file)
(with-current-buffer (org-get-agenda-file-buffer file)
;; Create ID if necessary.
- (when org-e-icalendar-store-UID
- (org-e-icalendar-create-uid file))
+ (when org-icalendar-store-UID
+ (org-icalendar-create-uid file))
(let ((marks (cdr (assoc (expand-file-name file)
restriction))))
(unless (and restriction (not marks))
@@ -950,21 +949,25 @@ files to build the calendar from."
(sort marks '>))
org-export-before-processing-hook)))
(org-export-as
- 'e-icalendar nil nil t
+ 'icalendar nil nil t
(list :ascii-charset 'utf-8
:icalendar-agenda-view restriction))))))))
files "")
;; BBDB anniversaries.
- (when (and org-e-icalendar-include-bbdb-anniversaries
+ (when (and org-icalendar-include-bbdb-anniversaries
(require 'org-bbdb nil t))
(with-temp-buffer
(org-bbdb-anniv-export-ical)
(buffer-string)))))))
- (run-hook-with-args 'org-e-icalendar-after-save-hook
- org-e-icalendar-combined-agenda-file))
+ (run-hook-with-args 'org-icalendar-after-save-hook
+ org-icalendar-combined-agenda-file))
(org-release-buffers org-agenda-new-buffers)))
-(provide 'org-e-icalendar)
+(provide 'ox-icalendar)
-;;; org-e-icalendar.el ends here
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-icalendar.el ends here
diff --git a/lisp/ox-jsinfo.el b/lisp/ox-jsinfo.el
new file mode 100644
index 0000000..32f7a45
--- /dev/null
+++ b/lisp/ox-jsinfo.el
@@ -0,0 +1,260 @@
+;;; ox-jsinfo.el --- Org HTML Export Extension for org-info.js
+
+;; Copyright (C) 2004-2013 Free Software Foundation, Inc.
+
+;; Author: Carsten Dominik <carsten at orgmode dot org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file implements the support for Sebastian Rose's JavaScript
+;; org-info.js to display an Org mode file exported to HTML in an
+;; Info-like way, or using folding similar to the outline structure of
+;; Org mode itself.
+
+;; Documentation for using this module is in the Org manual. The
+;; script itself is documented by Sebastian Rose in a file distributed
+;; with the script. FIXME: Accurate pointers!
+
+;;; Code:
+
+(require 'ox-html)
+
+(add-to-list 'org-export-filter-options-functions 'org-infojs-install-script)
+
+(defgroup org-export-infojs nil
+ "Options specific for using org-info.js in HTML export."
+ :tag "Org Export HTML INFOJS"
+ :group 'org-export-html)
+
+(defcustom org-export-html-use-infojs 'when-configured
+ "Non-nil when Sebastian Rose's Java Script org-info.js should be active.
+This option can be nil or t to never or always use the script.
+It can also be the symbol `when-configured', meaning that the
+script will be linked into the export file if and only if there
+is a \"#+INFOJS_OPT:\" line in the buffer. See also the variable
+`org-infojs-options'."
+ :group 'org-export-html
+ :group 'org-export-infojs
+ :type '(choice
+ (const :tag "Never" nil)
+ (const :tag "When configured in buffer" when-configured)
+ (const :tag "Always" t)))
+
+(defconst org-infojs-opts-table
+ '((path PATH "http://orgmode.org/org-info.js")
+ (view VIEW "info")
+ (toc TOC :with-toc)
+ (ftoc FIXED_TOC "0")
+ (tdepth TOC_DEPTH "max")
+ (sdepth SECTION_DEPTH "max")
+ (mouse MOUSE_HINT "underline")
+ (buttons VIEW_BUTTONS "0")
+ (ltoc LOCAL_TOC "1")
+ (up LINK_UP :html-link-up)
+ (home LINK_HOME :html-link-home))
+ "JavaScript options, long form for script, default values.")
+
+(defvar org-infojs-options)
+(when (and (boundp 'org-infojs-options)
+ (assq 'runs org-infojs-options))
+ (setq org-infojs-options (delq (assq 'runs org-infojs-options)
+ org-infojs-options)))
+
+(defcustom org-infojs-options
+ (mapcar (lambda (x) (cons (car x) (nth 2 x))) org-infojs-opts-table)
+ "Options settings for the INFOJS JavaScript.
+Each of the options must have an entry in `org-export-html/infojs-opts-table'.
+The value can either be a string that will be passed to the script, or
+a property. This property is then assumed to be a property that is defined
+by the Export/Publishing setup of Org.
+The `sdepth' and `tdepth' parameters can also be set to \"max\", which
+means to use the maximum value consistent with other options."
+ :group 'org-export-infojs
+ :type
+ `(set :greedy t :inline t
+ ,@(mapcar
+ (lambda (x)
+ (list 'cons (list 'const (car x))
+ '(choice
+ (symbol :tag "Publishing/Export property")
+ (string :tag "Value"))))
+ org-infojs-opts-table)))
+
+(defcustom org-infojs-template
+ "<script type=\"text/javascript\" src=\"%SCRIPT_PATH\">
+/**
+ *
+ * @source: %SCRIPT_PATH
+ *
+ * @licstart The following is the entire license notice for the
+ * JavaScript code in %SCRIPT_PATH.
+ *
+ * Copyright (C) 2012-2013 Sebastian Rose
+ *
+ *
+ * The JavaScript code in this tag is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GNU GPL) as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version. The code is distributed WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+ *
+ * As additional permission under GNU GPL version 3 section 7, you
+ * may distribute non-source (e.g., minimized or compacted) forms of
+ * that code without the copy of the GNU GPL normally required by
+ * section 4, provided you include this license notice and a URL
+ * through which recipients can access the Corresponding Source.
+ *
+ * @licend The above is the entire license notice
+ * for the JavaScript code in %SCRIPT_PATH.
+ *
+ */
+</script>
+
+<script type=\"text/javascript\">
+
+/*
+@licstart The following is the entire license notice for the
+JavaScript code in this tag.
+
+Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+The JavaScript code in this tag is free software: you can
+redistribute it and/or modify it under the terms of the GNU
+General Public License (GNU GPL) as published by the Free Software
+Foundation, either version 3 of the License, or (at your option)
+any later version. The code is distributed WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+
+As additional permission under GNU GPL version 3 section 7, you
+may distribute non-source (e.g., minimized or compacted) forms of
+that code without the copy of the GNU GPL normally required by
+section 4, provided you include this license notice and a URL
+through which recipients can access the Corresponding Source.
+
+
+@licend The above is the entire license notice
+for the JavaScript code in this tag.
+*/
+
+<!--/*--><![CDATA[/*><!--*/
+%MANAGER_OPTIONS
+org_html_manager.setup(); // activate after the parameters are set
+/*]]>*///-->
+</script>"
+ "The template for the export style additions when org-info.js is used.
+Option settings will replace the %MANAGER-OPTIONS cookie."
+ :group 'org-infojs
+ :type 'string)
+
+(defun org-infojs-install-script (exp-plist backend)
+ "Install script in export options when appropriate.
+EXP-PLIST is a plist containing export options. BACKEND is the
+export back-end currently used."
+ (unless (or (not (org-export-derived-backend-p backend 'html))
+ (not org-export-html-use-infojs)
+ (and (eq org-export-html-use-infojs 'when-configured)
+ (or (not (plist-get exp-plist :infojs-opt))
+ (string-match "\\<view:nil\\>"
+ (plist-get exp-plist :infojs-opt)))))
+ (let* ((template org-infojs-template)
+ (ptoc (plist-get exp-plist :with-toc))
+ (hlevels (plist-get exp-plist :headline-levels))
+ (sdepth hlevels)
+ (tdepth (if (integerp ptoc) (min ptoc hlevels) hlevels))
+ (options (plist-get exp-plist :infojs-opt))
+ (table org-infojs-opts-table)
+ style)
+ (dolist (entry table)
+ (let* ((opt (car entry))
+ (var (nth 1 entry))
+ ;; Compute default values for script option OPT from
+ ;; `org-infojs-options' variable.
+ (default
+ (let ((default (cdr (assq opt org-infojs-options))))
+ (if (and (symbolp default) (not (memq default '(t nil))))
+ (plist-get exp-plist default)
+ default)))
+ ;; Value set through INFOJS_OPT keyword has precedence
+ ;; over the default one.
+ (val (if (and options
+ (string-match (format "\\<%s:\\(\\S-+\\)" opt)
+ options))
+ (match-string 1 options)
+ default)))
+ (case opt
+ (path (setq template
+ (replace-regexp-in-string
+ "%SCRIPT_PATH" val template t t)))
+ (sdepth (when (integerp (read val))
+ (setq sdepth (min (read val) sdepth))))
+ (tdepth (when (integerp (read val))
+ (setq tdepth (min (read val) tdepth))))
+ (otherwise (setq val
+ (cond
+ ((or (eq val t) (equal val "t")) "1")
+ ((or (eq val nil) (equal val "nil")) "0")
+ ((stringp val) val)
+ (t (format "%s" val))))
+ (push (cons var val) style)))))
+ ;; Now we set the depth of the *generated* TOC to SDEPTH,
+ ;; because the toc will actually determine the splitting. How
+ ;; much of the toc will actually be displayed is governed by the
+ ;; TDEPTH option.
+ (setq exp-plist (plist-put exp-plist :with-toc sdepth))
+ ;; The table of contents should not show more sections than we
+ ;; generate.
+ (setq tdepth (min tdepth sdepth))
+ (push (cons "TOC_DEPTH" tdepth) style)
+ ;; Build style string.
+ (setq style (mapconcat
+ (lambda (x) (format "org_html_manager.set(\"%s\", \"%s\");"
+ (car x)
+ (cdr x)))
+ style "\n"))
+ (when (and style (> (length style) 0))
+ (and (string-match "%MANAGER_OPTIONS" template)
+ (setq style (replace-match style t t template))
+ (setq exp-plist
+ (plist-put
+ exp-plist :html-style-extra
+ (concat (or (plist-get exp-plist :html-style-extra) "")
+ "\n"
+ style)))))
+ ;; This script absolutely needs the table of contents, so we
+ ;; change that setting.
+ (unless (plist-get exp-plist :with-toc)
+ (setq exp-plist (plist-put exp-plist :with-toc t)))
+ ;; Return the modified property list.
+ exp-plist)))
+
+
+
+(provide 'ox-infojs)
+(provide 'ox-jsinfo)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-jsinfo.el ends here
diff --git a/contrib/lisp/org-e-latex.el b/lisp/ox-latex.el
index f115a6d..26f06e9 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/lisp/ox-latex.el
@@ -1,4 +1,4 @@
-;;; org-e-latex.el --- LaTeX Back-End For Org Export Engine
+;;; ox-latex.el --- LaTeX Back-End for Org Export Engine
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
@@ -23,11 +23,11 @@
;; This library implements a LaTeX back-end for Org generic exporter.
;;
;; Depending on the desired output format, three commands are provided
-;; for export: `org-e-latex-export-as-latex' (temporary buffer),
-;; `org-e-latex-export-to-latex' ("tex" file) and
-;; `org-e-latex-export-to-pdf' ("pdf" file). Also, two publishing
-;; functions are available: `org-e-latex-publish-to-latex' and
-;; `org-e-latex-publish-to-pdf'.
+;; for export: `org-latex-export-as-latex' (temporary buffer),
+;; `org-latex-export-to-latex' ("tex" file) and
+;; `org-latex-export-to-pdf' ("pdf" file). Also, two publishing
+;; functions are available: `org-latex-publish-to-latex' and
+;; `org-latex-publish-to-pdf'.
;;
;; The library introduces three new buffer keywords: "LATEX_CLASS",
;; "LATEX_CLASS_OPTIONS" and "LATEX_HEADER", and a new OPTIONS item:
@@ -42,16 +42,19 @@
;; as-is, horizontal rules are ignored and the table will be wrapped
;; in a math environment. Also, contiguous tables sharing the same
;; math mode will be wrapped within the same environment. Default
-;; mode is stored in `org-e-latex-default-table-mode'.
+;; mode is stored in `org-latex-default-table-mode'.
;;
;; - The second most important attribute is `:environment'. It is the
;; environment used for the table and defaults to
-;; `org-e-latex-default-table-environment' value. It can be set to
+;; `org-latex-default-table-environment' value. It can be set to
;; anything, including "tabularx", "longtable", "array",
;; "bmatrix"...
;;
;; - `:float' attribute defines a float environment for the table.
;; Possible values are `sidewaystable', `multicolumn' and `table'.
+;; If unspecified, a table with a caption will have a `table'
+;; environment. Moreover, `:placement' attribute can specify the
+;; positioning of the float
;;
;; - `:align', `:font' and `:width' attributes set, respectively, the
;; alignment string of the table, its font size and its width. They
@@ -91,8 +94,8 @@
;;; Code:
(eval-when-compile (require 'cl))
-(require 'org-export)
-(require 'org-e-publish)
+(require 'ox)
+(require 'ox-publish)
(defvar org-export-latex-default-packages-alist)
(defvar org-export-latex-packages-alist)
@@ -102,77 +105,77 @@
;;; Define Back-End
-(org-export-define-backend e-latex
- ((bold . org-e-latex-bold)
- (center-block . org-e-latex-center-block)
- (clock . org-e-latex-clock)
- (code . org-e-latex-code)
- (drawer . org-e-latex-drawer)
- (dynamic-block . org-e-latex-dynamic-block)
- (entity . org-e-latex-entity)
- (example-block . org-e-latex-example-block)
- (export-block . org-e-latex-export-block)
- (export-snippet . org-e-latex-export-snippet)
- (fixed-width . org-e-latex-fixed-width)
- (footnote-definition . org-e-latex-footnote-definition)
- (footnote-reference . org-e-latex-footnote-reference)
- (headline . org-e-latex-headline)
- (horizontal-rule . org-e-latex-horizontal-rule)
- (inline-src-block . org-e-latex-inline-src-block)
- (inlinetask . org-e-latex-inlinetask)
- (italic . org-e-latex-italic)
- (item . org-e-latex-item)
- (keyword . org-e-latex-keyword)
- (latex-environment . org-e-latex-latex-environment)
- (latex-fragment . org-e-latex-latex-fragment)
- (line-break . org-e-latex-line-break)
- (link . org-e-latex-link)
- (paragraph . org-e-latex-paragraph)
- (plain-list . org-e-latex-plain-list)
- (plain-text . org-e-latex-plain-text)
- (planning . org-e-latex-planning)
- (property-drawer . org-e-latex-property-drawer)
- (quote-block . org-e-latex-quote-block)
- (quote-section . org-e-latex-quote-section)
- (radio-target . org-e-latex-radio-target)
- (section . org-e-latex-section)
- (special-block . org-e-latex-special-block)
- (src-block . org-e-latex-src-block)
- (statistics-cookie . org-e-latex-statistics-cookie)
- (strike-through . org-e-latex-strike-through)
- (subscript . org-e-latex-subscript)
- (superscript . org-e-latex-superscript)
- (table . org-e-latex-table)
- (table-cell . org-e-latex-table-cell)
- (table-row . org-e-latex-table-row)
- (target . org-e-latex-target)
- (template . org-e-latex-template)
- (timestamp . org-e-latex-timestamp)
- (underline . org-e-latex-underline)
- (verbatim . org-e-latex-verbatim)
- (verse-block . org-e-latex-verse-block))
+(org-export-define-backend latex
+ ((bold . org-latex-bold)
+ (center-block . org-latex-center-block)
+ (clock . org-latex-clock)
+ (code . org-latex-code)
+ (drawer . org-latex-drawer)
+ (dynamic-block . org-latex-dynamic-block)
+ (entity . org-latex-entity)
+ (example-block . org-latex-example-block)
+ (export-block . org-latex-export-block)
+ (export-snippet . org-latex-export-snippet)
+ (fixed-width . org-latex-fixed-width)
+ (footnote-definition . org-latex-footnote-definition)
+ (footnote-reference . org-latex-footnote-reference)
+ (headline . org-latex-headline)
+ (horizontal-rule . org-latex-horizontal-rule)
+ (inline-src-block . org-latex-inline-src-block)
+ (inlinetask . org-latex-inlinetask)
+ (italic . org-latex-italic)
+ (item . org-latex-item)
+ (keyword . org-latex-keyword)
+ (latex-environment . org-latex-latex-environment)
+ (latex-fragment . org-latex-latex-fragment)
+ (line-break . org-latex-line-break)
+ (link . org-latex-link)
+ (paragraph . org-latex-paragraph)
+ (plain-list . org-latex-plain-list)
+ (plain-text . org-latex-plain-text)
+ (planning . org-latex-planning)
+ (property-drawer . org-latex-property-drawer)
+ (quote-block . org-latex-quote-block)
+ (quote-section . org-latex-quote-section)
+ (radio-target . org-latex-radio-target)
+ (section . org-latex-section)
+ (special-block . org-latex-special-block)
+ (src-block . org-latex-src-block)
+ (statistics-cookie . org-latex-statistics-cookie)
+ (strike-through . org-latex-strike-through)
+ (subscript . org-latex-subscript)
+ (superscript . org-latex-superscript)
+ (table . org-latex-table)
+ (table-cell . org-latex-table-cell)
+ (table-row . org-latex-table-row)
+ (target . org-latex-target)
+ (template . org-latex-template)
+ (timestamp . org-latex-timestamp)
+ (underline . org-latex-underline)
+ (verbatim . org-latex-verbatim)
+ (verse-block . org-latex-verse-block))
:export-block ("LATEX" "TEX")
:menu-entry
(?l "Export to LaTeX"
- ((?L "As TEX buffer" org-e-latex-export-as-latex)
- (?l "As TEX file" org-e-latex-export-to-latex)
- (?p "As PDF file" org-e-latex-export-to-pdf)
+ ((?L "As TEX buffer" org-latex-export-as-latex)
+ (?l "As TEX file" org-latex-export-to-latex)
+ (?p "As PDF file" org-latex-export-to-pdf)
(?o "As PDF file and open"
(lambda (a s v b)
- (if a (org-e-latex-export-to-pdf t s v b)
- (org-open-file (org-e-latex-export-to-pdf nil s v b)))))))
+ (if a (org-latex-export-to-pdf t s v b)
+ (org-open-file (org-latex-export-to-pdf nil s v b)))))))
:options-alist ((:date "DATE" nil "\\today" t)
- (:date-format nil nil org-e-latex-date-timestamp-format)
- (:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
+ (:date-format nil nil org-latex-date-timestamp-format)
+ (:latex-class "LATEX_CLASS" nil org-latex-default-class t)
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header-extra "LATEX_HEADER" nil nil newline)
- (:latex-hyperref-p nil "texht" org-e-latex-with-hyperref t)))
+ (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)))
;;; Internal Variables
-(defconst org-e-latex-babel-language-alist
+(defconst org-latex-babel-language-alist
'(("af" . "afrikaans")
("bg" . "bulgarian")
("bt-br" . "brazilian")
@@ -223,7 +226,7 @@
("uk" . "ukrainian"))
"Alist between language code and corresponding Babel option.")
-(defconst org-e-latex-table-matrix-macros '(("bordermatrix" . "\\cr")
+(defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr")
("qbordermatrix" . "\\cr")
("kbordermatrix" . "\\\\"))
"Alist between matrix macros and their row ending.")
@@ -232,7 +235,7 @@
;;; User Configurable Variables
-(defgroup org-export-e-latex nil
+(defgroup org-export-latex nil
"Options for exporting Org mode files to LaTeX."
:tag "Org Export LaTeX"
:group 'org-export)
@@ -240,12 +243,12 @@
;;;; Preamble
-(defcustom org-e-latex-default-class "article"
+(defcustom org-latex-default-class "article"
"The default LaTeX class."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(string :tag "LaTeX class"))
-(defcustom org-e-latex-classes
+(defcustom org-latex-classes
'(("article"
"\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
@@ -321,7 +324,7 @@ If your header, `org-export-latex-default-packages-alist' or
\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be
replaced with a coding system derived from
`buffer-file-coding-system'. See also the variable
-`org-e-latex-inputenc-alist' for a way to influence this
+`org-latex-inputenc-alist' for a way to influence this
mechanism.
The sectioning structure
@@ -350,7 +353,7 @@ a function name. That function will be called with two
parameters, the \(reduced) level of the headline, and a predicate
non-nil when the headline should be numbered. It must return
a format string in which the section title will be added."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(list (string :tag "LaTeX class")
(string :tag "LaTeX header")
@@ -366,7 +369,7 @@ a format string in which the section title will be added."
(string :tag "Closing (unnumbered)"))
(function :tag "Hook computing sectioning"))))))
-(defcustom org-e-latex-inputenc-alist nil
+(defcustom org-latex-inputenc-alist nil
"Alist of inputenc coding system names, and what should really be used.
For example, adding an entry
@@ -374,13 +377,13 @@ For example, adding an entry
will cause \\usepackage[utf8x]{inputenc} to be used for buffers that
are written as utf8 files."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(cons
(string :tag "Derived from buffer")
(string :tag "Use this instead"))))
-(defcustom org-e-latex-date-timestamp-format nil
+(defcustom org-latex-date-timestamp-format nil
"Time-stamp format string to use for DATE keyword.
The format string, when specified, only applies if date consists
@@ -388,35 +391,35 @@ in a single time-stamp. Otherwise its value will be ignored.
See `format-time-string' for details on how to build this
string."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(choice
(string :tag "Time-stamp format string")
(const :tag "No format string" nil)))
-(defcustom org-e-latex-title-command "\\maketitle"
+(defcustom org-latex-title-command "\\maketitle"
"The command used to insert the title just after \\begin{document}.
If this string contains the formatting specification \"%s\" then
it will be used as a formatting string, passing the title as an
argument."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-toc-command "\\tableofcontents\n\\vspace*{1cm}\n\n"
+(defcustom org-latex-toc-command "\\tableofcontents\n\\vspace*{1cm}\n\n"
"LaTeX command to set the table of contents, list of figures...
This command only applies to the table of contents generated with
toc:nil option, not to those generated with #+TOC keyword."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-with-hyperref t
- "Toggle insertion of \hypersetup{...} in the preamble."
- :group 'org-export-e-latex
+(defcustom org-latex-with-hyperref t
+ "Toggle insertion of \\hypersetup{...} in the preamble."
+ :group 'org-export-latex
:type 'boolean)
;;;; Headline
-(defcustom org-e-latex-format-headline-function nil
+(defcustom org-latex-format-headline-function nil
"Function to format headline text.
This function will be called with 5 arguments:
@@ -431,7 +434,7 @@ 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:
-\(defun org-e-latex-format-headline (todo todo-type priority text tags)
+\(defun org-latex-format-headline (todo todo-type priority text tags)
\"Default format function for an headline.\"
\(concat (when todo
\(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo))
@@ -441,49 +444,49 @@ order to reproduce the default set-up:
\(when tags
\(format \"\\\\hfill{}\\\\textsc{%s}\"
\(mapconcat 'identity tags \":\"))))"
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'function)
;;;; Footnotes
-(defcustom org-e-latex-footnote-separator "\\textsuperscript{,}\\,"
+(defcustom org-latex-footnote-separator "\\textsuperscript{,}\\,"
"Text used to separate footnotes."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
;;;; Timestamps
-(defcustom org-e-latex-active-timestamp-format "\\textit{%s}"
+(defcustom org-latex-active-timestamp-format "\\textit{%s}"
"A printf format string to be applied to active timestamps."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-inactive-timestamp-format "\\textit{%s}"
+(defcustom org-latex-inactive-timestamp-format "\\textit{%s}"
"A printf format string to be applied to inactive timestamps."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-diary-timestamp-format "\\textit{%s}"
+(defcustom org-latex-diary-timestamp-format "\\textit{%s}"
"A printf format string to be applied to diary timestamps."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
;;;; Links
-(defcustom org-e-latex-image-default-option "width=.9\\linewidth"
+(defcustom org-latex-image-default-option "width=.9\\linewidth"
"Default option for images."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-default-figure-position "htb"
+(defcustom org-latex-default-figure-position "htb"
"Default position for latex figures."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-inline-image-rules
+(defcustom org-latex-inline-image-rules
'(("file" . "\\.\\(pdf\\|jpeg\\|jpg\\|png\\|ps\\|eps\\)\\'"))
"Rules characterizing image files that can be inlined into LaTeX.
@@ -496,11 +499,11 @@ depend on the way the LaTeX file is processed. When used with
pdflatex, 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."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
-(defcustom org-e-latex-link-with-unknown-path-format "\\texttt{%s}"
+(defcustom org-latex-link-with-unknown-path-format "\\texttt{%s}"
"Format string for links with unknown path type."
:group 'org-export-latex
:type 'string)
@@ -508,12 +511,12 @@ default we use here encompasses both."
;;;; Tables
-(defcustom org-e-latex-default-table-environment "tabular"
+(defcustom org-latex-default-table-environment "tabular"
"Default environment used to build tables."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'string)
-(defcustom org-e-latex-default-table-mode 'table
+(defcustom org-latex-default-table-mode 'table
"Default mode for tables.
Value can be a symbol among:
@@ -534,40 +537,40 @@ This value can be overridden locally with, i.e. \":mode math\" in
LaTeX attributes.
When modifying this variable, it may be useful to change
-`org-e-latex-default-table-environment' accordingly."
- :group 'org-export-e-latex
+`org-latex-default-table-environment' accordingly."
+ :group 'org-export-latex
:type '(choice (const :tag "Table" table)
(const :tag "Matrix" math)
(const :tag "Inline matrix" inline-math)
(const :tag "Verbatim" verbatim)))
-(defcustom org-e-latex-tables-centered t
+(defcustom org-latex-tables-centered t
"When non-nil, tables are exported in a center environment."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'boolean)
-(defcustom org-e-latex-tables-booktabs nil
+(defcustom org-latex-tables-booktabs nil
"When non-nil, display tables in a formal \"booktabs\" style.
This option assumes that the \"booktabs\" package is properly
loaded in the header of the document. This value can be ignored
locally with \":booktabs t\" and \":booktabs nil\" LaTeX
attributes."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'boolean)
-(defcustom org-e-latex-table-caption-above t
+(defcustom org-latex-table-caption-above t
"When non-nil, place caption string at the beginning of the table.
Otherwise, place it near the end."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'boolean)
-(defcustom org-e-latex-table-scientific-notation "%s\\,(%s)"
+(defcustom org-latex-table-scientific-notation "%s\\,(%s)"
"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."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(choice
(string :tag "Format string")
(const :tag "No formatting")))
@@ -575,12 +578,12 @@ When nil, no transformation is made."
;;;; Text markup
-(defcustom org-e-latex-text-markup-alist '((bold . "\\textbf{%s}")
- (code . verb)
- (italic . "\\emph{%s}")
- (strike-through . "\\st{%s}")
- (underline . "\\underline{%s}")
- (verbatim . protectedtexttt))
+(defcustom org-latex-text-markup-alist '((bold . "\\textbf{%s}")
+ (code . verb)
+ (italic . "\\emph{%s}")
+ (strike-through . "\\st{%s}")
+ (underline . "\\underline{%s}")
+ (verbatim . protectedtexttt))
"Alist of LaTeX expressions to convert text markup.
The key must be a symbol among `bold', `code', `italic',
@@ -595,14 +598,14 @@ to typeset and try to protect special characters.
If no association can be found for a given markup, text will be
returned as-is."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'alist
:options '(bold code italic strike-through underline verbatim))
;;;; Drawers
-(defcustom org-e-latex-format-drawer-function nil
+(defcustom org-latex-format-drawer-function nil
"Function called to format a drawer in LaTeX code.
The function must accept two parameters:
@@ -614,16 +617,16 @@ 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:
-\(defun org-e-latex-format-drawer-default \(name contents\)
+\(defun org-latex-format-drawer-default \(name contents\)
\"Format a drawer element for LaTeX export.\"
contents\)"
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'function)
;;;; Inlinetasks
-(defcustom org-e-latex-format-inlinetask-function nil
+(defcustom org-latex-format-inlinetask-function nil
"Function called to format an inlinetask in LaTeX code.
The function must accept six parameters:
@@ -639,7 +642,7 @@ 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:
-\(defun org-e-latex-format-inlinetask \(todo type priority name tags contents\)
+\(defun org-latex-format-inlinetask \(todo type priority name tags contents\)
\"Format an inline task element for LaTeX export.\"
\(let ((full-title
\(concat
@@ -659,13 +662,13 @@ in order to mimic default behaviour:
\"\\\\end{minipage}}\"
\"\\\\end{center}\")
full-title contents))"
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'function)
;; Src blocks
-(defcustom org-e-latex-listings nil
+(defcustom org-latex-listings nil
"Non-nil means export source code using the listings package.
This package will fontify source code, possibly even with color.
If you want to use this, you also need to make LaTeX use the
@@ -673,33 +676,33 @@ listings package, and if you want to have color, the color
package. Just add these to `org-export-latex-packages-alist',
for example using customize, or with something like:
- \(require 'org-e-latex)
+ \(require 'ox-latex)
\(add-to-list 'org-export-latex-packages-alist '\(\"\" \"listings\"))
\(add-to-list 'org-export-latex-packages-alist '\(\"\" \"color\"))
Alternatively,
- \(setq org-e-latex-listings 'minted)
+ \(setq org-latex-listings 'minted)
causes source code to be exported using the minted package as
opposed to listings. If you want to use minted, you need to add
the minted package to `org-export-latex-packages-alist', for
example using customize, or with
- \(require 'org-e-latex)
+ \(require 'ox-latex)
\(add-to-list 'org-export-latex-packages-alist '\(\"\" \"minted\"))
In addition, it is necessary to install pygments
\(http://pygments.org), and to configure the variable
-`org-e-latex-pdf-process' so that the -shell-escape option is
+`org-latex-pdf-process' so that the -shell-escape option is
passed to pdflatex."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(choice
(const :tag "Use listings" t)
(const :tag "Use minted" 'minted)
(const :tag "Export verbatim" nil)))
-(defcustom org-e-latex-listings-langs
+(defcustom org-latex-listings-langs
'((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp")
(c "C") (cc "C++")
(fortran "fortran")
@@ -716,13 +719,13 @@ 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."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(list
(symbol :tag "Major mode ")
(string :tag "Listings language"))))
-(defcustom org-e-latex-listings-options nil
+(defcustom org-latex-listings-options nil
"Association list of options for the latex listings package.
These options are supplied as a comma-separated list to the
@@ -730,7 +733,7 @@ These options are supplied as a comma-separated list to the
a list containing two strings: the name of the option, and the
value. For example,
- (setq org-e-latex-listings-options
+ (setq org-latex-listings-options
'((\"basicstyle\" \"\\small\")
(\"keywordstyle\" \"\\color{black}\\bfseries\\underbar\")))
@@ -739,13 +742,13 @@ black keywords.
Note that the same options will be applied to blocks of all
languages."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(list
(string :tag "Listings option name ")
(string :tag "Listings option value"))))
-(defcustom org-e-latex-minted-langs
+(defcustom org-latex-minted-langs
'((emacs-lisp "common-lisp")
(cc "c++")
(cperl "perl")
@@ -763,13 +766,13 @@ and that the full list of language identifiers can be obtained
with:
pygmentize -L lexers"
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(list
(symbol :tag "Major mode ")
(string :tag "Minted language"))))
-(defcustom org-e-latex-minted-options nil
+(defcustom org-latex-minted-options nil
"Association list of options for the latex minted package.
These options are supplied within square brackets in
@@ -777,7 +780,7 @@ These options are supplied within square brackets in
be a list containing two strings: the name of the option, and the
value. For example,
- \(setq org-e-latex-minted-options
+ \(setq org-latex-minted-options
'\((\"bgcolor\" \"bg\") \(\"frame\" \"lines\")))
will result in src blocks being exported with
@@ -786,19 +789,19 @@ will result in src blocks being exported with
as the start of the minted environment. Note that the same
options will be applied to blocks of all languages."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(list
(string :tag "Minted option name ")
(string :tag "Minted option value"))))
-(defvar org-e-latex-custom-lang-environments nil
+(defvar org-latex-custom-lang-environments nil
"Alist mapping languages to language-specific LaTeX environments.
It is used during export of src blocks by the listings and minted
latex packages. For example,
- \(setq org-e-latex-custom-lang-environments
+ \(setq org-latex-custom-lang-environments
'\(\(python \"pythoncode\"\)\)\)
would have the effect that if org encounters begin_src python
@@ -811,7 +814,7 @@ during latex export it will output
;;;; Compilation
-(defcustom org-e-latex-pdf-process
+(defcustom org-latex-pdf-process
'("pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f")
@@ -874,19 +877,19 @@ file name as its single argument."
("rubber -d --into %o %f"))
(function)))
-(defcustom org-e-latex-logfiles-extensions
+(defcustom org-latex-logfiles-extensions
'("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
"The list of file extensions to consider as LaTeX logfiles."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat (string :tag "Extension")))
-(defcustom org-e-latex-remove-logfiles t
+(defcustom org-latex-remove-logfiles t
"Non-nil means remove the logfiles produced by PDF production.
These are the .aux, .log, .out, and .toc files."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type 'boolean)
-(defcustom org-e-latex-known-errors
+(defcustom org-latex-known-errors
'(("Reference.*?undefined" . "[undefined reference]")
("Citation.*?undefined" . "[undefined citation]")
("Undefined control sequence" . "[undefined control sequence]")
@@ -896,7 +899,7 @@ These are the .aux, .log, .out, and .toc files."
"Alist of regular expressions and associated messages for the user.
The regular expressions are used to find possible errors in the
log of a latex-run."
- :group 'org-export-e-latex
+ :group 'org-export-latex
:type '(repeat
(cons
(string :tag "Regexp")
@@ -906,13 +909,13 @@ log of a latex-run."
;;; Internal Functions
-(defun org-e-latex--caption/label-string (element info)
+(defun org-latex--caption/label-string (element info)
"Return caption and label LaTeX string for ELEMENT.
INFO is a plist holding contextual information. If there's no
caption nor label, return the empty string.
-For non-floats, see `org-e-latex--wrap-label'."
+For non-floats, see `org-latex--wrap-label'."
(let* ((label (org-element-property :name element))
(label-str (if (not (org-string-nw-p label)) ""
(format "\\label{%s}"
@@ -930,7 +933,7 @@ For non-floats, see `org-e-latex--wrap-label'."
;; Standard caption format.
(t (format "\\caption{%s%s}\n" label-str (org-export-data main info))))))
-(defun org-e-latex--guess-babel-language (header info)
+(defun org-latex--guess-babel-language (header info)
"Set Babel's language according to LANGUAGE keyword.
HEADER is the LaTeX header string. INFO is the plist used as
@@ -950,7 +953,7 @@ Return the new header."
(let ((options (save-match-data
(org-split-string (match-string 1 header) ",")))
(language (cdr (assoc language-code
- org-e-latex-babel-language-alist))))
+ org-latex-babel-language-alist))))
;; If LANGUAGE is already loaded, return header. Otherwise,
;; append LANGUAGE to other options.
(if (member language options) header
@@ -959,7 +962,7 @@ Return the new header."
",")
nil nil header 1))))))
-(defun org-e-latex--guess-inputenc (header)
+(defun org-latex--guess-inputenc (header)
"Set the coding system in inputenc to what the buffer is.
HEADER is the LaTeX header string. Return the new header."
(let* ((cs (or (ignore-errors
@@ -968,12 +971,12 @@ HEADER is the LaTeX header string. Return the new header."
"utf8")))
(if (not cs) header
;; First translate if that is requested.
- (setq cs (or (cdr (assoc cs org-e-latex-inputenc-alist)) cs))
+ (setq cs (or (cdr (assoc cs org-latex-inputenc-alist)) cs))
;; Then find the \usepackage statement and replace the option.
(replace-regexp-in-string "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
cs header t nil 1))))
-(defun org-e-latex--find-verb-separator (s)
+(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
(let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
@@ -981,7 +984,7 @@ This is used to choose a separator for constructs like \\verb."
when (not (string-match (regexp-quote (char-to-string c)) s))
return (char-to-string c))))
-(defun org-e-latex--make-option-string (options)
+(defun org-latex--make-option-string (options)
"Return a comma separated string of keywords and values.
OPTIONS is an alist where the key is the options keyword as
a string, and the value a list containing the keyword value, or
@@ -993,26 +996,26 @@ nil."
options
","))
-(defun org-e-latex--wrap-label (element output)
+(defun org-latex--wrap-label (element output)
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
This function shouldn't be used for floats. See
-`org-e-latex--caption/label-string'."
+`org-latex--caption/label-string'."
(let ((label (org-element-property :name element)))
(if (not (and (org-string-nw-p output) (org-string-nw-p label))) output
(concat (format "\\label{%s}\n" (org-export-solidify-link-text label))
output))))
-(defun org-e-latex--text-markup (text markup)
+(defun org-latex--text-markup (text markup)
"Format TEXT depending on MARKUP text markup.
-See `org-e-latex-text-markup-alist' for details."
- (let ((fmt (cdr (assq markup org-e-latex-text-markup-alist))))
+See `org-latex-text-markup-alist' for details."
+ (let ((fmt (cdr (assq markup org-latex-text-markup-alist))))
(cond
;; No format string: Return raw text.
((not fmt) text)
;; Handle the `verb' special case: Find and appropriate separator
;; and use "\\verb" command.
((eq 'verb fmt)
- (let ((separator (org-e-latex--find-verb-separator text)))
+ (let ((separator (org-latex--find-verb-separator text)))
(concat "\\verb" separator text separator)))
;; Handle the `protectedtexttt' special case: Protect some
;; special chars and use "\texttt{%s}" format string.
@@ -1038,7 +1041,7 @@ See `org-e-latex-text-markup-alist' for details."
;; Else use format string.
(t (format fmt text)))))
-(defun org-e-latex--delayed-footnotes-definitions (element info)
+(defun org-latex--delayed-footnotes-definitions (element info)
"Return footnotes definitions in ELEMENT as a string.
INFO is a plist used as a communication channel.
@@ -1066,15 +1069,14 @@ just outside of it."
(lambda (data)
;; Return a list of all footnote references never seen
;; before in DATA.
- (org-element-map
- data 'footnote-reference
- (lambda (ref)
- (when (org-export-footnote-first-reference-p ref info)
- (push ref all-refs)
- (when (eq (org-element-property :type ref) 'standard)
- (funcall search-refs
- (org-export-get-footnote-definition ref info)))))
- info)
+ (org-element-map data 'footnote-reference
+ (lambda (ref)
+ (when (org-export-footnote-first-reference-p ref info)
+ (push ref all-refs)
+ (when (eq (org-element-property :type ref) 'standard)
+ (funcall search-refs
+ (org-export-get-footnote-definition ref info)))))
+ info)
(reverse all-refs)))))
(funcall search-refs element))
""))
@@ -1083,7 +1085,7 @@ just outside of it."
;;; Template
-(defun org-e-latex-template (contents info)
+(defun org-latex-template (contents info)
"Return complete document string after LaTeX conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
@@ -1096,7 +1098,7 @@ holding export options."
(let ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
- (let* ((header (nth 1 (assoc class org-e-latex-classes)))
+ (let* ((header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
@@ -1104,8 +1106,8 @@ holding export options."
"^[ \t]*\\\\documentclass\\(\\(\\[.*\\]\\)?\\)"
class-options header t nil 1)))))
(when document-class-string
- (org-e-latex--guess-babel-language
- (org-e-latex--guess-inputenc
+ (org-latex--guess-babel-language
+ (org-latex--guess-inputenc
(org-splice-latex-header
document-class-string
org-export-latex-default-packages-alist ; defined in org.el
@@ -1151,17 +1153,17 @@ holding export options."
;; Title command.
(org-element-normalize-string
(cond ((string= "" title) nil)
- ((not (stringp org-e-latex-title-command)) nil)
+ ((not (stringp org-latex-title-command)) nil)
((string-match "\\(?:[^%]\\|^\\)%s"
- org-e-latex-title-command)
- (format org-e-latex-title-command title))
- (t org-e-latex-title-command)))
+ org-latex-title-command)
+ (format org-latex-title-command title))
+ (t org-latex-title-command)))
;; Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat (when (wholenump depth)
(format "\\setcounter{tocdepth}{%d}\n" depth))
- org-e-latex-toc-command)))
+ org-latex-toc-command)))
;; Document's body.
contents
;; Creator.
@@ -1180,34 +1182,34 @@ holding export options."
;;;; Bold
-(defun org-e-latex-bold (bold contents info)
+(defun org-latex-bold (bold contents info)
"Transcode BOLD from Org to LaTeX.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
- (org-e-latex--text-markup contents 'bold))
+ (org-latex--text-markup contents 'bold))
;;;; Center Block
-(defun org-e-latex-center-block (center-block contents info)
+(defun org-latex-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
center-block
(format "\\begin{center}\n%s\\end{center}" contents)))
;;;; Clock
-(defun org-e-latex-clock (clock contents info)
+(defun org-latex-clock (clock contents info)
"Transcode a CLOCK element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
(concat
"\\noindent"
(format "\\textbf{%s} " org-clock-string)
- (format org-e-latex-inactive-timestamp-format
+ (format org-latex-inactive-timestamp-format
(concat (org-translate-time
(org-element-property :raw-value
(org-element-property :value clock)))
@@ -1218,41 +1220,41 @@ information."
;;;; Code
-(defun org-e-latex-code (code contents info)
+(defun org-latex-code (code contents info)
"Transcode a CODE object from Org to LaTeX.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-latex--text-markup (org-element-property :value code) 'code))
+ (org-latex--text-markup (org-element-property :value code) 'code))
;;;; Drawer
-(defun org-e-latex-drawer (drawer contents info)
+(defun org-latex-drawer (drawer contents info)
"Transcode a DRAWER element from Org to LaTeX.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let* ((name (org-element-property :drawer-name drawer))
- (output (if (functionp org-e-latex-format-drawer-function)
- (funcall org-e-latex-format-drawer-function
+ (output (if (functionp org-latex-format-drawer-function)
+ (funcall org-latex-format-drawer-function
name contents)
;; If there's no user defined function: simply
;; display contents of the drawer.
contents)))
- (org-e-latex--wrap-label drawer output)))
+ (org-latex--wrap-label drawer output)))
;;;; Dynamic Block
-(defun org-e-latex-dynamic-block (dynamic-block contents info)
+(defun org-latex-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
- (org-e-latex--wrap-label dynamic-block contents))
+ (org-latex--wrap-label dynamic-block contents))
;;;; Entity
-(defun org-e-latex-entity (entity contents info)
+(defun org-latex-entity (entity contents info)
"Transcode an ENTITY object from Org to LaTeX.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -1262,11 +1264,11 @@ contextual information."
;;;; Example Block
-(defun org-e-latex-example-block (example-block contents info)
+(defun org-latex-example-block (example-block contents info)
"Transcode an EXAMPLE-BLOCK element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
example-block
(format "\\begin{verbatim}\n%s\\end{verbatim}"
(org-export-format-code-default example-block info))))
@@ -1274,7 +1276,7 @@ information."
;;;; Export Block
-(defun org-e-latex-export-block (export-block contents info)
+(defun org-latex-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (member (org-element-property :type export-block) '("LATEX" "TEX"))
@@ -1283,19 +1285,19 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Export Snippet
-(defun org-e-latex-export-snippet (export-snippet contents info)
+(defun org-latex-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-latex)
+ (when (eq (org-export-snippet-backend export-snippet) 'latex)
(org-element-property :value export-snippet)))
;;;; Fixed Width
-(defun org-e-latex-fixed-width (fixed-width contents info)
+(defun org-latex-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
fixed-width
(format "\\begin{verbatim}\n%s\\end{verbatim}"
(org-remove-indentation
@@ -1305,15 +1307,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Footnote Reference
;;
;; Footnote reference export is handled by
-;; `org-e-latex-footnote-reference'.
+;; `org-latex-footnote-reference'.
;;
-;; Internally, `org-e-latex--get-footnote-counter' is used to restore
+;; Internally, `org-latex--get-footnote-counter' is used to restore
;; the value of the LaTeX "footnote" counter after a jump due to
;; a reference to an already defined footnote. It is only needed in
;; item tags since the optional argument to \footnotemark is not
;; allowed there.
-(defun org-e-latex--get-footnote-counter (footnote-reference info)
+(defun org-latex--get-footnote-counter (footnote-reference info)
"Return \"footnote\" counter before FOOTNOTE-REFERENCE is encountered.
INFO is a plist used as a communication channel."
;; Find original counter value by counting number of footnote
@@ -1327,41 +1329,40 @@ INFO is a plist used as a communication channel."
(lambda (data)
;; Search footnote references through DATA, filling
;; SEEN-REFS along the way.
- (org-element-map
- data 'footnote-reference
- (lambda (fn)
- (let ((fn-lbl (org-element-property :label fn)))
- (cond
- ;; Anonymous footnote match: return number.
- ((eq fn footnote-reference) (length seen-refs))
- ;; Anonymous footnote: it's always a new one.
- ;; Also, be sure to return nil from the `cond' so
- ;; `first-match' doesn't get us out of the loop.
- ((not fn-lbl) (push 'inline seen-refs) nil)
- ;; Label not seen so far: add it so SEEN-REFS.
- ;;
- ;; Also search for subsequent references in
- ;; footnote definition so numbering follows reading
- ;; logic. Note that we don't have to care about
- ;; inline definitions, since `org-element-map'
- ;; already traverse them at the right time.
- ((not (member fn-lbl seen-refs))
- (push fn-lbl seen-refs)
- (funcall search-ref
- (org-export-get-footnote-definition fn info))))))
- ;; Don't enter footnote definitions since it will happen
- ;; when their first reference is found.
- info 'first-match 'footnote-definition)))))
+ (org-element-map data 'footnote-reference
+ (lambda (fn)
+ (let ((fn-lbl (org-element-property :label fn)))
+ (cond
+ ;; Anonymous footnote match: return number.
+ ((eq fn footnote-reference) (length seen-refs))
+ ;; Anonymous footnote: it's always a new one.
+ ;; Also, be sure to return nil from the `cond' so
+ ;; `first-match' doesn't get us out of the loop.
+ ((not fn-lbl) (push 'inline seen-refs) nil)
+ ;; Label not seen so far: add it so SEEN-REFS.
+ ;;
+ ;; Also search for subsequent references in
+ ;; footnote definition so numbering follows
+ ;; reading logic. Note that we don't care about
+ ;; inline definitions, since `org-element-map'
+ ;; already traverses them at the right time.
+ ((not (member fn-lbl seen-refs))
+ (push fn-lbl seen-refs)
+ (funcall search-ref
+ (org-export-get-footnote-definition fn info))))))
+ ;; Don't enter footnote definitions since it will
+ ;; happen when their first reference is found.
+ info 'first-match 'footnote-definition)))))
(funcall search-ref (plist-get info :parse-tree))))
-(defun org-e-latex-footnote-reference (footnote-reference contents info)
+(defun org-latex-footnote-reference (footnote-reference contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(concat
;; Insert separator between two footnotes in a row.
(let ((prev (org-export-get-previous-element footnote-reference info)))
(when (eq (org-element-type prev) 'footnote-reference)
- org-e-latex-footnote-separator))
+ org-latex-footnote-separator))
(cond
;; Use \footnotemark if reference is within an item's tag.
((eq (org-element-type (org-export-get-parent-element footnote-reference))
@@ -1376,7 +1377,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(format
"\\setcounter{footnote}{%s}\\footnotemark\\setcounter{footnote}{%s}"
(1- (org-export-get-footnote-number footnote-reference info))
- (org-e-latex--get-footnote-counter footnote-reference info))))
+ (org-latex--get-footnote-counter footnote-reference info))))
;; Use \footnotemark if the footnote has already been defined.
((not (org-export-footnote-first-reference-p footnote-reference info))
(format "\\footnotemark[%s]{}"
@@ -1395,19 +1396,19 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; Retrieve all footnote references within the footnote and
;; add their definition after it, since LaTeX doesn't support
;; them inside.
- (org-e-latex--delayed-footnotes-definitions def info)))))))
+ (org-latex--delayed-footnotes-definitions def info)))))))
;;;; Headline
-(defun org-e-latex-headline (headline contents info)
+(defun org-latex-headline (headline contents info)
"Transcode an HEADLINE element from Org to LaTeX.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
(let* ((class (plist-get info :latex-class))
(level (org-export-get-relative-level headline info))
(numberedp (org-export-numbered-headline-p headline info))
- (class-sectionning (assoc class org-e-latex-classes))
+ (class-sectionning (assoc class org-latex-classes))
;; Section formatting will set two placeholders: one for the
;; title and the other for the contents.
(section-fmt
@@ -1442,9 +1443,9 @@ holding contextual information."
(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.
- (full-text (if (functionp org-e-latex-format-headline-function)
+ (full-text (if (functionp org-latex-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-latex-format-headline-function
+ (funcall org-latex-format-headline-function
todo todo-type priority text tags)
;; Default formatting.
(concat
@@ -1456,9 +1457,9 @@ holding contextual information."
(format "\\hfill{}\\textsc{:%s:}"
(mapconcat 'identity tags ":"))))))
(full-text-no-tag
- (if (functionp org-e-latex-format-headline-function)
+ (if (functionp org-latex-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-latex-format-headline-function
+ (funcall org-latex-format-headline-function
todo todo-type priority text nil)
;; Default formatting.
(concat
@@ -1528,7 +1529,7 @@ holding contextual information."
;;;; Horizontal Rule
-(defun org-e-latex-horizontal-rule (horizontal-rule contents info)
+(defun org-latex-horizontal-rule (horizontal-rule contents info)
"Transcode an HORIZONTAL-RULE object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((attr (org-export-read-attribute :attr_latex horizontal-rule))
@@ -1540,7 +1541,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((prev-blank (org-element-property :post-blank prev)))
(or (not prev-blank) (zerop prev-blank))))
"\n")
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
horizontal-rule
(format "\\rule{%s}{%s}"
(or (plist-get attr :width) "\\linewidth")
@@ -1549,24 +1550,24 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Inline Src Block
-(defun org-e-latex-inline-src-block (inline-src-block contents info)
+(defun org-latex-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((code (org-element-property :value inline-src-block))
- (separator (org-e-latex--find-verb-separator code)))
+ (separator (org-latex--find-verb-separator code)))
(cond
;; Do not use a special package: transcode it verbatim.
- ((not org-e-latex-listings)
+ ((not org-latex-listings)
(concat "\\verb" separator code separator))
;; Use minted package.
- ((eq org-e-latex-listings 'minted)
+ ((eq org-latex-listings 'minted)
(let* ((org-lang (org-element-property :language inline-src-block))
(mint-lang (or (cadr (assq (intern org-lang)
- org-e-latex-minted-langs))
+ org-latex-minted-langs))
org-lang))
- (options (org-e-latex--make-option-string
- org-e-latex-minted-options)))
+ (options (org-latex--make-option-string
+ org-latex-minted-options)))
(concat (format "\\mint%s{%s}"
(if (string= options "") "" (format "[%s]" options))
mint-lang)
@@ -1576,10 +1577,10 @@ contextual information."
;; Maybe translate language's name.
(let* ((org-lang (org-element-property :language inline-src-block))
(lst-lang (or (cadr (assq (intern org-lang)
- org-e-latex-listings-langs))
+ org-latex-listings-langs))
org-lang))
- (options (org-e-latex--make-option-string
- (append org-e-latex-listings-options
+ (options (org-latex--make-option-string
+ (append org-latex-listings-options
`(("language" ,lst-lang))))))
(concat (format "\\lstinline[%s]" options)
separator code separator))))))
@@ -1587,7 +1588,7 @@ contextual information."
;;;; Inlinetask
-(defun org-e-latex-inlinetask (inlinetask contents info)
+(defun org-latex-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to LaTeX.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1600,13 +1601,13 @@ holding contextual information."
(org-export-get-tags inlinetask info)))
(priority (and (plist-get info :with-priority)
(org-element-property :priority inlinetask))))
- ;; If `org-e-latex-format-inlinetask-function' is provided, call it
+ ;; If `org-latex-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- (if (functionp org-e-latex-format-inlinetask-function)
- (funcall org-e-latex-format-inlinetask-function
+ (if (functionp org-latex-format-inlinetask-function)
+ (funcall org-latex-format-inlinetask-function
todo todo-type priority title tags contents)
;; Otherwise, use a default template.
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
inlinetask
(let ((full-title
(concat
@@ -1629,16 +1630,16 @@ holding contextual information."
;;;; Italic
-(defun org-e-latex-italic (italic contents info)
+(defun org-latex-italic (italic contents info)
"Transcode ITALIC from Org to LaTeX.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
- (org-e-latex--text-markup contents 'italic))
+ (org-latex--text-markup contents 'italic))
;;;; Item
-(defun org-e-latex-item (item contents info)
+(defun org-latex-item (item contents info)
"Transcode an ITEM element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1669,13 +1670,13 @@ contextual information."
;; workaround is necessary since "\footnote{}" command is
;; not supported in tags.
(and tag
- (org-e-latex--delayed-footnotes-definitions
+ (org-latex--delayed-footnotes-definitions
(org-element-property :tag item) info)))))
;;;; Keyword
-(defun org-e-latex-keyword (keyword contents info)
+(defun org-latex-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword))
@@ -1700,8 +1701,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((string= "figures" value) "\\listoffigures")
((string= "listings" value)
(cond
- ((eq org-e-latex-listings 'minted) "\\listoflistings")
- (org-e-latex-listings "\\lstlistoflistings")
+ ((eq org-latex-listings 'minted) "\\listoflistings")
+ (org-latex-listings "\\lstlistoflistings")
;; At the moment, src blocks with a caption are wrapped
;; into a figure environment.
(t "\\listoffigures")))))))))
@@ -1709,35 +1710,38 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Latex Environment
-(defun org-e-latex-latex-environment (latex-environment contents info)
+(defun org-latex-latex-environment (latex-environment contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((label (org-element-property :name latex-environment))
- (value (org-remove-indentation
- (org-element-property :value latex-environment))))
- (if (not (org-string-nw-p label)) value
- ;; Environment is labelled: label must be within the environment
- ;; (otherwise, a reference pointing to that element will count
- ;; the section instead).
- (with-temp-buffer
- (insert value)
- (goto-char (point-min))
- (forward-line)
- (insert (format "\\label{%s}\n" (org-export-solidify-link-text label)))
- (buffer-string)))))
+ (when (plist-get info :with-latex)
+ (let ((label (org-element-property :name latex-environment))
+ (value (org-remove-indentation
+ (org-element-property :value latex-environment))))
+ (if (not (org-string-nw-p label)) value
+ ;; Environment is labelled: label must be within the environment
+ ;; (otherwise, a reference pointing to that element will count
+ ;; the section instead).
+ (with-temp-buffer
+ (insert value)
+ (goto-char (point-min))
+ (forward-line)
+ (insert
+ (format "\\label{%s}\n" (org-export-solidify-link-text label)))
+ (buffer-string))))))
;;;; Latex Fragment
-(defun org-e-latex-latex-fragment (latex-fragment contents info)
+(defun org-latex-latex-fragment (latex-fragment contents info)
"Transcode a LATEX-FRAGMENT object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-element-property :value latex-fragment))
+ (when (plist-get info :with-latex)
+ (org-element-property :value latex-fragment)))
;;;; Line Break
-(defun org-e-latex-line-break (line-break contents info)
+(defun org-latex-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
"\\\\\n")
@@ -1745,7 +1749,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Link
-(defun org-e-latex--inline-image (link info)
+(defun org-latex--inline-image (link info)
"Return LaTeX code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel."
@@ -1753,7 +1757,7 @@ used as a communication channel."
(path (let ((raw-path (org-element-property :path link)))
(if (not (file-name-absolute-p raw-path)) raw-path
(expand-file-name raw-path))))
- (caption (org-e-latex--caption/label-string parent info))
+ (caption (org-latex--caption/label-string parent info))
;; Retrieve latex attributes from the element around.
(attr (org-export-read-attribute :attr_latex parent))
(float (let ((float (plist-get attr :float)))
@@ -1767,15 +1771,15 @@ used as a communication channel."
(cond (place (format "%s" place))
((eq float 'wrap) "{l}{0.5\\textwidth}")
((eq float 'figure)
- (format "[%s]" org-e-latex-default-figure-position))
+ (format "[%s]" org-latex-default-figure-position))
(t ""))))
(comment-include (if (plist-get attr :comment-include) "%" ""))
;; Options for "includegraphics" macro. Make sure it is
;; a string with square brackets when non empty. Default to
- ;; `org-e-latex-image-default-option' when possible.
+ ;; `org-latex-image-default-option' when possible.
(options (let ((opt (format "%s"
(or (plist-get attr :options)
- org-e-latex-image-default-option))))
+ org-latex-image-default-option))))
(cond ((string-match "\\`\\[.*\\]" opt) opt)
((org-string-nw-p opt) (format "[%s]" opt))
((eq float 'float) "[width=0.7\\textwidth]")
@@ -1797,7 +1801,7 @@ used as a communication channel."
%s\\end{figure}" placement comment-include options path caption))
(t (format "\\includegraphics%s{%s}" options path)))))
-(defun org-e-latex-link (link desc info)
+(defun org-latex-link (link desc info)
"Transcode a LINK object from Org to LaTeX.
DESC is the description part of the link, or the empty string.
@@ -1808,7 +1812,7 @@ INFO is a plist holding contextual information. See
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
(imagep (org-export-inline-image-p
- link org-e-latex-inline-image-rules))
+ link org-latex-inline-image-rules))
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
@@ -1820,7 +1824,7 @@ INFO is a plist holding contextual information. See
protocol)
(cond
;; Image file.
- (imagep (org-e-latex--inline-image link info))
+ (imagep (org-latex--inline-image link info))
;; Radio link: Transcode target's contents and use them as link's
;; description.
((string= type "radio")
@@ -1842,7 +1846,7 @@ INFO is a plist holding contextual information. See
(format "\\url{file://%s}" destination)))
;; Fuzzy link points nowhere.
('nil
- (format org-e-latex-link-with-unknown-path-format
+ (format org-latex-link-with-unknown-path-format
(or desc
(org-export-data
(org-element-property :raw-link link) info))))
@@ -1883,12 +1887,12 @@ INFO is a plist holding contextual information. See
;; External link without a description part.
(path (format "\\url{%s}" path))
;; No path, only description. Try to do something useful.
- (t (format org-e-latex-link-with-unknown-path-format desc)))))
+ (t (format org-latex-link-with-unknown-path-format desc)))))
;;;; Paragraph
-(defun org-e-latex-paragraph (paragraph contents info)
+(defun org-latex-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to LaTeX.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
@@ -1897,7 +1901,7 @@ the plist used as a communication channel."
;;;; Plain List
-(defun org-e-latex-plain-list (plain-list contents info)
+(defun org-latex-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to LaTeX.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -1908,7 +1912,7 @@ contextual information."
((eq type 'ordered) "enumerate")
((eq type 'unordered) "itemize")
((eq type 'descriptive) "description")))))
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
plain-list
(format "\\begin{%s}%s\n%s\\end{%s}"
latex-type
@@ -1924,7 +1928,7 @@ contextual information."
;;;; Plain Text
-(defun org-e-latex-plain-text (text info)
+(defun org-latex-plain-text (text info)
"Transcode a TEXT string from Org to LaTeX.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
@@ -1967,7 +1971,7 @@ contextual information."
;;;; Planning
-(defun org-e-latex-planning (planning contents info)
+(defun org-latex-planning (planning contents info)
"Transcode a PLANNING element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1981,21 +1985,21 @@ information."
(when closed
(concat
(format "\\textbf{%s} " org-closed-string)
- (format org-e-latex-inactive-timestamp-format
+ (format org-latex-inactive-timestamp-format
(org-translate-time
(org-element-property :raw-value closed))))))
(let ((deadline (org-element-property :deadline planning)))
(when deadline
(concat
(format "\\textbf{%s} " org-deadline-string)
- (format org-e-latex-active-timestamp-format
+ (format org-latex-active-timestamp-format
(org-translate-time
(org-element-property :raw-value deadline))))))
(let ((scheduled (org-element-property :scheduled planning)))
(when scheduled
(concat
(format "\\textbf{%s} " org-scheduled-string)
- (format org-e-latex-active-timestamp-format
+ (format org-latex-active-timestamp-format
(org-translate-time
(org-element-property :raw-value scheduled))))))))
" ")
@@ -2004,7 +2008,7 @@ information."
;;;; Property Drawer
-(defun org-e-latex-property-drawer (property-drawer contents info)
+(defun org-latex-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -2015,18 +2019,18 @@ information."
;;;; Quote Block
-(defun org-e-latex-quote-block (quote-block contents info)
+(defun org-latex-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
quote-block
(format "\\begin{quote}\n%s\\end{quote}" contents)))
;;;; Quote Section
-(defun org-e-latex-quote-section (quote-section contents info)
+(defun org-latex-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
@@ -2036,7 +2040,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Radio Target
-(defun org-e-latex-radio-target (radio-target text info)
+(defun org-latex-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to LaTeX.
TEXT is the text of the target. INFO is a plist holding
contextual information."
@@ -2048,7 +2052,7 @@ contextual information."
;;;; Section
-(defun org-e-latex-section (section contents info)
+(defun org-latex-section (section contents info)
"Transcode a SECTION element from Org to LaTeX.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -2057,7 +2061,7 @@ holding contextual information."
;;;; Special Block
-(defun org-e-latex-special-block (special-block contents info)
+(defun org-latex-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -2066,14 +2070,14 @@ holding contextual information."
;; Insert any label or caption within the block
;; (otherwise, a reference pointing to that element will
;; count the section instead).
- (org-e-latex--caption/label-string special-block info)
+ (org-latex--caption/label-string special-block info)
contents
(format "\\end{%s}" type))))
;;;; Src Block
-(defun org-e-latex-src-block (src-block contents info)
+(defun org-latex-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -2082,15 +2086,15 @@ contextual information."
(label (org-element-property :name src-block))
(custom-env (and lang
(cadr (assq (intern lang)
- org-e-latex-custom-lang-environments))))
+ org-latex-custom-lang-environments))))
(num-start (case (org-element-property :number-lines src-block)
(continued (org-export-get-loc src-block info))
(new 0)))
(retain-labels (org-element-property :retain-labels src-block)))
(cond
;; Case 1. No source fontification.
- ((not org-e-latex-listings)
- (let ((caption-str (org-e-latex--caption/label-string src-block info))
+ ((not org-latex-listings)
+ (let ((caption-str (org-latex--caption/label-string src-block info))
(float-env (when caption "\\begin{figure}[H]\n%s\n\\end{figure}")))
(format
(or float-env "%s")
@@ -2103,22 +2107,22 @@ contextual information."
(org-export-format-code-default src-block info)
custom-env))
;; Case 3. Use minted package.
- ((eq org-e-latex-listings 'minted)
+ ((eq org-latex-listings 'minted)
(let ((float-env
(when (or label caption)
(format "\\begin{listing}[H]\n%%s\n%s\\end{listing}"
- (org-e-latex--caption/label-string src-block info))))
+ (org-latex--caption/label-string src-block info))))
(body
(format
"\\begin{minted}[%s]{%s}\n%s\\end{minted}"
;; Options.
- (org-e-latex--make-option-string
- (if (not num-start) org-e-latex-minted-options
+ (org-latex--make-option-string
+ (if (not num-start) org-latex-minted-options
(append `(("linenos")
("firstnumber" ,(number-to-string (1+ num-start))))
- org-e-latex-minted-options)))
+ org-latex-minted-options)))
;; Language.
- (or (cadr (assq (intern lang) org-e-latex-minted-langs)) lang)
+ (or (cadr (assq (intern lang) org-latex-minted-langs)) lang)
;; Source code.
(let* ((code-info (org-export-unravel-code src-block))
(max-width
@@ -2142,7 +2146,7 @@ contextual information."
;; Case 4. Use listings package.
(t
(let ((lst-lang
- (or (cadr (assq (intern lang) org-e-latex-listings-langs)) lang))
+ (or (cadr (assq (intern lang) org-latex-listings-langs)) lang))
(caption-str
(when caption
(let ((main (org-export-get-caption src-block))
@@ -2154,8 +2158,8 @@ contextual information."
(concat
;; Options.
(format "\\lstset{%s}\n"
- (org-e-latex--make-option-string
- (append org-e-latex-listings-options
+ (org-latex--make-option-string
+ (append org-latex-listings-options
`(("language" ,lst-lang))
(when label `(("label" ,label)))
(when caption-str `(("caption" ,caption-str)))
@@ -2188,7 +2192,7 @@ contextual information."
;;;; Statistics Cookie
-(defun org-e-latex-statistics-cookie (statistics-cookie contents info)
+(defun org-latex-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
(replace-regexp-in-string
@@ -2197,16 +2201,16 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Strike-Through
-(defun org-e-latex-strike-through (strike-through contents info)
+(defun org-latex-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to LaTeX.
CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information."
- (org-e-latex--text-markup contents 'strike-through))
+ (org-latex--text-markup contents 'strike-through))
;;;; Subscript
-(defun org-e-latex-subscript (subscript contents info)
+(defun org-latex-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to LaTeX.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -2239,7 +2243,7 @@ contextual information."
;;;; Superscript
-(defun org-e-latex-superscript (superscript contents info)
+(defun org-latex-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to LaTeX.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -2272,24 +2276,24 @@ contextual information."
;;;; Table
;;
-;; `org-e-latex-table' is the entry point for table transcoding. It
+;; `org-latex-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" mode. Otherwise, it
-;; delegates the job to either `org-e-latex--table.el-table',
-;; `org-e-latex--org-table' or `org-e-latex--math-table' functions,
+;; delegates the job to either `org-latex--table.el-table',
+;; `org-latex--org-table' or `org-latex--math-table' functions,
;; depending of the type of the table and the mode requested.
;;
-;; `org-e-latex--align-string' is a subroutine used to build alignment
+;; `org-latex--align-string' is a subroutine used to build alignment
;; string for Org tables.
-(defun org-e-latex-table (table contents info)
+(defun org-latex-table (table contents info)
"Transcode a TABLE element from Org to LaTeX.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
(if (eq (org-element-property :type table) 'table.el)
;; "table.el" table. Convert it using appropriate tools.
- (org-e-latex--table.el-table table info)
+ (org-latex--table.el-table table info)
(let ((type (or (org-export-read-attribute :attr_latex table :mode)
- org-e-latex-default-table-mode)))
+ org-latex-default-table-mode)))
(cond
;; Case 1: Verbatim table.
((string= type "verbatim")
@@ -2299,14 +2303,14 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: Matrix.
((or (string= type "math") (string= type "inline-math"))
- (org-e-latex--math-table table info))
+ (org-latex--math-table table info))
;; Case 3: Standard table.
- (t (concat (org-e-latex--org-table table contents info)
+ (t (concat (org-latex--org-table table contents info)
;; When there are footnote references within the
;; table, insert their definition just after it.
- (org-e-latex--delayed-footnotes-definitions table info)))))))
+ (org-latex--delayed-footnotes-definitions table info)))))))
-(defun org-e-latex--align-string (table info)
+(defun org-latex--align-string (table info)
"Return an appropriate LaTeX alignment string.
TABLE is the considered table. INFO is a plist used as
a communication channel."
@@ -2315,27 +2319,26 @@ a communication channel."
;; 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)))
- ;; Check left border for the first cell only.
- (when (and (memq 'left borders) (not align))
- (push "|" align))
- (push (case (org-export-table-cell-alignment cell info)
- (left "l")
- (right "r")
- (center "c"))
- align)
- (when (memq 'right borders) (push "|" align))))
- info)
+ (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)))
+ ;; Check left border for the first cell only.
+ (when (and (memq 'left borders) (not align))
+ (push "|" align))
+ (push (case (org-export-table-cell-alignment cell info)
+ (left "l")
+ (right "r")
+ (center "c"))
+ align)
+ (when (memq 'right borders) (push "|" align))))
+ info)
(apply 'concat (nreverse align)))))
-(defun org-e-latex--org-table (table contents info)
+(defun org-latex--org-table (table contents info)
"Return appropriate LaTeX code for an Org table.
TABLE is the table type element to transcode. CONTENTS is its
@@ -2344,14 +2347,14 @@ channel.
This function assumes TABLE has `org' as its `:type' property and
`table' as its `:mode' attribute."
- (let* ((caption (org-e-latex--caption/label-string table info))
+ (let* ((caption (org-latex--caption/label-string table info))
(attr (org-export-read-attribute :attr_latex table))
;; Determine alignment string.
- (alignment (org-e-latex--align-string table info))
+ (alignment (org-latex--align-string table info))
;; Determine environment for the table: longtable, tabular...
(table-env (let ((env (plist-get attr :environment)))
(if env (format "%s" env)
- org-e-latex-default-table-environment)))
+ org-latex-default-table-environment)))
;; If table is a float, determine environment: table, table*
;; or sidewaystable.
(float-env (unless (equal "longtable" table-env)
@@ -2367,20 +2370,20 @@ This function assumes TABLE has `org' as its `:type' property and
(and font (concat (org-trim (format "%s" font)) "\n"))))
(width (plist-get attr :width))
(placement (or (plist-get attr :placement)
- (format "[%s]" org-e-latex-default-figure-position)))
+ (format "[%s]" org-latex-default-figure-position)))
(centerp (if (plist-member attr :center) (plist-get attr :center)
- org-e-latex-tables-centered)))
+ org-latex-tables-centered)))
;; Prepare the final format string for the table.
(cond
;; Longtable.
((equal "longtable" table-env)
(concat (and fontsize (concat "{" fontsize))
(format "\\begin{longtable}{%s}\n" alignment)
- (and org-e-latex-table-caption-above
+ (and org-latex-table-caption-above
(org-string-nw-p caption)
(concat caption "\\\\\n"))
contents
- (and (not org-e-latex-table-caption-above)
+ (and (not org-latex-table-caption-above)
(org-string-nw-p caption)
(concat caption "\\\\\n"))
"\\end{longtable}\n"
@@ -2389,7 +2392,7 @@ This function assumes TABLE has `org' as its `:type' property and
(t (concat (cond
(float-env
(concat (format "\\begin{%s}%s\n" float-env placement)
- (if org-e-latex-table-caption-above caption "")
+ (if org-latex-table-caption-above caption "")
(when centerp "\\centering\n")
fontsize))
(centerp (concat "\\begin{center}\n" fontsize))
@@ -2402,12 +2405,12 @@ This function assumes TABLE has `org' as its `:type' property and
table-env)
(cond
(float-env
- (concat (if org-e-latex-table-caption-above "" caption)
+ (concat (if org-latex-table-caption-above "" caption)
(format "\n\\end{%s}" float-env)))
(centerp "\n\\end{center}")
(fontsize "}")))))))
-(defun org-e-latex--table.el-table (table info)
+(defun org-latex--table.el-table (table info)
"Return appropriate LaTeX code for a table.el table.
TABLE is the table type element to transcode. INFO is a plist
@@ -2440,11 +2443,11 @@ property."
(incf n)
(unless (= n 2) (setq output (replace-match "" nil nil output))))))
(let ((centerp (if (plist-member attr :center) (plist-get attr :center)
- org-e-latex-tables-centered)))
+ org-latex-tables-centered)))
(if (not centerp) output
(format "\\begin{center}\n%s\n\\end{center}" output))))))
-(defun org-e-latex--math-table (table info)
+(defun org-latex--math-table (table info)
"Return appropriate LaTeX code for a matrix.
TABLE is the table type element to transcode. INFO is a plist
@@ -2452,12 +2455,12 @@ used as a communication channel.
This function assumes TABLE has `org' as its `:type' property and
`inline-math' or `math' as its `:mode' attribute.."
- (let* ((caption (org-e-latex--caption/label-string table info))
+ (let* ((caption (org-latex--caption/label-string table info))
(attr (org-export-read-attribute :attr_latex table))
(inlinep (eq (plist-get attr :mode) 'inline-math))
(env (let ((env (plist-get attr :environment)))
(if env (format "%s" env)
- org-e-latex-default-table-environment)))
+ org-latex-default-table-environment)))
(contents
(mapconcat
(lambda (row)
@@ -2469,7 +2472,7 @@ This function assumes TABLE has `org' as its `:type' property and
(lambda (cell)
(substring (org-element-interpret-data cell) 0 -1))
(org-element-map row 'table-cell 'identity info) "&")
- (or (cdr (assoc env org-e-latex-table-matrix-macros)) "\\\\")
+ (or (cdr (assoc env org-latex-table-matrix-macros)) "\\\\")
"\n")))
(org-element-map table 'table-row 'identity info) ""))
;; Variables related to math clusters (contiguous math tables
@@ -2481,7 +2484,7 @@ This function assumes TABLE has `org' as its `:type' property and
(lambda (table)
;; Non-nil when TABLE has the same mode as current table.
(string= (or (org-export-read-attribute :attr_latex table :mode)
- org-e-latex-default-table-mode)
+ org-latex-default-table-mode)
mode))))
(concat
;; Opening string. If TABLE is in the middle of a table cluster,
@@ -2498,9 +2501,9 @@ This function assumes TABLE has `org' as its `:type' property and
(format "%s" (or (plist-get attr :math-prefix) ""))
;; Environment. Also treat special cases.
(cond ((equal env "array")
- (let ((align (org-e-latex--align-string table info)))
+ (let ((align (org-latex--align-string table info)))
(format "\\begin{array}{%s}\n%s\\end{array}" align contents)))
- ((assoc env org-e-latex-table-matrix-macros)
+ ((assoc env org-latex-table-matrix-macros)
(format "\\%s%s{\n%s}" env
(format "%s" (or (plist-get attr :math-arguments) ""))
contents))
@@ -2532,16 +2535,16 @@ This function assumes TABLE has `org' as its `:type' property and
;;;; Table Cell
-(defun org-e-latex-table-cell (table-cell contents info)
+(defun org-latex-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to LaTeX.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
(concat (if (and contents
- org-e-latex-table-scientific-notation
+ org-latex-table-scientific-notation
(string-match orgtbl-exp-regexp contents))
;; Use appropriate format string for scientific
;; notation.
- (format org-e-latex-table-scientific-notation
+ (format org-latex-table-scientific-notation
(match-string 1 contents)
(match-string 2 contents))
contents)
@@ -2550,7 +2553,7 @@ a communication channel."
;;;; Table Row
-(defun org-e-latex-table-row (table-row contents info)
+(defun org-latex-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to LaTeX.
CONTENTS is the contents of the row. INFO is a plist used as
a communication channel."
@@ -2560,11 +2563,11 @@ a communication channel."
(let* ((attr (org-export-read-attribute :attr_latex
(org-export-get-parent table-row)))
(longtablep (string= (or (plist-get attr :environment)
- org-e-latex-default-table-environment)
+ org-latex-default-table-environment)
"longtable"))
(booktabsp (if (plist-member attr :booktabs)
(plist-get attr :booktabs)
- org-e-latex-tables-booktabs))
+ org-latex-tables-booktabs))
;; TABLE-ROW's borders are extracted from its first cell.
(borders (org-export-table-cell-borders
(car (org-element-contents table-row)) info)))
@@ -2596,7 +2599,7 @@ a communication channel."
;;;; Target
-(defun org-e-latex-target (target contents info)
+(defun org-latex-target (target contents info)
"Transcode a TARGET object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -2606,44 +2609,44 @@ information."
;;;; Timestamp
-(defun org-e-latex-timestamp (timestamp contents info)
+(defun org-latex-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (let ((value (org-e-latex-plain-text
+ (let ((value (org-latex-plain-text
(org-timestamp-translate timestamp) info)))
(case (org-element-property :type timestamp)
- ((active active-range) (format org-e-latex-active-timestamp-format value))
+ ((active active-range) (format org-latex-active-timestamp-format value))
((inactive inactive-range)
- (format org-e-latex-inactive-timestamp-format value))
- (otherwise (format org-e-latex-diary-timestamp-format value)))))
+ (format org-latex-inactive-timestamp-format value))
+ (otherwise (format org-latex-diary-timestamp-format value)))))
;;;; Underline
-(defun org-e-latex-underline (underline contents info)
+(defun org-latex-underline (underline contents info)
"Transcode UNDERLINE from Org to LaTeX.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
- (org-e-latex--text-markup contents 'underline))
+ (org-latex--text-markup contents 'underline))
;;;; Verbatim
-(defun org-e-latex-verbatim (verbatim contents info)
+(defun org-latex-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to LaTeX.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-latex--text-markup (org-element-property :value verbatim) 'verbatim))
+ (org-latex--text-markup (org-element-property :value verbatim) 'verbatim))
;;;; Verse Block
-(defun org-e-latex-verse-block (verse-block contents info)
+(defun org-latex-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to LaTeX.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
- (org-e-latex--wrap-label
+ (org-latex--wrap-label
verse-block
;; In a verse environment, add a line break to each newline
;; character and change each white space at beginning of a line
@@ -2665,7 +2668,7 @@ contextual information."
;;; End-user functions
;;;###autoload
-(defun org-e-latex-export-as-latex
+(defun org-latex-export-as-latex
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer as a LaTeX buffer.
@@ -2692,30 +2695,30 @@ EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
-Export is done in a buffer named \"*Org E-LATEX Export*\", which
+Export is done in a buffer named \"*Org LATEX Export*\", which
will be displayed when `org-export-show-temporary-export-buffer'
is non-nil."
(interactive)
(if async
(org-export-async-start
(lambda (output)
- (with-current-buffer (get-buffer-create "*Org E-LATEX Export*")
+ (with-current-buffer (get-buffer-create "*Org LATEX Export*")
(erase-buffer)
(insert output)
(goto-char (point-min))
(LaTeX-mode)
- (org-export-add-to-stack (current-buffer) 'e-latex)))
- `(org-export-as 'e-latex ,subtreep ,visible-only ,body-only
+ (org-export-add-to-stack (current-buffer) 'latex)))
+ `(org-export-as 'latex ,subtreep ,visible-only ,body-only
',ext-plist))
(let ((outbuf
- (org-export-to-buffer 'e-latex "*Org E-LATEX Export*"
+ (org-export-to-buffer 'latex "*Org LATEX Export*"
subtreep visible-only body-only ext-plist)))
(with-current-buffer outbuf (LaTeX-mode))
(when org-export-show-temporary-export-buffer
(switch-to-buffer-other-window outbuf)))))
;;;###autoload
-(defun org-e-latex-export-to-latex
+(defun org-latex-export-to-latex
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a LaTeX file.
@@ -2747,15 +2750,15 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-latex))
+ (lambda (f) (org-export-add-to-stack f 'latex))
`(expand-file-name
(org-export-to-file
- 'e-latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
+ 'latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
- 'e-latex outfile subtreep visible-only body-only ext-plist))))
+ 'latex outfile subtreep visible-only body-only ext-plist))))
;;;###autoload
-(defun org-e-latex-export-to-pdf
+(defun org-latex-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to LaTeX then process through to PDF.
@@ -2787,21 +2790,21 @@ Return PDF file's name."
(if async
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-latex))
+ (lambda (f) (org-export-add-to-stack f 'latex))
`(expand-file-name
- (org-e-latex-compile
+ (org-latex-compile
(org-export-to-file
- 'e-latex ,outfile ,subtreep ,visible-only ,body-only
+ 'latex ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
- (org-e-latex-compile
- (org-e-latex-export-to-latex
+ (org-latex-compile
+ (org-latex-export-to-latex
nil subtreep visible-only body-only ext-plist))))
-(defun org-e-latex-compile (texfile)
+(defun org-latex-compile (texfile)
"Compile a TeX file.
TEXFILE is the name of the file being compiled. Processing is
-done through the command specified in `org-e-latex-pdf-process'.
+done through the command specified in `org-latex-pdf-process'.
Return PDF file name or an error if it couldn't be produced."
(let* ((base-name (file-name-sans-extension (file-name-nondirectory texfile)))
@@ -2815,12 +2818,12 @@ Return PDF file name or an error if it couldn't be produced."
(save-window-excursion
(cond
;; A function is provided: Apply it.
- ((functionp org-e-latex-pdf-process)
- (funcall org-e-latex-pdf-process (shell-quote-argument texfile)))
+ ((functionp org-latex-pdf-process)
+ (funcall org-latex-pdf-process (shell-quote-argument texfile)))
;; A list is provided: Replace %b, %f and %o with appropriate
;; values in each command before applying it. Output is
;; redirected to "*Org PDF LaTeX Output*" buffer.
- ((consp org-e-latex-pdf-process)
+ ((consp org-latex-pdf-process)
(let ((outbuf (get-buffer-create "*Org PDF LaTeX Output*")))
(mapc
(lambda (command)
@@ -2832,9 +2835,9 @@ Return PDF file name or an error if it couldn't be produced."
(replace-regexp-in-string
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
outbuf))
- org-e-latex-pdf-process)
+ org-latex-pdf-process)
;; Collect standard errors from output buffer.
- (setq errors (org-e-latex--collect-errors outbuf))))
+ (setq errors (org-latex--collect-errors outbuf))))
(t (error "No valid command to process to PDF")))
(let ((pdffile (concat out-dir base-name ".pdf")))
;; Check for process failure. Provide collected errors if
@@ -2844,8 +2847,8 @@ Return PDF file name or an error if it couldn't be produced."
(when errors (concat ": " errors))))
;; Else remove log files, when specified, and signal end of
;; process to user, along with any error encountered.
- (when org-e-latex-remove-logfiles
- (dolist (ext org-e-latex-logfiles-extensions)
+ (when org-latex-remove-logfiles
+ (dolist (ext org-latex-logfiles-extensions)
(let ((file (concat out-dir base-name "." ext)))
(when (file-exists-p file) (delete-file file)))))
(message (concat "Process completed"
@@ -2854,7 +2857,7 @@ Return PDF file name or an error if it couldn't be produced."
;; Return output file name.
pdffile))))
-(defun org-e-latex--collect-errors (buffer)
+(defun org-latex--collect-errors (buffer)
"Collect some kind of errors from \"pdflatex\" command output.
BUFFER is the buffer containing output.
@@ -2867,13 +2870,13 @@ none."
(when (re-search-backward "^[ \t]*This is .*?TeX.*?Version" nil t)
(let ((case-fold-search t)
(errors ""))
- (dolist (latex-error org-e-latex-known-errors)
+ (dolist (latex-error org-latex-known-errors)
(when (save-excursion (re-search-forward (car latex-error) nil t))
(setq errors (concat errors " " (cdr latex-error)))))
(and (org-string-nw-p errors) (org-trim errors)))))))
;;;###autoload
-(defun org-e-latex-publish-to-latex (plist filename pub-dir)
+(defun org-latex-publish-to-latex (plist filename pub-dir)
"Publish an Org file to LaTeX.
FILENAME is the filename of the Org file to be published. PLIST
@@ -2881,10 +2884,10 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- (org-e-publish-org-to 'e-latex filename ".tex" plist pub-dir))
+ (org-publish-org-to 'latex filename ".tex" plist pub-dir))
;;;###autoload
-(defun org-e-latex-publish-to-pdf (plist filename pub-dir)
+(defun org-latex-publish-to-pdf (plist filename pub-dir)
"Publish an Org file to PDF (via LaTeX).
FILENAME is the filename of the Org file to be published. PLIST
@@ -2892,13 +2895,18 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
- ;; Unlike to `org-e-latex-publish-to-latex', PDF file is generated
+ ;; Unlike to `org-latex-publish-to-latex', PDF file is generated
;; in working directory and then moved to publishing directory.
- (org-e-publish-attachment
+ (org-publish-attachment
plist
- (org-e-latex-compile (org-e-publish-org-to 'e-latex filename ".tex" plist))
+ (org-latex-compile (org-publish-org-to 'latex filename ".tex" plist))
pub-dir))
-(provide 'org-e-latex)
-;;; org-e-latex.el ends here
+(provide 'ox-latex)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-latex.el ends here
diff --git a/contrib/lisp/org-e-man.el b/lisp/ox-man.el
index 461ed61..df99602 100644
--- a/contrib/lisp/org-e-man.el
+++ b/lisp/ox-man.el
@@ -1,4 +1,4 @@
-;; org-e-man.el --- Man Back-End For Org Export Engine
+;; ox-man.el --- Man Back-End for Org Export Engine
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
@@ -26,18 +26,17 @@
;;
;; To test it, run
;;
-;; M-: (org-export-to-buffer 'e-man "*Test e-Man*") RET
+;; M-: (org-export-to-buffer 'man "*Test Man*") RET
;;
;; in an org-mode buffer then switch to the buffer to see the Man
-;; export. See contrib/lisp/org-export.el for more details on how
-;; this exporter works.
+;; export. See ox.el for more details on how this exporter works.
;;
;; It introduces one new buffer keywords:
;; "MAN_CLASS_OPTIONS".
;;; Code:
-(require 'org-export)
+(require 'ox)
(eval-when-compile (require 'cl))
@@ -49,68 +48,66 @@
;;; Define Back-End
-(org-export-define-backend e-man
- ((babel-call . org-e-man-babel-call)
- (bold . org-e-man-bold)
- (center-block . org-e-man-center-block)
- (clock . org-e-man-clock)
- (code . org-e-man-code)
- (comment . org-e-man-comment)
- (comment-block . org-e-man-comment-block)
- (drawer . org-e-man-drawer)
- (dynamic-block . org-e-man-dynamic-block)
- (entity . org-e-man-entity)
- (example-block . org-e-man-example-block)
- (export-block . org-e-man-export-block)
- (export-snippet . org-e-man-export-snippet)
- (fixed-width . org-e-man-fixed-width)
- (footnote-definition . org-e-man-footnote-definition)
- (footnote-reference . org-e-man-footnote-reference)
- (headline . org-e-man-headline)
- (horizontal-rule . org-e-man-horizontal-rule)
- (inline-babel-call . org-e-man-inline-babel-call)
- (inline-src-block . org-e-man-inline-src-block)
- (inlinetask . org-e-man-inlinetask)
- (italic . org-e-man-italic)
- (item . org-e-man-item)
- (keyword . org-e-man-keyword)
- (man-environment . org-e-man-man-environment)
- (man-fragment . org-e-man-man-fragment)
- (line-break . org-e-man-line-break)
- (link . org-e-man-link)
- (paragraph . org-e-man-paragraph)
- (plain-list . org-e-man-plain-list)
- (plain-text . org-e-man-plain-text)
- (planning . org-e-man-planning)
- (property-drawer . org-e-man-property-drawer)
- (quote-block . org-e-man-quote-block)
- (quote-section . org-e-man-quote-section)
- (radio-target . org-e-man-radio-target)
- (section . org-e-man-section)
- (special-block . org-e-man-special-block)
- (src-block . org-e-man-src-block)
- (statistics-cookie . org-e-man-statistics-cookie)
- (strike-through . org-e-man-strike-through)
- (subscript . org-e-man-subscript)
- (superscript . org-e-man-superscript)
- (table . org-e-man-table)
- (table-cell . org-e-man-table-cell)
- (table-row . org-e-man-table-row)
- (target . org-e-man-target)
- (template . org-e-man-template)
- (timestamp . org-e-man-timestamp)
- (underline . org-e-man-underline)
- (verbatim . org-e-man-verbatim)
- (verse-block . org-e-man-verse-block))
+(org-export-define-backend man
+ ((babel-call . org-man-babel-call)
+ (bold . org-man-bold)
+ (center-block . org-man-center-block)
+ (clock . org-man-clock)
+ (code . org-man-code)
+ (comment . org-man-comment)
+ (comment-block . org-man-comment-block)
+ (drawer . org-man-drawer)
+ (dynamic-block . org-man-dynamic-block)
+ (entity . org-man-entity)
+ (example-block . org-man-example-block)
+ (export-block . org-man-export-block)
+ (export-snippet . org-man-export-snippet)
+ (fixed-width . org-man-fixed-width)
+ (footnote-definition . org-man-footnote-definition)
+ (footnote-reference . org-man-footnote-reference)
+ (headline . org-man-headline)
+ (horizontal-rule . org-man-horizontal-rule)
+ (inline-babel-call . org-man-inline-babel-call)
+ (inline-src-block . org-man-inline-src-block)
+ (inlinetask . org-man-inlinetask)
+ (italic . org-man-italic)
+ (item . org-man-item)
+ (keyword . org-man-keyword)
+ (line-break . org-man-line-break)
+ (link . org-man-link)
+ (paragraph . org-man-paragraph)
+ (plain-list . org-man-plain-list)
+ (plain-text . org-man-plain-text)
+ (planning . org-man-planning)
+ (property-drawer . org-man-property-drawer)
+ (quote-block . org-man-quote-block)
+ (quote-section . org-man-quote-section)
+ (radio-target . org-man-radio-target)
+ (section . org-man-section)
+ (special-block . org-man-special-block)
+ (src-block . org-man-src-block)
+ (statistics-cookie . org-man-statistics-cookie)
+ (strike-through . org-man-strike-through)
+ (subscript . org-man-subscript)
+ (superscript . org-man-superscript)
+ (table . org-man-table)
+ (table-cell . org-man-table-cell)
+ (table-row . org-man-table-row)
+ (target . org-man-target)
+ (template . org-man-template)
+ (timestamp . org-man-timestamp)
+ (underline . org-man-underline)
+ (verbatim . org-man-verbatim)
+ (verse-block . org-man-verse-block))
:export-block "MAN"
:menu-entry
(?m "Export to MAN"
- ((?m "As MAN file" org-e-man-export-to-man)
- (?p "As PDF file" org-e-man-export-to-pdf)
+ ((?m "As MAN file" org-man-export-to-man)
+ (?p "As PDF file" org-man-export-to-pdf)
(?o "As PDF file and open"
(lambda (a s v b)
- (if a (org-e-man-export-to-pdf t s v b)
- (org-open-file (org-e-man-export-to-pdf nil s v b)))))))
+ (if a (org-man-export-to-pdf t s v b)
+ (org-open-file (org-man-export-to-pdf nil s v b)))))))
:options-alist
((:man-class "MAN_CLASS" nil nil t)
(:man-class-options "MAN_CLASS_OPTIONS" nil nil t)
@@ -120,31 +117,31 @@
;;; User Configurable Variables
-(defgroup org-export-e-man nil
+(defgroup org-export-man nil
"Options for exporting Org mode files to Man."
:tag "Org Export Man"
:group 'org-export)
;;; Tables
-(defcustom org-e-man-tables-centered t
+(defcustom org-man-tables-centered t
"When non-nil, tables are exported in a center environment."
- :group 'org-export-e-man
+ :group 'org-export-man
:type 'boolean)
-(defcustom org-e-man-tables-verbatim nil
+(defcustom org-man-tables-verbatim nil
"When non-nil, tables are exported verbatim."
- :group 'org-export-e-man
+ :group 'org-export-man
:type 'boolean)
-(defcustom org-e-man-table-scientific-notation "%sE%s"
+(defcustom org-man-table-scientific-notation "%sE%s"
"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."
- :group 'org-export-e-man
+ :group 'org-export-man
:type '(choice
(string :tag "Format string")
(const :tag "No formatting")))
@@ -153,13 +150,13 @@ When nil, no transformation is made."
;;; Inlinetasks
;; Src blocks
-(defcustom org-e-man-source-highlight nil
+(defcustom org-man-source-highlight nil
"Use GNU source highlight to embellish source blocks "
- :group 'org-export-e-man
+ :group 'org-export-man
:type 'boolean)
-(defcustom org-e-man-source-highlight-langs
+(defcustom org-man-source-highlight-langs
'((emacs-lisp "lisp") (lisp "lisp") (clojure "lisp")
(scheme "scheme")
(c "c") (cc "cpp") (csharp "csharp") (d "d")
@@ -184,7 +181,7 @@ 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."
- :group 'org-export-e-man
+ :group 'org-export-man
:type '(repeat
(list
(symbol :tag "Major mode ")
@@ -192,13 +189,13 @@ in this list - but it does not hurt if it is present."
-(defvar org-e-man-custom-lang-environments nil
+(defvar org-man-custom-lang-environments nil
"Alist mapping languages to language-specific Man environments.
It is used during export of src blocks by the listings and
man packages. For example,
- \(setq org-e-man-custom-lang-environments
+ \(setq org-man-custom-lang-environments
'\(\(python \"pythoncode\"\)\)\)
would have the effect that if org encounters begin_src python
@@ -208,7 +205,7 @@ during man export."
;;; Compilation
-(defcustom org-e-man-pdf-process
+(defcustom org-man-pdf-process
'("tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
"tbl %f | eqn | groff -man | ps2pdf - > %b.pdf"
"tbl %f | eqn | groff -man | ps2pdf - > %b.pdf")
@@ -238,29 +235,29 @@ its single argument."
"tbl %f | eqn | groff -mm | ps2pdf - > %b.pdf"))
(function)))
-(defcustom org-e-man-logfiles-extensions
+(defcustom org-man-logfiles-extensions
'("log" "out" "toc")
"The list of file extensions to consider as Man logfiles."
- :group 'org-export-e-man
+ :group 'org-export-man
:type '(repeat (string :tag "Extension")))
-(defcustom org-e-man-remove-logfiles t
+(defcustom org-man-remove-logfiles t
"Non-nil means remove the logfiles produced by PDF production.
These are the .aux, .log, .out, and .toc files."
- :group 'org-export-e-man
+ :group 'org-export-man
:type 'boolean)
;;; Internal Functions
-(defun org-e-man--caption/label-string (element info)
+(defun org-man--caption/label-string (element info)
"Return caption and label Man string for ELEMENT.
INFO is a plist holding contextual information. If there's no
caption nor label, return the empty string.
-For non-floats, see `org-e-man--wrap-label'."
+For non-floats, see `org-man--wrap-label'."
(let ((label (org-element-property :label element))
(main (org-export-get-caption element))
(short (org-export-get-caption element t)))
@@ -273,10 +270,10 @@ For non-floats, see `org-e-man--wrap-label'."
;; Standard caption format.
(t (format "\\fR%s\\fP" (org-export-data main info))))))
-(defun org-e-man--wrap-label (element output)
+(defun org-man--wrap-label (element output)
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
This function shouldn't be used for floats. See
-`org-e-man--caption/label-string'."
+`org-man--caption/label-string'."
(let ((label (org-element-property :name element)))
(if (or (not output) (not label) (string= output "") (string= label ""))
output
@@ -286,7 +283,7 @@ This function shouldn't be used for floats. See
;;; Template
-(defun org-e-man-template (contents info)
+(defun org-man-template (contents info)
"Return complete document string after Man conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
@@ -323,7 +320,7 @@ holding export options."
;;; Bold
-(defun org-e-man-bold (bold contents info)
+(defun org-man-bold (bold contents info)
"Transcode BOLD from Org to Man.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
@@ -332,11 +329,11 @@ contextual information."
;;; Center Block
-(defun org-e-man-center-block (center-block contents info)
+(defun org-man-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to Man.
CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
- (org-e-man--wrap-label
+ (org-man--wrap-label
center-block
(format ".ce %d\n.nf\n%s\n.fi"
(- (length (split-string contents "\n")) 1 )
@@ -345,7 +342,7 @@ holding contextual information."
;;; Clock
-(defun org-e-man-clock (clock contents info)
+(defun org-man-clock (clock contents info)
"Transcode a CLOCK element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -354,7 +351,7 @@ information."
;;; Code
-(defun org-e-man-code (code contents info)
+(defun org-man-code (code contents info)
"Transcode a CODE object from Org to Man.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -373,7 +370,7 @@ channel."
;;; Drawer
-(defun org-e-man-drawer (drawer contents info)
+(defun org-man-drawer (drawer contents info)
"Transcode a DRAWER element from Org to Man.
DRAWER holds the drawer information
CONTENTS holds the contents of the block.
@@ -383,16 +380,16 @@ channel."
;;; Dynamic Block
-(defun org-e-man-dynamic-block (dynamic-block contents info)
+(defun org-man-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to Man.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
- (org-e-man--wrap-label dynamic-block contents))
+ (org-man--wrap-label dynamic-block contents))
;;; Entity
-(defun org-e-man-entity (entity contents info)
+(defun org-man-entity (entity contents info)
"Transcode an ENTITY object from Org to Man.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -401,11 +398,11 @@ contextual information."
;;; Example Block
-(defun org-e-man-example-block (example-block contents info)
+(defun org-man-example-block (example-block contents info)
"Transcode an EXAMPLE-BLOCK element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (org-e-man--wrap-label
+ (org-man--wrap-label
example-block
(format ".RS\n.nf\n%s\n.fi\n.RE"
(org-export-format-code-default example-block info))))
@@ -413,7 +410,7 @@ information."
;;; Export Block
-(defun org-e-man-export-block (export-block contents info)
+(defun org-man-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "MAN")
@@ -422,19 +419,19 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Export Snippet
-(defun org-e-man-export-snippet (export-snippet contents info)
+(defun org-man-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-man)
+ (when (eq (org-export-snippet-backend export-snippet) 'man)
(org-element-property :value export-snippet)))
;;; Fixed Width
-(defun org-e-man-fixed-width (fixed-width contents info)
+(defun org-man-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-man--wrap-label
+ (org-man--wrap-label
fixed-width
(format "\\fC\n%s\\fP"
(org-remove-indentation
@@ -452,7 +449,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Headline
-(defun org-e-man-headline (headline contents info)
+(defun org-man-headline (headline contents info)
"Transcode an HEADLINE element from Org to Man.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
@@ -505,13 +502,13 @@ holding contextual information."
;;; Inline Src Block
-(defun org-e-man-inline-src-block (inline-src-block contents info)
+(defun org-man-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to Man.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((code (org-element-property :value inline-src-block)))
(cond
- (org-e-man-source-highlight
+ (org-man-source-highlight
(let* ((tmpdir (if (featurep 'xemacs)
temp-directory
temporary-file-directory ))
@@ -521,7 +518,7 @@ contextual information."
(expand-file-name "reshilite" tmpdir)))
(org-lang (org-element-property :language inline-src-block))
(lst-lang (cadr (assq (intern org-lang)
- org-e-man-source-highlight-langs)))
+ org-man-source-highlight-langs)))
(cmd (concat (expand-file-name "source-highlight")
" -s " lst-lang
@@ -549,7 +546,7 @@ contextual information."
;;; Inlinetask
;;; Italic
-(defun org-e-man-italic (italic contents info)
+(defun org-man-italic (italic contents info)
"Transcode ITALIC from Org to Man.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
@@ -559,7 +556,7 @@ contextual information."
;;; Item
-(defun org-e-man-item (item contents info)
+(defun org-man-item (item contents info)
"Transcode an ITEM element from Org to Man.
CONTENTS holds the contents of the item. INFO is a plist holding
@@ -595,7 +592,7 @@ contextual information."
;;; Keyword
-(defun org-e-man-keyword (keyword contents info)
+(defun org-man-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword))
@@ -608,37 +605,9 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((string= key "TOC" ) nil))))
-;;; Man Environment
-
-(defun org-e-man-man-environment (man-environment contents info)
- "Transcode a MAN-ENVIRONMENT element from Org to Man.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((label (org-element-property :name man-environment))
- (value (org-remove-indentation
- (org-element-property :value man-environment))))
- (if (not (org-string-nw-p label)) value
- ;; Environment is labelled: label must be within the environment
- ;; (otherwise, a reference pointing to that element will count
- ;; the section instead).
- (with-temp-buffer
- (insert value)
- (goto-char (point-min))
- (forward-line)
- (insert (format "%s\n" label))
- (buffer-string)))))
-
-
-;;; Man Fragment
-
-(defun org-e-man-man-fragment (man-fragment contents info)
- "Transcode a MAN-FRAGMENT object from Org to Man.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (org-element-property :value man-fragment))
-
-
;;; Line Break
-(defun org-e-man-line-break (line-break contents info)
+(defun org-man-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
".br\n")
@@ -647,7 +616,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Link
-(defun org-e-man-link (link desc info)
+(defun org-man-link (link desc info)
"Transcode a LINK object from Org to Man.
DESC is the description part of the link, or the empty string.
@@ -681,7 +650,7 @@ INFO is a plist holding contextual information. See
;;; Paragraph
-(defun org-e-man-paragraph (paragraph contents info)
+(defun org-man-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to Man.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
@@ -702,7 +671,7 @@ the plist used as a communication channel."
;;; Plain List
-(defun org-e-man-plain-list (plain-list contents info)
+(defun org-man-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to Man.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -710,7 +679,7 @@ contextual information."
;;; Plain Text
-(defun org-e-man-plain-text (text info)
+(defun org-man-plain-text (text info)
"Transcode a TEXT string from Org to Man.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
@@ -740,17 +709,17 @@ contextual information."
;;; Quote Block
-(defun org-e-man-quote-block (quote-block contents info)
+(defun org-man-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to Man.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (org-e-man--wrap-label
+ (org-man--wrap-label
quote-block
(format ".RS\n%s\n.RE" contents)))
;;; Quote Section
-(defun org-e-man-quote-section (quote-section contents info)
+(defun org-man-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
@@ -760,7 +729,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Radio Target
-(defun org-e-man-radio-target (radio-target text info)
+(defun org-man-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to Man.
TEXT is the text of the target. INFO is a plist holding
contextual information."
@@ -769,7 +738,7 @@ contextual information."
;;; Section
-(defun org-e-man-section (section contents info)
+(defun org-man-section (section contents info)
"Transcode a SECTION element from Org to Man.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -778,19 +747,19 @@ holding contextual information."
;;; Special Block
-(defun org-e-man-special-block (special-block contents info)
+(defun org-man-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to Man.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let ((type (downcase (org-element-property :type special-block))))
- (org-e-man--wrap-label
+ (org-man--wrap-label
special-block
(format "%s\n" contents))))
;;; Src Block
-(defun org-e-man-src-block (src-block contents info)
+(defun org-man-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to Man.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -798,17 +767,17 @@ contextual information."
(code (org-element-property :value src-block))
(custom-env (and lang
(cadr (assq (intern lang)
- org-e-man-custom-lang-environments))))
+ org-man-custom-lang-environments))))
(num-start (case (org-element-property :number-lines src-block)
(continued (org-export-get-loc src-block info))
(new 0)))
(retain-labels (org-element-property :retain-labels src-block)))
(cond
;; Case 1. No source fontification.
- ((not org-e-man-source-highlight)
+ ((not org-man-source-highlight)
(format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
(org-export-format-code-default src-block info)))
- (org-e-man-source-highlight
+ (org-man-source-highlight
(let* ((tmpdir (if (featurep 'xemacs)
temp-directory
temporary-file-directory ))
@@ -820,7 +789,7 @@ contextual information."
(org-lang (org-element-property :language src-block))
(lst-lang (cadr (assq (intern org-lang)
- org-e-man-source-highlight-langs)))
+ org-man-source-highlight-langs)))
(cmd (concat "source-highlight"
" -s " lst-lang
@@ -841,7 +810,7 @@ contextual information."
;;; Statistics Cookie
-(defun org-e-man-statistics-cookie (statistics-cookie contents info)
+(defun org-man-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value statistics-cookie))
@@ -849,7 +818,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Strike-Through
-(defun org-e-man-strike-through (strike-through contents info)
+(defun org-man-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to Man.
CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information."
@@ -857,7 +826,7 @@ holding contextual information."
;;; Subscript
-(defun org-e-man-subscript (subscript contents info)
+(defun org-man-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to Man.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -865,7 +834,7 @@ contextual information."
;;; Superscript "^_%s$
-(defun org-e-man-superscript (superscript contents info)
+(defun org-man-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to Man.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -874,22 +843,22 @@ contextual information."
;;; Table
;;
-;; `org-e-man-table' is the entry point for table transcoding. It
+;; `org-man-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" attribute. Otherwise, it
-;; delegates the job to either `org-e-man-table--table.el-table' or
-;; `org-e-man-table--org-table' functions, depending of the type of
+;; delegates the job to either `org-man-table--table.el-table' or
+;; `org-man-table--org-table' functions, depending of the type of
;; the table.
;;
-;; `org-e-man-table--align-string' is a subroutine used to build
+;; `org-man-table--align-string' is a subroutine used to build
;; alignment string for Org tables.
-(defun org-e-man-table (table contents info)
+(defun org-man-table (table contents info)
"Transcode a TABLE element from Org to Man.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
(cond
;; Case 1: verbatim table.
- ((or org-e-man-tables-verbatim
+ ((or org-man-tables-verbatim
(let ((attr (read (format "(%s)"
(mapconcat
#'identity
@@ -904,42 +873,40 @@ contextual information."
(org-element-interpret-data
`(table nil ,@(org-element-contents table))))))
;; Case 2: Standard table.
- (t (org-e-man-table--org-table table contents info))))
+ (t (org-man-table--org-table table contents info))))
-(defun org-e-man-table--align-string (divider table info)
+(defun org-man-table--align-string (divider table info)
"Return an appropriate Man alignment string.
TABLE is the considered table. INFO is a plist used as
a communication channel."
- (let (alignment)
- ;; Extract column groups and alignment from first (non-rule)
- ;; row.
- (org-element-map
- (org-element-map
- table 'table-row
- (lambda (row)
- (and (eq (org-element-property :type row) 'standard) row))
- info 'first-match)
- 'table-cell
- (lambda (cell)
- (let* ((borders (org-export-table-cell-borders cell info))
- (raw-width (org-export-table-cell-width cell info))
- (width-cm (when raw-width (/ raw-width 5)))
- (width (if raw-width (format "w(%dc)"
- (if (< width-cm 1) 1 width-cm)) "")))
- ;; Check left border for the first cell only.
- (when (and (memq 'left borders) (not alignment))
- (push "|" alignment))
- (push
- (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)
- (apply 'concat (reverse alignment))))
-
-(defun org-e-man-table--org-table (table contents info)
+ (let (alignment)
+ ;; Extract column groups and alignment from first (non-rule) row.
+ (org-element-map
+ (org-element-map table 'table-row
+ (lambda (row)
+ (and (eq (org-element-property :type row) 'standard) row))
+ info 'first-match)
+ 'table-cell
+ (lambda (cell)
+ (let* ((borders (org-export-table-cell-borders cell info))
+ (raw-width (org-export-table-cell-width cell info))
+ (width-cm (when raw-width (/ raw-width 5)))
+ (width (if raw-width (format "w(%dc)"
+ (if (< width-cm 1) 1 width-cm)) "")))
+ ;; Check left border for the first cell only.
+ (when (and (memq 'left borders) (not alignment))
+ (push "|" alignment))
+ (push
+ (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)
+ (apply 'concat (reverse alignment))))
+
+(defun org-man-table--org-table (table contents info)
"Return appropriate Man code for an Org table.
TABLE is the table type element to transcode. CONTENTS is its
@@ -950,11 +917,11 @@ This function assumes TABLE has `org' as its `:type' attribute."
(let* ((attr (org-export-read-attribute :attr_man table))
(label (org-element-property :name table))
(caption (and (not (plist-get attr :disable-caption))
- (org-e-man--caption/label-string table info)))
+ (org-man--caption/label-string table info)))
(divider (if (plist-get attr :divider) "|" " "))
;; Determine alignment string.
- (alignment (org-e-man-table--align-string divider table info))
+ (alignment (org-man-table--align-string divider table info))
;; Extract others display options.
(lines (org-split-string contents "\n"))
@@ -969,9 +936,7 @@ This function assumes TABLE has `org' as its `:type' attribute."
(case (plist-get attr :placement)
('center "center")
('left nil)
- (t
- (if org-e-man-tables-centered
- "center" "")))
+ (t (if org-man-tables-centered "center" "")))
(case (plist-get attr :boxtype)
('box "box")
@@ -1053,16 +1018,16 @@ This function assumes TABLE has `org' as its `:type' attribute."
;;; Table Cell
-(defun org-e-man-table-cell (table-cell contents info)
+(defun org-man-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to Man
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
(concat (if (and contents
- org-e-man-table-scientific-notation
+ org-man-table-scientific-notation
(string-match orgtbl-exp-regexp contents))
;; Use appropriate format string for scientific
;; notation.
- (format org-e-man-table-scientific-notation
+ (format org-man-table-scientific-notation
(match-string 1 contents)
(match-string 2 contents))
contents )
@@ -1071,7 +1036,7 @@ a communication channel."
;;; Table Row
-(defun org-e-man-table-row (table-row contents info)
+(defun org-man-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to Man
CONTENTS is the contents of the row. INFO is a plist used as
a communication channel."
@@ -1100,7 +1065,7 @@ a communication channel."
;;; Target
-(defun org-e-man-target (target contents info)
+(defun org-man-target (target contents info)
"Transcode a TARGET object from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1110,7 +1075,7 @@ information."
;;; Timestamp
-(defun org-e-man-timestamp (timestamp contents info)
+(defun org-man-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to Man.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1119,7 +1084,7 @@ information."
;;; Underline
-(defun org-e-man-underline (underline contents info)
+(defun org-man-underline (underline contents info)
"Transcode UNDERLINE from Org to Man.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
@@ -1128,7 +1093,7 @@ holding contextual information."
;;; Verbatim
-(defun org-e-man-verbatim (verbatim contents info)
+(defun org-man-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to Man.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -1137,7 +1102,7 @@ channel."
;;; Verse Block
-(defun org-e-man-verse-block (verse-block contents info)
+(defun org-man-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to Man.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
@@ -1147,7 +1112,7 @@ contextual information."
;;; Interactive functions
-(defun org-e-man-export-to-man
+(defun org-man-export-to-man
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Man file.
@@ -1179,14 +1144,14 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".man" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-man))
+ (lambda (f) (org-export-add-to-stack f 'man))
`(expand-file-name
(org-export-to-file
- 'e-man ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
+ 'man ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
(org-export-to-file
- 'e-man outfile subtreep visible-only body-only ext-plist))))
+ 'man outfile subtreep visible-only body-only ext-plist))))
-(defun org-e-man-export-to-pdf
+(defun org-man-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Groff then process through to PDF.
@@ -1218,20 +1183,20 @@ Return PDF file's name."
(if async
(let ((outfile (org-export-output-file-name ".man" subtreep)))
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-man))
+ (lambda (f) (org-export-add-to-stack f 'man))
`(expand-file-name
- (org-e-man-compile
+ (org-man-compile
(org-export-to-file
- 'e-man ,outfile ,subtreep ,visible-only ,body-only
+ 'man ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
- (org-e-man-compile
- (org-e-man-export-to-man nil subtreep visible-only body-only ext-plist))))
+ (org-man-compile
+ (org-man-export-to-man nil subtreep visible-only body-only ext-plist))))
-(defun org-e-man-compile (file)
+(defun org-man-compile (file)
"Compile a Groff file.
FILE is the name of the file being compiled. Processing is done
-through the command specified in `org-e-man-pdf-process'.
+through the command specified in `org-man-pdf-process'.
Return PDF file name or an error if it couldn't be produced."
(let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
@@ -1245,12 +1210,12 @@ Return PDF file name or an error if it couldn't be produced."
(save-window-excursion
(cond
;; A function is provided: Apply it.
- ((functionp org-e-man-pdf-process)
- (funcall org-e-man-pdf-process (shell-quote-argument file)))
+ ((functionp org-man-pdf-process)
+ (funcall org-man-pdf-process (shell-quote-argument file)))
;; 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.
- ((consp org-e-man-pdf-process)
+ ((consp org-man-pdf-process)
(let ((outbuf (get-buffer-create "*Org PDF Groff Output*")))
(mapc
(lambda (command)
@@ -1262,9 +1227,9 @@ Return PDF file name or an error if it couldn't be produced."
(replace-regexp-in-string
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
outbuf))
- org-e-man-pdf-process)
+ org-man-pdf-process)
;; Collect standard errors from output buffer.
- (setq errors (org-e-man-collect-errors outbuf))))
+ (setq errors (org-man-collect-errors outbuf))))
(t (error "No valid command to process to PDF")))
(let ((pdffile (concat out-dir base-name ".pdf")))
;; Check for process failure. Provide collected errors if
@@ -1274,8 +1239,8 @@ Return PDF file name or an error if it couldn't be produced."
(when errors (concat ": " errors))))
;; Else remove log files, when specified, and signal end of
;; process to user, along with any error encountered.
- (when org-e-man-remove-logfiles
- (dolist (ext org-e-man-logfiles-extensions)
+ (when org-man-remove-logfiles
+ (dolist (ext org-man-logfiles-extensions)
(let ((file (concat out-dir base-name "." ext)))
(when (file-exists-p file) (delete-file file)))))
(message (concat "Process completed"
@@ -1284,7 +1249,7 @@ Return PDF file name or an error if it couldn't be produced."
;; Return output file name.
pdffile))))
-(defun org-e-man-collect-errors (buffer)
+(defun org-man-collect-errors (buffer)
"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
@@ -1296,5 +1261,10 @@ none."
nil )))
-(provide 'org-e-man)
-;;; org-e-man.el ends here
+(provide 'ox-man)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-man.el ends here
diff --git a/contrib/lisp/org-md.el b/lisp/ox-md.el
index 770cbfc..24ca0a1 100644
--- a/contrib/lisp/org-md.el
+++ b/lisp/ox-md.el
@@ -1,4 +1,4 @@
-;;; org-md.el --- Markdown Back-End for Org Export Engine
+;;; ox-md.el --- Markdown Back-End for Org Export Engine
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
@@ -21,7 +21,7 @@
;;; Commentary:
;; This library implements a Markdown back-end (vanilla flavour) for
-;; Org exporter, based on `e-html'.
+;; Org exporter, based on `html' back-end.
;;
;; It provides two commands for export, depending on the desired
;; output: `org-md-export-as-markdown' (temporary buffer) and
@@ -29,7 +29,7 @@
;;; Code:
-(require 'org-e-html)
+(require 'ox-html)
@@ -53,7 +53,7 @@ This variable can be set to either `atx' or `setext'."
;;; Define Back-End
-(org-export-define-derived-backend md e-html
+(org-export-define-derived-backend md html
:export-block ("MD" "MARKDOWN")
:filters-alist ((:filter-parse-tree . org-md-separate-elements))
:menu-entry
@@ -99,14 +99,13 @@ TREE is the parse tree being exported. BACKEND is the export
back-end used. INFO is a plist used as a communication channel.
Assume BACKEND is `md'."
- (org-element-map
- tree org-element-all-elements
- (lambda (elem)
- (unless (eq (org-element-type elem) 'org-data)
- (org-element-put-property
- elem :post-blank
- (let ((post-blank (org-element-property :post-blank elem)))
- (if (not post-blank) 1 (max 1 post-blank)))))))
+ (org-element-map tree org-element-all-elements
+ (lambda (elem)
+ (unless (eq (org-element-type elem) 'org-data)
+ (org-element-put-property
+ elem :post-blank
+ (let ((post-blank (org-element-property :post-blank elem)))
+ (if (not post-blank) 1 (max 1 post-blank)))))))
;; Return updated tree.
tree)
@@ -264,9 +263,9 @@ a communication channel."
(function
(lambda (raw-path info)
;; Treat links to `file.org' as links to `file.html', if
- ;; needed. See `org-e-html-link-org-files-as-html'.
+ ;; needed. See `org-html-link-org-files-as-html'.
(cond
- ((and org-e-html-link-org-files-as-html
+ ((and org-html-link-org-files-as-html
(string= ".org"
(downcase (file-name-extension raw-path "."))))
(concat (file-name-sans-extension raw-path) "."
@@ -288,7 +287,7 @@ a communication channel."
(org-export-get-headline-number
destination info)
".")))))))
- ((org-export-inline-image-p link org-e-html-inline-image-rules)
+ ((org-export-inline-image-p link org-html-inline-image-rules)
(let ((path (let ((raw-path (org-element-property :path link)))
(if (not (file-name-absolute-p raw-path)) raw-path
(expand-file-name raw-path)))))
@@ -373,7 +372,7 @@ contextual information."
(setq text (replace-regexp-in-string "[`*_\\]" "\\\\\\&" text))
;; Handle special strings, if required.
(when (plist-get info :with-special-strings)
- (setq text (org-e-html-convert-special-strings text)))
+ (setq text (org-html-convert-special-strings text)))
;; Handle break preservation, if required.
(when (plist-get info :preserve-breaks)
(setq text (replace-regexp-in-string "[ \t]*\n" " \n" text)))
@@ -485,5 +484,10 @@ Return output file's name."
(org-export-to-file 'md outfile subtreep visible-only))))
-(provide 'org-md)
-;;; org-md.el ends here
+(provide 'ox-md)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-md.el ends here
diff --git a/contrib/lisp/org-e-odt.el b/lisp/ox-odt.el
index c023113..5162520 100644
--- a/contrib/lisp/org-e-odt.el
+++ b/lisp/ox-odt.el
@@ -1,4 +1,4 @@
-;;; org-e-odt.el --- OpenDocument Text exporter for Org-mode
+;;; ox-odt.el --- OpenDocument Text Exporter for Org Mode
;; Copyright (C) 2010-2013 Free Software Foundation, Inc.
@@ -29,75 +29,76 @@
(require 'cl)
(require 'table))
(require 'format-spec)
-(require 'org-export)
+(require 'ox)
(require 'org-compat)
;;; Define Back-End
-(org-export-define-backend e-odt
- ((bold . org-e-odt-bold)
- (center-block . org-e-odt-center-block)
- (clock . org-e-odt-clock)
- (code . org-e-odt-code)
- (drawer . org-e-odt-drawer)
- (dynamic-block . org-e-odt-dynamic-block)
- (entity . org-e-odt-entity)
- (example-block . org-e-odt-example-block)
- (export-block . org-e-odt-export-block)
- (export-snippet . org-e-odt-export-snippet)
- (fixed-width . org-e-odt-fixed-width)
- (footnote-definition . org-e-odt-footnote-definition)
- (footnote-reference . org-e-odt-footnote-reference)
- (headline . org-e-odt-headline)
- (horizontal-rule . org-e-odt-horizontal-rule)
- (inline-src-block . org-e-odt-inline-src-block)
- (inlinetask . org-e-odt-inlinetask)
- (italic . org-e-odt-italic)
- (item . org-e-odt-item)
- (keyword . org-e-odt-keyword)
- (latex-environment . org-e-odt-latex-environment)
- (latex-fragment . org-e-odt-latex-fragment)
- (line-break . org-e-odt-line-break)
- (link . org-e-odt-link)
- (paragraph . org-e-odt-paragraph)
- (plain-list . org-e-odt-plain-list)
- (plain-text . org-e-odt-plain-text)
- (planning . org-e-odt-planning)
- (property-drawer . org-e-odt-property-drawer)
- (quote-block . org-e-odt-quote-block)
- (quote-section . org-e-odt-quote-section)
- (radio-target . org-e-odt-radio-target)
- (section . org-e-odt-section)
- (special-block . org-e-odt-special-block)
- (src-block . org-e-odt-src-block)
- (statistics-cookie . org-e-odt-statistics-cookie)
- (strike-through . org-e-odt-strike-through)
- (subscript . org-e-odt-subscript)
- (superscript . org-e-odt-superscript)
- (table . org-e-odt-table)
- (table-cell . org-e-odt-table-cell)
- (table-row . org-e-odt-table-row)
- (target . org-e-odt-target)
- (template . org-e-odt-template)
- (timestamp . org-e-odt-timestamp)
- (underline . org-e-odt-underline)
- (verbatim . org-e-odt-verbatim)
- (verse-block . org-e-odt-verse-block))
+(org-export-define-backend odt
+ ((bold . org-odt-bold)
+ (center-block . org-odt-center-block)
+ (clock . org-odt-clock)
+ (code . org-odt-code)
+ (drawer . org-odt-drawer)
+ (dynamic-block . org-odt-dynamic-block)
+ (entity . org-odt-entity)
+ (example-block . org-odt-example-block)
+ (export-block . org-odt-export-block)
+ (export-snippet . org-odt-export-snippet)
+ (fixed-width . org-odt-fixed-width)
+ (footnote-definition . org-odt-footnote-definition)
+ (footnote-reference . org-odt-footnote-reference)
+ (headline . org-odt-headline)
+ (horizontal-rule . org-odt-horizontal-rule)
+ (inline-src-block . org-odt-inline-src-block)
+ (inlinetask . org-odt-inlinetask)
+ (italic . org-odt-italic)
+ (item . org-odt-item)
+ (keyword . org-odt-keyword)
+ (latex-environment . org-odt-latex-environment)
+ (latex-fragment . org-odt-latex-fragment)
+ (line-break . org-odt-line-break)
+ (link . org-odt-link)
+ (paragraph . org-odt-paragraph)
+ (plain-list . org-odt-plain-list)
+ (plain-text . org-odt-plain-text)
+ (planning . org-odt-planning)
+ (property-drawer . org-odt-property-drawer)
+ (quote-block . org-odt-quote-block)
+ (quote-section . org-odt-quote-section)
+ (radio-target . org-odt-radio-target)
+ (section . org-odt-section)
+ (special-block . org-odt-special-block)
+ (src-block . org-odt-src-block)
+ (statistics-cookie . org-odt-statistics-cookie)
+ (strike-through . org-odt-strike-through)
+ (subscript . org-odt-subscript)
+ (superscript . org-odt-superscript)
+ (table . org-odt-table)
+ (table-cell . org-odt-table-cell)
+ (table-row . org-odt-table-row)
+ (target . org-odt-target)
+ (template . org-odt-template)
+ (timestamp . org-odt-timestamp)
+ (underline . org-odt-underline)
+ (verbatim . org-odt-verbatim)
+ (verse-block . org-odt-verse-block))
:export-block "ODT"
:filters-alist ((:filter-parse-tree
- . (org-e-odt--translate-latex-fragments
- org-e-odt--translate-description-lists
- org-e-odt--translate-list-tables)))
+ . (org-odt--translate-latex-fragments
+ org-odt--translate-description-lists
+ org-odt--translate-list-tables)))
:menu-entry
(?o "Export to ODT"
- ((?o "As ODT file" org-e-odt-export-to-odt)
+ ((?o "As ODT file" org-odt-export-to-odt)
(?O "As ODT file and open"
(lambda (a s v b)
- (if a (org-e-odt-export-to-odt t s v)
- (org-open-file (org-e-odt-export-to-odt nil s v) 'system))))))
+ (if a (org-odt-export-to-odt t s v)
+ (org-open-file (org-odt-export-to-odt nil s v) 'system))))))
:options-alist
((:odt-styles-file "ODT_STYLES_FILE" nil nil t)
- (:LaTeX-fragments nil "LaTeX" org-export-with-LaTeX-fragments)))
+ ;; Redefine regular option.
+ (:with-latex nil "tex" org-odt-with-latex)))
;;; Dependencies
@@ -117,95 +118,95 @@
;;; Internal Variables
-(defconst org-e-odt-lib-dir
+(defconst org-odt-lib-dir
(file-name-directory load-file-name)
"Location of ODT exporter.
-Use this to infer values of `org-e-odt-styles-dir' and
-`org-e-odt-schema-dir'.")
+Use this to infer values of `org-odt-styles-dir' and
+`org-odt-schema-dir'.")
-(defvar org-e-odt-data-dir
- (expand-file-name "../../etc/" org-e-odt-lib-dir)
+(defvar org-odt-data-dir
+ (expand-file-name "../../etc/" org-odt-lib-dir)
"Data directory for ODT exporter.
-Use this to infer values of `org-e-odt-styles-dir' and
-`org-e-odt-schema-dir'.")
+Use this to infer values of `org-odt-styles-dir' and
+`org-odt-schema-dir'.")
-(defconst org-e-odt-special-string-regexps
+(defconst org-odt-special-string-regexps
'(("\\\\-" . "&#x00ad;\\1") ; shy
("---\\([^-]\\)" . "&#x2014;\\1") ; mdash
("--\\([^-]\\)" . "&#x2013;\\1") ; ndash
("\\.\\.\\." . "&#x2026;")) ; hellip
"Regular expressions for special string conversion.")
-(defconst org-e-odt-schema-dir-list
+(defconst org-odt-schema-dir-list
(list
- (and org-e-odt-data-dir
- (expand-file-name "./schema/" org-e-odt-data-dir)) ; bail out
+ (and org-odt-data-dir
+ (expand-file-name "./schema/" org-odt-data-dir)) ; bail out
(eval-when-compile
- (and (boundp 'org-e-odt-data-dir) org-e-odt-data-dir ; see make install
- (expand-file-name "./schema/" org-e-odt-data-dir))))
+ (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install
+ (expand-file-name "./schema/" org-odt-data-dir))))
"List of directories to search for OpenDocument schema files.
Use this list to set the default value of
-`org-e-odt-schema-dir'. The entries in this list are
-populated heuristically based on the values of `org-e-odt-lib-dir'
-and `org-e-odt-data-dir'.")
+`org-odt-schema-dir'. The entries in this list are
+populated heuristically based on the values of `org-odt-lib-dir'
+and `org-odt-data-dir'.")
-(defconst org-e-odt-styles-dir-list
+(defconst org-odt-styles-dir-list
(list
- (and org-e-odt-data-dir
- (expand-file-name "./styles/" org-e-odt-data-dir)) ; bail out
+ (and org-odt-data-dir
+ (expand-file-name "./styles/" org-odt-data-dir)) ; bail out
(eval-when-compile
- (and (boundp 'org-e-odt-data-dir) org-e-odt-data-dir ; see make install
- (expand-file-name "./styles/" org-e-odt-data-dir)))
- (expand-file-name "../../etc/styles/" org-e-odt-lib-dir) ; git
- (expand-file-name "./etc/styles/" org-e-odt-lib-dir) ; elpa
+ (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install
+ (expand-file-name "./styles/" org-odt-data-dir)))
+ (expand-file-name "../../etc/styles/" org-odt-lib-dir) ; git
+ (expand-file-name "./etc/styles/" org-odt-lib-dir) ; elpa
(expand-file-name "./org/" data-directory) ; system
)
"List of directories to search for OpenDocument styles files.
-See `org-e-odt-styles-dir'. The entries in this list are populated
-heuristically based on the values of `org-e-odt-lib-dir' and
-`org-e-odt-data-dir'.")
+See `org-odt-styles-dir'. The entries in this list are populated
+heuristically based on the values of `org-odt-lib-dir' and
+`org-odt-data-dir'.")
-(defconst org-e-odt-styles-dir
+(defconst org-odt-styles-dir
(let* ((styles-dir
(catch 'styles-dir
- (message "Debug (org-e-odt): Searching for OpenDocument styles files...")
+ (message "Debug (ox-odt): Searching for OpenDocument styles files...")
(mapc (lambda (styles-dir)
(when styles-dir
- (message "Debug (org-e-odt): Trying %s..." styles-dir)
+ (message "Debug (ox-odt): Trying %s..." styles-dir)
(when (and (file-readable-p
(expand-file-name
"OrgOdtContentTemplate.xml" styles-dir))
(file-readable-p
(expand-file-name
"OrgOdtStyles.xml" styles-dir)))
- (message "Debug (org-e-odt): Using styles under %s"
+ (message "Debug (ox-odt): Using styles under %s"
styles-dir)
(throw 'styles-dir styles-dir))))
- org-e-odt-styles-dir-list)
+ org-odt-styles-dir-list)
nil)))
(unless styles-dir
- (error "Error (org-e-odt): Cannot find factory styles files, aborting"))
+ (error "Error (ox-odt): Cannot find factory styles files, aborting"))
styles-dir)
"Directory that holds auxiliary XML files used by the ODT exporter.
This directory contains the following XML files -
\"OrgOdtStyles.xml\" and \"OrgOdtContentTemplate.xml\". These
XML files are used as the default values of
- `org-e-odt-styles-file' and
- `org-e-odt-content-template-file'.
+ `org-odt-styles-file' and
+ `org-odt-content-template-file'.
The default value of this variable varies depending on the
version of org in use and is initialized from
-`org-e-odt-styles-dir-list'. Note that the user could be using org
+`org-odt-styles-dir-list'. Note that the user could be using org
from one of: org's own private git repository, GNU ELPA tar or
standard Emacs.")
-(defconst org-e-odt-bookmark-prefix "OrgXref.")
+(defconst org-odt-bookmark-prefix "OrgXref.")
-(defconst org-e-odt-manifest-file-entry-tag
+(defconst org-odt-manifest-file-entry-tag
"\n<manifest:file-entry manifest:media-type=\"%s\" manifest:full-path=\"%s\"%s/>")
-(defconst org-e-odt-file-extensions
+(defconst org-odt-file-extensions
'(("odt" . "OpenDocument Text")
("ott" . "OpenDocument Text Template")
("odm" . "OpenDocument Master Document")
@@ -219,7 +220,7 @@ standard Emacs.")
("odf" . "OpenDocument Formula")
("odc" . "OpenDocument Chart")))
-(defconst org-e-odt-table-style-format
+(defconst org-odt-table-style-format
"
<style:style style:name=\"%s\" style:family=\"table\">
<style:table-properties style:rel-width=\"%d%%\" fo:margin-top=\"0cm\" fo:margin-bottom=\"0.20cm\" table:align=\"center\"/>
@@ -227,7 +228,7 @@ standard Emacs.")
"
"Template for auto-generated Table styles.")
-(defvar org-e-odt-automatic-styles '()
+(defvar org-odt-automatic-styles '()
"Registry of automatic styles for various OBJECT-TYPEs.
The variable has the following form:
\(\(OBJECT-TYPE-A
@@ -240,16 +241,16 @@ The variable has the following form:
OBJECT-TYPEs could be \"Section\", \"Table\", \"Figure\" etc.
OBJECT-PROPS is (typically) a plist created by passing
-\"#+ATTR_ODT: \" option to `org-e-odt-parse-block-attributes'.
+\"#+ATTR_ODT: \" option to `org-odt-parse-block-attributes'.
-Use `org-e-odt-add-automatic-style' to add update this variable.'")
+Use `org-odt-add-automatic-style' to add update this variable.'")
-(defvar org-e-odt-object-counters nil
+(defvar org-odt-object-counters nil
"Running counters for various OBJECT-TYPEs.
Use this to generate automatic names and style-names. See
-`org-e-odt-add-automatic-style'.")
+`org-odt-add-automatic-style'.")
-(defvar org-e-odt-src-block-paragraph-format
+(defvar org-odt-src-block-paragraph-format
"<style:style style:name=\"OrgSrcBlock\" style:family=\"paragraph\" style:parent-style-name=\"Preformatted_20_Text\">
<style:paragraph-properties fo:background-color=\"%s\" fo:padding=\"0.049cm\" fo:border=\"0.51pt solid #000000\" style:shadow=\"none\">
<style:background-image/>
@@ -262,14 +263,14 @@ except that the foreground and background colors are set
according to the default face identified by the `htmlfontify'.")
(defvar hfy-optimisations)
-(defvar org-e-odt-embedded-formulas-count 0)
-(defvar org-e-odt-embedded-images-count 0)
-(defvar org-e-odt-image-size-probe-method
+(defvar org-odt-embedded-formulas-count 0)
+(defvar org-odt-embedded-images-count 0)
+(defvar org-odt-image-size-probe-method
(append (and (executable-find "identify") '(imagemagick)) ; See Bug#10675
'(emacs fixed))
"Ordered list of methods for determining image sizes.")
-(defvar org-e-odt-default-image-sizes-alist
+(defvar org-odt-default-image-sizes-alist
'(("as-char" . (5 . 0.4))
("paragraph" . (5 . 5)))
"Hardcoded image dimensions one for each of the anchor
@@ -278,10 +279,10 @@ according to the default face identified by the `htmlfontify'.")
;; A4 page size is 21.0 by 29.7 cms
;; The default page settings has 2cm margin on each of the sides. So
;; the effective text area is 17.0 by 25.7 cm
-(defvar org-e-odt-max-image-size '(17.0 . 20.0)
+(defvar org-odt-max-image-size '(17.0 . 20.0)
"Limiting dimensions for an embedded image.")
-(defconst org-e-odt-label-styles
+(defconst org-odt-label-styles
'(("math-formula" "%c" "text" "(%n)")
("math-label" "(%n)" "text" "(%n)")
("category-and-value" "%e %n: %c" "category-and-value" "%e %n")
@@ -295,7 +296,7 @@ LABEL-ATTACH-FMT controls how labels and captions are attached to
an entity. It may contain following specifiers - %e, %n and %c.
%e is replaced with the CATEGORY-NAME. %n is replaced with
\"<text:sequence ...> SEQNO </text:sequence>\". %c is replaced
-with CAPTION. See `org-e-odt-format-label-definition'.
+with CAPTION. See `org-odt-format-label-definition'.
LABEL-REF-MODE and LABEL-REF-FMT controls how label references
are generated. The following XML is generated for a label
@@ -304,14 +305,14 @@ text:reference-format=\"LABEL-REF-MODE\" ...> LABEL-REF-FMT
</text:sequence-ref>\". LABEL-REF-FMT may contain following
specifiers - %e and %n. %e is replaced with the CATEGORY-NAME.
%n is replaced with SEQNO. See
-`org-e-odt-format-label-reference'.")
-
-(defvar org-e-odt-category-map-alist
- '(("__Table__" "Table" "value" "Table" org-e-odt--enumerable-p)
- ("__Figure__" "Illustration" "value" "Figure" org-e-odt--enumerable-image-p)
- ("__MathFormula__" "Text" "math-formula" "Equation" org-e-odt--enumerable-formula-p)
- ("__DvipngImage__" "Equation" "value" "Equation" org-e-odt--enumerable-latex-image-p)
- ("__Listing__" "Listing" "value" "Listing" org-e-odt--enumerable-p)
+`org-odt-format-label-reference'.")
+
+(defvar org-odt-category-map-alist
+ '(("__Table__" "Table" "value" "Table" org-odt--enumerable-p)
+ ("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)
+ ("__MathFormula__" "Text" "math-formula" "Equation" org-odt--enumerable-formula-p)
+ ("__DvipngImage__" "Equation" "value" "Equation" org-odt--enumerable-latex-image-p)
+ ("__Listing__" "Listing" "value" "Listing" org-odt--enumerable-p)
;; ("__Table__" "Table" "category-and-value")
;; ("__Figure__" "Figure" "category-and-value")
;; ("__DvipngImage__" "Equation" "category-and-value")
@@ -325,9 +326,9 @@ CATEGORY_HANDLE identifies the captionable entity in question.
OD-VARIABLE is the OpenDocument sequence counter associated with
the entity. These counters are declared within
\"<text:sequence-decls>...</text:sequence-decls>\" block of
-`org-e-odt-content-template-file'.
+`org-odt-content-template-file'.
-LABEL-STYLE is a key into `org-e-odt-label-styles' and specifies
+LABEL-STYLE is a key into `org-odt-label-styles' and specifies
how a given entity should be captioned and referenced.
CATEGORY-NAME is used for qualifying captions on export. You can
@@ -341,19 +342,19 @@ Logo\", by default. If you want the image to be captioned as
`:utf-8'.
ENUMERATOR-PREDICATE is used for assigning a sequence number to
-the entity. See `org-e-odt--enumerate'.")
+the entity. See `org-odt--enumerate'.")
-(defvar org-e-odt-manifest-file-entries nil)
+(defvar org-odt-manifest-file-entries nil)
(defvar hfy-user-sheet-assoc)
-(defvar org-e-odt-zip-dir nil
+(defvar org-odt-zip-dir nil
"Temporary work directory for OpenDocument exporter.")
;;; User Configuration Variables
-(defgroup org-export-e-odt nil
+(defgroup org-export-odt nil
"Options for exporting Org mode files to ODT."
:tag "Org Export ODT"
:group 'org-export)
@@ -361,27 +362,27 @@ the entity. See `org-e-odt--enumerate'.")
;;;; Debugging
-(defcustom org-e-odt-prettify-xml nil
+(defcustom org-odt-prettify-xml nil
"Specify whether or not the xml output should be prettified.
When this option is turned on, `indent-region' is run on all
component xml buffers before they are saved. Turn this off for
regular use. Turn this on if you need to examine the xml
visually."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:type 'boolean)
;;;; Document schema
-(defcustom org-e-odt-schema-dir
+(defcustom org-odt-schema-dir
(let* ((schema-dir
(catch 'schema-dir
- (message "Debug (org-e-odt): Searching for OpenDocument schema files...")
+ (message "Debug (ox-odt): Searching for OpenDocument schema files...")
(mapc
(lambda (schema-dir)
(when schema-dir
- (message "Debug (org-e-odt): Trying %s..." schema-dir)
+ (message "Debug (ox-odt): Trying %s..." schema-dir)
(when (and (file-expand-wildcards
(expand-file-name "od-manifest-schema*.rnc"
schema-dir))
@@ -390,11 +391,11 @@ visually."
schema-dir))
(file-readable-p
(expand-file-name "schemas.xml" schema-dir)))
- (message "Debug (org-e-odt): Using schema files under %s"
+ (message "Debug (ox-odt): Using schema files under %s"
schema-dir)
(throw 'schema-dir schema-dir))))
- org-e-odt-schema-dir-list)
- (message "Debug (org-e-odt): No OpenDocument schema files installed")
+ org-odt-schema-dir-list)
+ (message "Debug (ox-odt): No OpenDocument schema files installed")
nil)))
schema-dir)
"Directory that contains OpenDocument schema files.
@@ -411,17 +412,17 @@ of OpenDocument XML takes place based on the value
The default value of this variable varies depending on the
version of org in use and is initialized from
-`org-e-odt-schema-dir-list'. The OASIS schema files are available
+`org-odt-schema-dir-list'. The OASIS schema files are available
only in the org's private git repository. It is *not* bundled
with GNU ELPA tar or standard Emacs distribution."
:type '(choice
(const :tag "Not set" nil)
(directory :tag "Schema directory"))
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:set
(lambda (var value)
- "Set `org-e-odt-schema-dir'.
+ "Set `org-odt-schema-dir'.
Also add it to `rng-schema-locating-files'."
(let ((schema-dir value))
(set var
@@ -434,30 +435,30 @@ Also add it to `rng-schema-locating-files'."
(expand-file-name "schemas.xml" schema-dir)))
schema-dir
(when value
- (message "Error (org-e-odt): %s has no OpenDocument schema files"
+ (message "Error (ox-odt): %s has no OpenDocument schema files"
value))
nil)))
- (when org-e-odt-schema-dir
+ (when org-odt-schema-dir
(eval-after-load 'rng-loc
'(add-to-list 'rng-schema-locating-files
(expand-file-name "schemas.xml"
- org-e-odt-schema-dir))))))
+ org-odt-schema-dir))))))
;;;; Document styles
-(defcustom org-e-odt-content-template-file nil
+(defcustom org-odt-content-template-file nil
"Template file for \"content.xml\".
The exporter embeds the exported content just before
\"</office:text>\" element.
If unspecified, the file named \"OrgOdtContentTemplate.xml\"
-under `org-e-odt-styles-dir' is used."
+under `org-odt-styles-dir' is used."
:type 'file
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1")
-(defcustom org-e-odt-styles-file nil
+(defcustom org-odt-styles-file nil
"Default styles file for use with ODT export.
Valid values are one of:
1. nil
@@ -467,7 +468,7 @@ Valid values are one of:
...))
In case of option 1, an in-built styles.xml is used. See
-`org-e-odt-styles-dir' for more information.
+`org-odt-styles-dir' for more information.
In case of option 3, the specified file is unzipped and the
styles.xml embedded therein is used.
@@ -488,7 +489,7 @@ a per-file basis. For example,
#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -501,22 +502,22 @@ a per-file basis. For example,
(file :tag " Member" "styles.xml")
(repeat (file :tag "Member"))))))
-(defcustom org-e-odt-display-outline-level 2
+(defcustom org-odt-display-outline-level 2
"Outline levels considered for enumerating captioned entities."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.2"
:type 'integer)
;;;; Document conversion
-(defcustom org-e-odt-convert-processes
+(defcustom org-odt-convert-processes
'(("LibreOffice"
"soffice --headless --convert-to %f%x --outdir %d %i")
("unoconv"
"unoconv -f %f -o %d %i"))
"Specify a list of document converters and their usage.
The converters in this list are offered as choices while
-customizing `org-e-odt-convert-process'.
+customizing `org-odt-convert-process'.
This variable is a list where each element is of the
form (CONVERTER-NAME CONVERTER-CMD). CONVERTER-NAME is the name
@@ -531,8 +532,8 @@ specifiers are interpreted as below:
%O output file name as a URL
%d output dir in full
%D output dir as a URL.
-%x extra options as set in `org-e-odt-convert-capabilities'."
- :group 'org-export-e-odt
+%x extra options as set in `org-odt-convert-capabilities'."
+ :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -541,11 +542,11 @@ specifiers are interpreted as below:
:key-type (string :tag "Converter Name")
:value-type (group (string :tag "Command line")))))
-(defcustom org-e-odt-convert-process "LibreOffice"
+(defcustom org-odt-convert-process "LibreOffice"
"Use this converter to convert from \"odt\" format to other formats.
During customization, the list of converter names are populated
-from `org-e-odt-convert-processes'."
- :group 'org-export-e-odt
+from `org-odt-convert-processes'."
+ :group 'org-export-odt
:version "24.1"
:type '(choice :convert-widget
(lambda (w)
@@ -554,9 +555,9 @@ from `org-e-odt-convert-processes'."
`((const :tag "None" nil)
,@(mapcar (lambda (c)
`(const :tag ,(car c) ,(car c)))
- org-e-odt-convert-processes))))
+ org-odt-convert-processes))))
-(defcustom org-e-odt-convert-capabilities
+(defcustom org-odt-convert-capabilities
'(("Text"
("odt" "ott" "doc" "rtf" "docx")
(("pdf" "pdf") ("odt" "odt") ("rtf" "rtf") ("ott" "ott")
@@ -572,7 +573,7 @@ from `org-e-odt-convert-processes'."
("odp" "otp" "ppt" "pptx")
(("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("otp" "otp") ("ppt" "ppt")
("pptx" "pptx") ("odg" "odg"))))
- "Specify input and output formats of `org-e-odt-convert-process'.
+ "Specify input and output formats of `org-odt-convert-process'.
More correctly, specify the set of input and output formats that
the user is actually interested in.
@@ -583,18 +584,18 @@ alist where each element is of the form (OUTPUT-FMT
OUTPUT-FILE-EXTENSION EXTRA-OPTIONS).
The variable is interpreted as follows:
-`org-e-odt-convert-process' can take any document that is in
+`org-odt-convert-process' can take any document that is in
INPUT-FMT-LIST and produce any document that is in the
OUTPUT-FMT-LIST. A document converted to OUTPUT-FMT will have
OUTPUT-FILE-EXTENSION as the file name extension. OUTPUT-FMT
serves dual purposes:
- It is used for populating completion candidates during
- `org-e-odt-convert' commands.
+ `org-odt-convert' commands.
- It is used as the value of \"%f\" specifier in
- `org-e-odt-convert-process'.
+ `org-odt-convert-process'.
EXTRA-OPTIONS is used as the value of \"%x\" specifier in
-`org-e-odt-convert-process'.
+`org-odt-convert-process'.
DOCUMENT-CLASS is used to group a set of file formats in
INPUT-FMT-LIST in to a single class.
@@ -608,7 +609,7 @@ with that class.
See default setting of this variable for an typical
configuration."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -625,17 +626,17 @@ configuration."
(const :tag "None" nil)
(string :tag "Extra options"))))))))
-(defcustom org-e-odt-preferred-output-format nil
+(defcustom org-odt-preferred-output-format nil
"Automatically post-process to this format after exporting to \"odt\".
-Command `org-e-odt-export-to-odt' exports first to \"odt\" format
-and then uses `org-e-odt-convert-process' to convert the
+Command `org-odt-export-to-odt' exports first to \"odt\" format
+and then uses `org-odt-convert-process' to convert the
resulting document to this format. During customization of this
variable, the list of valid values are populated based on
-`org-e-odt-convert-capabilities'.
+`org-odt-convert-capabilities'.
You can set this option on per-file basis using file local
values. See Info node `(emacs) File Variables'."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:type '(choice :convert-widget
(lambda (w)
@@ -644,14 +645,14 @@ values. See Info node `(emacs) File Variables'."
`((const :tag "None" nil)
,@(mapcar (lambda (c)
`(const :tag ,c ,c))
- (org-e-odt-reachable-formats "odt")))))
+ (org-odt-reachable-formats "odt")))))
;;;###autoload
-(put 'org-e-odt-preferred-output-format 'safe-local-variable 'stringp)
+(put 'org-odt-preferred-output-format 'safe-local-variable 'stringp)
;;;; Drawers
-(defcustom org-e-odt-format-drawer-function nil
+(defcustom org-odt-format-drawer-function nil
"Function called to format a drawer in ODT code.
The function must accept two parameters:
@@ -663,16 +664,16 @@ 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:
-\(defun org-e-odt-format-drawer-default \(name contents\)
+\(defun org-odt-format-drawer-default \(name contents\)
\"Format a drawer element for ODT export.\"
contents\)"
- :group 'org-export-e-odt
+ :group 'org-export-odt
:type 'function)
;;;; Headline
-(defcustom org-e-odt-format-headline-function nil
+(defcustom org-odt-format-headline-function nil
"Function to format headline text.
This function will be called with 5 arguments:
@@ -683,13 +684,13 @@ TEXT the main headline text \(string\).
TAGS the tags string, separated with colons \(string or nil\).
The function result will be used as headline text."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:type 'function)
;;;; Inlinetasks
-(defcustom org-e-odt-format-inlinetask-function nil
+(defcustom org-odt-format-inlinetask-function nil
"Function called to format an inlinetask in ODT code.
The function must accept six parameters:
@@ -701,50 +702,79 @@ The function must accept six parameters:
CONTENTS the contents of the inlinetask, as a string.
The function should return the string to be exported."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:type 'function)
+;;;; LaTeX
+
+(defcustom org-odt-with-latex org-export-with-latex
+ "Non-nil means process LaTeX math snippets.
+
+When set, the exporter will process LaTeX environments and
+fragments.
+
+This option can also be set with the +OPTIONS line,
+e.g. \"tex:mathjax\". Allowed values are:
+
+nil Ignore math snippets.
+`verbatim' Keep everything in verbatim
+`dvipng' Process the LaTeX fragments to images. This will also
+ include processing of non-math environments.
+`imagemagick' Convert the LaTeX fragments to pdf files and use
+ imagemagick to convert pdf files to png files.
+`mathjax' Do MathJax preprocessing and arrange for MathJax.js to
+ be loaded.
+t Synonym for `mathjax'."
+ :group 'org-export-odt
+ :type '(choice
+ (const :tag "Do not process math in any way" nil)
+ (const :tag "Use dvipng to make images" dvipng)
+ (const :tag "Use imagemagick to make images" imagemagick)
+ (const :tag "Use MathJax to display math" mathjax)
+ (const :tag "Leave math verbatim" verbatim)))
+
+
;;;; Links
-(defcustom org-e-odt-inline-formula-rules
+(defcustom org-odt-inline-formula-rules
'(("file" . "\\.\\(mathml\\|mml\\|odf\\)\\'"))
"Rules characterizing formula files that can be inlined into ODT.
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."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
-(defcustom org-e-odt-inline-image-rules
+(defcustom org-odt-inline-image-rules
'(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\)\\'"))
"Rules characterizing image files that can be inlined into ODT.
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."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
-(defcustom org-e-odt-pixels-per-inch display-pixels-per-inch
+(defcustom org-odt-pixels-per-inch display-pixels-per-inch
"Scaling factor for converting images pixels to inches.
Use this for sizing of embedded images. See Info node `(org)
Images in ODT export' for more information."
:type 'float
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1")
;;;; Src Block
-(defcustom org-e-odt-create-custom-styles-for-srcblocks t
+(defcustom org-odt-create-custom-styles-for-srcblocks t
"Whether custom styles for colorized source blocks be automatically created.
When this option is turned on, the exporter creates custom styles
for source blocks based on the advice of `htmlfontify'. Creation
-of custom styles happen as part of `org-e-odt-hfy-face-to-css'.
+of custom styles happen as part of `org-odt-hfy-face-to-css'.
When this option is turned off exporter does not create such
styles.
@@ -754,24 +784,24 @@ based on your current display settings. It is necessary that the
styles.xml already contains needed styles for colorizing to work.
This variable is effective only if
-`org-e-odt-fontify-srcblocks' is turned on."
- :group 'org-export-e-odt
+`org-odt-fontify-srcblocks' is turned on."
+ :group 'org-export-odt
:version "24.1"
:type 'boolean)
-(defcustom org-e-odt-fontify-srcblocks t
+(defcustom org-odt-fontify-srcblocks t
"Specify whether or not source blocks need to be fontified.
Turn this option on if you want to colorize the source code
blocks in the exported file. For colorization to work, you need
to make available an enhanced version of `htmlfontify' library."
:type 'boolean
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1")
;;;; Table
-(defcustom org-e-odt-table-styles
+(defcustom org-odt-table-styles
'(("OrgEquation" "OrgEquation"
((use-first-column-styles . t)
(use-last-column-styles . t)))
@@ -792,7 +822,7 @@ TABLE-STYLE-NAME is the style associated with the table through
TABLE-TEMPLATE-NAME is a set of - upto 9 - automatic
TABLE-CELL-STYLE-NAMEs and PARAGRAPH-STYLE-NAMEs (as defined
below) that is included in
-`org-e-odt-content-template-file'.
+`org-odt-content-template-file'.
TABLE-CELL-STYLE-NAME := TABLE-TEMPLATE-NAME + TABLE-CELL-TYPE +
\"TableCell\"
@@ -817,7 +847,7 @@ ON-OR-OFF := `t' | `nil'
For example, with the following configuration
-\(setq org-e-odt-table-styles
+\(setq org-odt-table-styles
'\(\(\"TableWithHeaderRowsAndColumns\" \"Custom\"
\(\(use-first-row-styles . t\)
\(use-first-column-styles . t\)\)\)
@@ -846,12 +876,12 @@ TABLE-TEMPLATE-NAME TABLE-CELL-OPTIONS) correspond to
\"table:template-name\" and \"table:use-first-row-styles\" etc
attributes of \"<table:table>\" element. Refer ODF-1.2
specification for more information. Also consult the
-implementation filed under `org-e-odt-get-table-cell-styles'.
+implementation filed under `org-odt-get-table-cell-styles'.
The TABLE-STYLE-NAME \"OrgEquation\" is used internally for
formatting of numbered display equations. Do not delete this
style from the list."
- :group 'org-export-e-odt
+ :group 'org-export-odt
:version "24.1"
:type '(choice
(const :tag "None" nil)
@@ -870,7 +900,7 @@ style from the list."
;;;; Timestamps
-(defcustom org-e-odt-use-date-fields nil
+(defcustom org-odt-use-date-fields nil
"Non-nil, if timestamps should be exported as date fields.
When nil, export timestamps as plain text.
@@ -889,14 +919,14 @@ these %-specifiers.
Textutal specifiers like \"%b\", \"%h\", \"%B\", \"%a\", \"%A\"
etc., are displayed by the application in the default language
-and country specified in `org-e-odt-styles-file'. Note that the
+and country specified in `org-odt-styles-file'. Note that the
default styles file uses language \"en\" and country \"GB\". You
can localize the week day and month strings in the exported
document by setting the default language and country either using
the application UI or through a custom styles file.
-See `org-e-odt--build-date-styles' for implementation details."
- :group 'org-export-e-odt
+See `org-odt--build-date-styles' for implementation details."
+ :group 'org-export-odt
:type 'boolean)
@@ -905,7 +935,7 @@ See `org-e-odt--build-date-styles' for implementation details."
;;;; Date
-(defun org-e-odt--format-timestamp (timestamp &optional end iso-date-p)
+(defun org-odt--format-timestamp (timestamp &optional end iso-date-p)
(let* ((format-timestamp
(lambda (timestamp format &optional end utc)
(if timestamp
@@ -956,7 +986,7 @@ See `org-e-odt--build-date-styles' for implementation details."
;;;; Frame
-(defun org-e-odt--frame (text width height style &optional extra
+(defun org-odt--frame (text width height style &optional extra
anchor-type &rest title-and-desc)
(let ((frame-attrs
(concat
@@ -972,15 +1002,15 @@ See `org-e-odt--build-date-styles' for implementation details."
(desc (cadr title-and-desc)))
(concat (when title
(format "<svg:title>%s</svg:title>"
- (org-e-odt--encode-plain-text title t)))
+ (org-odt--encode-plain-text title t)))
(when desc
(format "<svg:desc>%s</svg:desc>"
- (org-e-odt--encode-plain-text desc t)))))))))
+ (org-odt--encode-plain-text desc t)))))))))
;;;; Library wrappers
-(defun org-e-odt--zip-extract (archive members target)
+(defun org-odt--zip-extract (archive members target)
(when (atom members) (setq members (list members)))
(mapc (lambda (member)
(require 'arc-mode)
@@ -1006,8 +1036,8 @@ See `org-e-odt--build-date-styles' for implementation details."
(error "Extraction failed"))))
members))
-(defun org-e-odt--suppress-some-translators (info types)
- ;; See comments in `org-e-odt-format-label' and `org-e-odt-toc'.
+(defun org-odt--suppress-some-translators (info types)
+ ;; See comments in `org-odt-format-label' and `org-odt-toc'.
(org-combine-plists
info (list
;; Override translators.
@@ -1022,7 +1052,7 @@ See `org-e-odt--build-date-styles' for implementation details."
;;;; Target
-(defun org-e-odt--target (text id)
+(defun org-odt--target (text id)
(if (not id) text
(concat
(format "\n<text:bookmark-start text:name=\"OrgXref.%s\"/>" id)
@@ -1031,9 +1061,9 @@ See `org-e-odt--build-date-styles' for implementation details."
;;;; Textbox
-(defun org-e-odt--textbox (text width height style &optional
+(defun org-odt--textbox (text width height style &optional
extra anchor-type)
- (org-e-odt--frame
+ (org-odt--frame
(format "\n<draw:text-box %s>%s\n</draw:text-box>"
(concat (format " fo:min-height=\"%0.2fcm\"" (or height .2))
(and (not width)
@@ -1045,7 +1075,7 @@ See `org-e-odt--build-date-styles' for implementation details."
;;;; Table of Contents
-(defun org-e-odt-begin-toc (index-title depth)
+(defun org-odt-begin-toc (index-title depth)
(concat
(format "
<text:table-of-content text:style-name=\"OrgIndexSection\" text:protected=\"true\" text:name=\"Table of Contents\">
@@ -1075,13 +1105,13 @@ See `org-e-odt--build-date-styles' for implementation details."
</text:index-title>
" index-title)))
-(defun org-e-odt-end-toc ()
+(defun org-odt-end-toc ()
(format "
</text:index-body>
</text:table-of-content>
"))
-(defun* org-e-odt-format-toc-headline
+(defun* org-odt-format-toc-headline
(todo todo-type priority text tags
&key level section-number headline-label &allow-other-keys)
(setq text
@@ -1114,7 +1144,7 @@ See `org-e-odt--build-date-styles' for implementation details."
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
headline-label text))
-(defun org-e-odt-toc (depth info)
+(defun org-odt-toc (depth info)
(assert (wholenump depth))
;; When a headline is marked as a radio target, as in the example below:
;;
@@ -1143,50 +1173,50 @@ See `org-e-odt--build-date-styles' for implementation details."
(plist-get info :translate-alist))))
(when headlines
(concat
- (org-e-odt-begin-toc title depth)
+ (org-odt-begin-toc title depth)
(mapconcat
(lambda (headline)
- (let* ((entry (org-e-odt-format-headline--wrap
+ (let* ((entry (org-odt-format-headline--wrap
headline translations info
- 'org-e-odt-format-toc-headline))
+ 'org-odt-format-toc-headline))
(level (org-export-get-relative-level headline info))
(style (format "Contents_20_%d" level)))
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
style entry)))
headlines "\n")
- (org-e-odt-end-toc)))))
+ (org-odt-end-toc)))))
;;;; Document styles
-(defun org-e-odt-add-automatic-style (object-type &optional object-props)
+(defun org-odt-add-automatic-style (object-type &optional object-props)
"Create an automatic style of type OBJECT-TYPE with param OBJECT-PROPS.
OBJECT-PROPS is (typically) a plist created by passing
\"#+ATTR_ODT: \" option of the object in question to
-`org-e-odt-parse-block-attributes'.
+`org-odt-parse-block-attributes'.
-Use `org-e-odt-object-counters' to generate an automatic
+Use `org-odt-object-counters' to generate an automatic
OBJECT-NAME and STYLE-NAME. If OBJECT-PROPS is non-nil, add a
-new entry in `org-e-odt-automatic-styles'. Return (OBJECT-NAME
+new entry in `org-odt-automatic-styles'. Return (OBJECT-NAME
. STYLE-NAME)."
(assert (stringp object-type))
(let* ((object (intern object-type))
(seqvar object)
- (seqno (1+ (or (plist-get org-e-odt-object-counters seqvar) 0)))
+ (seqno (1+ (or (plist-get org-odt-object-counters seqvar) 0)))
(object-name (format "%s%d" object-type seqno)) style-name)
- (setq org-e-odt-object-counters
- (plist-put org-e-odt-object-counters seqvar seqno))
+ (setq org-odt-object-counters
+ (plist-put org-odt-object-counters seqvar seqno))
(when object-props
(setq style-name (format "Org%s" object-name))
- (setq org-e-odt-automatic-styles
- (plist-put org-e-odt-automatic-styles object
+ (setq org-odt-automatic-styles
+ (plist-put org-odt-automatic-styles object
(append (list (list style-name object-props))
- (plist-get org-e-odt-automatic-styles object)))))
+ (plist-get org-odt-automatic-styles object)))))
(cons object-name style-name)))
;;;; Checkbox
-(defun org-e-odt--checkbox (item)
+(defun org-odt--checkbox (item)
"Return check-box string associated to ITEM."
(let ((checkbox (org-element-property :checkbox item)))
(if (not checkbox) ""
@@ -1198,7 +1228,7 @@ new entry in `org-e-odt-automatic-styles'. Return (OBJECT-NAME
;;; Template
-(defun org-e-odt--build-date-styles (fmt style)
+(defun org-odt--build-date-styles (fmt style)
;; In LibreOffice 3.4.6, there doesn't seem to be a convenient way
;; to modify the date fields. A date could be modified by
;; offsetting in days. That's about it. Also, date and time may
@@ -1270,20 +1300,20 @@ new entry in `org-e-odt-automatic-styles'. Return (OBJECT-NAME
filler-end))
(setq filler (and (not (string= filler ""))
(format "<number:text>%s</number:text>"
- (org-e-odt--encode-plain-text filler))))
+ (org-odt--encode-plain-text filler))))
(setq output (concat output "\n" filler "\n" rpl)))
(setq filler (substring fmt filler-beg))
(unless (string= filler "")
(setq output (concat output
(format "\n<number:text>%s</number:text>"
- (org-e-odt--encode-plain-text filler)))))
+ (org-odt--encode-plain-text filler)))))
(format "\n<number:date-style style:name=\"%s\" %s>%s\n</number:date-style>"
style
(concat " number:automatic-order=\"true\""
" number:format-source=\"fixed\"")
output ))))
-(defun org-e-odt-template (contents info)
+(defun org-odt-template (contents info)
"Return complete document string after ODT conversion.
CONTENTS is the transcoded contents string. RAW-DATA is the
original parsed data. INFO is a plist holding export options."
@@ -1316,7 +1346,7 @@ original parsed data. INFO is a plist holding export options."
(and (not (cdr date))
(eq (org-element-type (car date)) 'timestamp)
(car date)))))
- (let ((iso-date (org-e-odt--format-timestamp date nil 'iso-date)))
+ (let ((iso-date (org-odt--format-timestamp date nil 'iso-date)))
(concat
(format "<dc:date>%s</dc:date>\n" iso-date)
(format "<meta:creation-date>%s</meta:creation-date>\n"
@@ -1330,9 +1360,9 @@ original parsed data. INFO is a plist holding export options."
(format "<dc:title>%s</dc:title>\n" title)
"\n"
" </office:meta>\n" "</office:document-meta>")
- nil (concat org-e-odt-zip-dir "meta.xml"))
+ nil (concat org-odt-zip-dir "meta.xml"))
;; Add meta.xml in to manifest.
- (org-e-odt-create-manifest-file-entry "text/xml" "meta.xml"))
+ (org-odt-create-manifest-file-entry "text/xml" "meta.xml"))
;; Update styles file.
;; Copy styles.xml. Also dump htmlfontify styles, if there is any.
@@ -1342,45 +1372,45 @@ original parsed data. INFO is a plist holding export options."
;; Non-availability of styles.xml is not a critical
;; error. For now, throw an error.
(styles-file (or styles-file
- org-e-odt-styles-file
+ org-odt-styles-file
(expand-file-name "OrgOdtStyles.xml"
- org-e-odt-styles-dir)
- (error "org-e-odt: Missing styles file?"))))
+ org-odt-styles-dir)
+ (error "org-odt: Missing styles file?"))))
(cond
((listp styles-file)
(let ((archive (nth 0 styles-file))
(members (nth 1 styles-file)))
- (org-e-odt--zip-extract archive members org-e-odt-zip-dir)
+ (org-odt--zip-extract archive members org-odt-zip-dir)
(mapc
(lambda (member)
(when (org-file-image-p member)
(let* ((image-type (file-name-extension member))
(media-type (format "image/%s" image-type)))
- (org-e-odt-create-manifest-file-entry media-type member))))
+ (org-odt-create-manifest-file-entry media-type member))))
members)))
((and (stringp styles-file) (file-exists-p styles-file))
(let ((styles-file-type (file-name-extension styles-file)))
(cond
((string= styles-file-type "xml")
- (copy-file styles-file (concat org-e-odt-zip-dir "styles.xml") t))
+ (copy-file styles-file (concat org-odt-zip-dir "styles.xml") t))
((member styles-file-type '("odt" "ott"))
- (org-e-odt--zip-extract styles-file "styles.xml" org-e-odt-zip-dir)))))
+ (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir)))))
(t
(error (format "Invalid specification of styles.xml file: %S"
- org-e-odt-styles-file))))
+ org-odt-styles-file))))
;; create a manifest entry for styles.xml
- (org-e-odt-create-manifest-file-entry "text/xml" "styles.xml")
+ (org-odt-create-manifest-file-entry "text/xml" "styles.xml")
;; FIXME: Who is opening an empty styles.xml before this point?
(with-current-buffer
- (find-file-noselect (concat org-e-odt-zip-dir "styles.xml") t)
+ (find-file-noselect (concat org-odt-zip-dir "styles.xml") t)
(revert-buffer t t)
;; Write custom styles for source blocks
;; Save STYLES used for colorizing of source blocks.
;; Update styles.xml with styles that were collected as part of
- ;; `org-e-odt-hfy-face-to-css' callbacks.
+ ;; `org-odt-hfy-face-to-css' callbacks.
(let ((styles (mapconcat (lambda (style) (format " %s\n" (cddr style)))
hfy-user-sheet-assoc "")))
(when styles
@@ -1428,9 +1458,9 @@ original parsed data. INFO is a plist holding export options."
'("%Y-%M-%d %a" . "%Y-%M-%d %a %H:%M"))))
(with-temp-buffer
(insert-file-contents
- (or org-e-odt-content-template-file
+ (or org-odt-content-template-file
(expand-file-name "OrgOdtContentTemplate.xml"
- org-e-odt-styles-dir)))
+ org-odt-styles-dir)))
;; Write automatic styles.
;; - Position the cursor.
(goto-char (point-min))
@@ -1438,14 +1468,14 @@ original parsed data. INFO is a plist holding export options."
(goto-char (match-beginning 0))
;; - Dump automatic table styles.
(loop for (style-name props) in
- (plist-get org-e-odt-automatic-styles 'Table) do
+ (plist-get org-odt-automatic-styles 'Table) do
(when (setq props (or (plist-get props :rel-width) 96))
- (insert (format org-e-odt-table-style-format style-name props))))
+ (insert (format org-odt-table-style-format style-name props))))
;; - Dump date-styles.
- (when org-e-odt-use-date-fields
- (insert (org-e-odt--build-date-styles (car custom-time-fmts)
+ (when org-odt-use-date-fields
+ (insert (org-odt--build-date-styles (car custom-time-fmts)
"OrgDate1")
- (org-e-odt--build-date-styles (cdr custom-time-fmts)
+ (org-odt--build-date-styles (cdr custom-time-fmts)
"OrgDate2")))
;; Update display level.
;; - Remove existing sequence decls. Also position the cursor.
@@ -1461,8 +1491,8 @@ original parsed data. INFO is a plist holding export options."
(lambda (x)
(format
"<text:sequence-decl text:display-outline-level=\"%d\" text:name=\"%s\"/>"
- org-e-odt-display-outline-level (nth 1 x)))
- org-e-odt-category-map-alist "\n")))
+ org-odt-display-outline-level (nth 1 x)))
+ org-odt-category-map-alist "\n")))
;; Position the cursor to document body.
(goto-char (point-min))
(re-search-forward "</office:text>" nil nil)
@@ -1517,8 +1547,8 @@ original parsed data. INFO is a plist holding export options."
(concat
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"OrgSubtitle"
- (if (and org-e-odt-use-date-fields timestamp)
- (org-e-odt--format-timestamp (car date))
+ (if (and org-odt-use-date-fields timestamp)
+ (org-odt--format-timestamp (car date))
(org-export-data (plist-get info :date) info)))
;; Separator
"<text:p text:style-name=\"OrgSubtitle\"/>"))))))
@@ -1527,7 +1557,7 @@ original parsed data. INFO is a plist holding export options."
(depth (and with-toc (if (wholenump with-toc)
with-toc
(plist-get info :headline-levels)))))
- (when depth (insert (or (org-e-odt-toc depth info) ""))))
+ (when depth (insert (or (org-odt-toc depth info) ""))))
;; Contents.
(insert contents)
;; Return contents.
@@ -1539,7 +1569,7 @@ original parsed data. INFO is a plist holding export options."
;;;; Bold
-(defun org-e-odt-bold (bold contents info)
+(defun org-odt-bold (bold contents info)
"Transcode BOLD from Org to ODT.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
@@ -1549,7 +1579,7 @@ contextual information."
;;;; Center Block
-(defun org-e-odt-center-block (center-block contents info)
+(defun org-odt-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to ODT.
CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
@@ -1558,7 +1588,7 @@ holding contextual information."
;;;; Clock
-(defun org-e-odt-clock (clock contents info)
+(defun org-odt-clock (clock contents info)
"Transcode a CLOCK element from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -1570,13 +1600,13 @@ channel."
(concat
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgClockKeyword" org-clock-string)
- (org-e-odt-timestamp timestamp contents info)
+ (org-odt-timestamp timestamp contents info)
(and duration (format " (%s)" duration))))))
;;;; Code
-(defun org-e-odt-code (code contents info)
+(defun org-odt-code (code contents info)
"Transcode a CODE object from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -1596,13 +1626,13 @@ channel."
;;;; Drawer
-(defun org-e-odt-drawer (drawer contents info)
+(defun org-odt-drawer (drawer contents info)
"Transcode a DRAWER element from Org to ODT.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let* ((name (org-element-property :drawer-name drawer))
- (output (if (functionp org-e-odt-format-drawer-function)
- (funcall org-e-odt-format-drawer-function
+ (output (if (functionp org-odt-format-drawer-function)
+ (funcall org-odt-format-drawer-function
name contents)
;; If there's no user defined function: simply
;; display contents of the drawer.
@@ -1612,7 +1642,7 @@ holding contextual information."
;;;; Dynamic Block
-(defun org-e-odt-dynamic-block (dynamic-block contents info)
+(defun org-odt-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to ODT.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
@@ -1621,7 +1651,7 @@ holding contextual information. See `org-export-data'."
;;;; Entity
-(defun org-e-odt-entity (entity contents info)
+(defun org-odt-entity (entity contents info)
"Transcode an ENTITY object from Org to ODT.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -1630,24 +1660,24 @@ contextual information."
;;;; Example Block
-(defun org-e-odt-example-block (example-block contents info)
+(defun org-odt-example-block (example-block contents info)
"Transcode a EXAMPLE-BLOCK element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-odt-format-code example-block info))
+ (org-odt-format-code example-block info))
;;;; Export Snippet
-(defun org-e-odt-export-snippet (export-snippet contents info)
+(defun org-odt-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-odt)
+ (when (eq (org-export-snippet-backend export-snippet) 'odt)
(org-element-property :value export-snippet)))
;;;; Export Block
-(defun org-e-odt-export-block (export-block contents info)
+(defun org-odt-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "ODT")
@@ -1656,10 +1686,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Fixed Width
-(defun org-e-odt-fixed-width (fixed-width contents info)
+(defun org-odt-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
- (org-e-odt-do-format-code (org-element-property :value fixed-width)))
+ (org-odt-do-format-code (org-element-property :value fixed-width)))
;;;; Footnote Definition
@@ -1669,7 +1699,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Footnote Reference
-(defun org-e-odt-footnote-reference (footnote-reference contents info)
+(defun org-odt-footnote-reference (footnote-reference contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((--format-footnote-definition
@@ -1722,7 +1752,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Headline
-(defun* org-e-odt-format-headline
+(defun* org-odt-format-headline
(todo todo-type priority text tags
&key level section-number headline-label &allow-other-keys)
(concat
@@ -1749,7 +1779,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"<text:span text:style-name=\"%s\">%s</text:span>"
"OrgTag" tag)) tags " : "))))))
-(defun org-e-odt-format-headline--wrap (headline translations info
+(defun org-odt-format-headline--wrap (headline translations info
&optional format-function
&rest extra-keys)
"Transcode an HEADLINE element from Org to ODT.
@@ -1776,19 +1806,19 @@ holding contextual information."
headline-number "-")))
(format-function (cond
((functionp format-function) format-function)
- ((functionp org-e-odt-format-headline-function)
+ ((functionp org-odt-format-headline-function)
(function*
(lambda (todo todo-type priority text tags
&allow-other-keys)
- (funcall org-e-odt-format-headline-function
+ (funcall org-odt-format-headline-function
todo todo-type priority text tags))))
- (t 'org-e-odt-format-headline))))
+ (t 'org-odt-format-headline))))
(apply format-function
- todo todo-type priority text tags
- :headline-label headline-label :level level
- :section-number section-number extra-keys)))
+ todo todo-type priority text tags
+ :headline-label headline-label :level level
+ :section-number section-number extra-keys)))
-(defun org-e-odt-headline (headline contents info)
+(defun org-odt-headline (headline contents info)
"Transcode an HEADLINE element from Org to ODT.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
@@ -1796,7 +1826,7 @@ holding contextual information."
(unless (org-element-property :footnote-section-p headline)
(let* ((text (org-export-data (org-element-property :title headline) info))
;; Create the headline text.
- (full-text (org-e-odt-format-headline--wrap headline nil info))
+ (full-text (org-odt-format-headline--wrap headline nil info))
;; Get level relative to current parsed data.
(level (org-export-get-relative-level headline info))
;; Get canonical label for the headline.
@@ -1811,11 +1841,11 @@ holding contextual information."
(mapconcat (lambda (x)
(when x
(let ((x (if (org-uuidgen-p x) (concat "ID-" x) x)))
- (org-e-odt--target
+ (org-odt--target
"" (org-export-solidify-link-text x)))))
extra-ids ""))
;; Title.
- (anchored-title (org-e-odt--target full-text id)))
+ (anchored-title (org-odt--target full-text id)))
(cond
;; Case 2. This is a deep sub-tree: export it as a list item.
;; Also export as items headlines for which no section
@@ -1863,7 +1893,7 @@ holding contextual information."
;;;; Horizontal Rule
-(defun org-e-odt-horizontal-rule (horizontal-rule contents info)
+(defun org-odt-horizontal-rule (horizontal-rule contents info)
"Transcode an HORIZONTAL-RULE object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
@@ -1877,7 +1907,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Inline Src Block
-(defun org-e-odt--find-verb-separator (s)
+(defun org-odt--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
(let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
@@ -1885,49 +1915,49 @@ This is used to choose a separator for constructs like \\verb."
when (not (string-match (regexp-quote (char-to-string c)) s))
return (char-to-string c))))
-(defun org-e-odt-inline-src-block (inline-src-block contents info)
+(defun org-odt-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to ODT.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((org-lang (org-element-property :language inline-src-block))
(code (org-element-property :value inline-src-block))
- (separator (org-e-odt--find-verb-separator code)))
+ (separator (org-odt--find-verb-separator code)))
(error "FIXME")))
;;;; Inlinetask
-(defun org-e-odt-inlinetask (inlinetask contents info)
+(defun org-odt-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to ODT.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(cond
- ;; If `org-e-odt-format-inlinetask-function' is provided, call it
+ ;; If `org-odt-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- ((functionp org-e-odt-format-inlinetask-function)
+ ((functionp org-odt-format-inlinetask-function)
(let ((format-function
(function*
(lambda (todo todo-type priority text tags
&key contents &allow-other-keys)
- (funcall org-e-odt-format-inlinetask-function
+ (funcall org-odt-format-inlinetask-function
todo todo-type priority text tags contents)))))
- (org-e-odt-format-headline--wrap
+ (org-odt-format-headline--wrap
inlinetask nil info format-function :contents contents)))
;; Otherwise, use a default template.
(t
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Text_20_body"
- (org-e-odt--textbox
+ (org-odt--textbox
(concat
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"OrgInlineTaskHeading"
- (org-e-odt-format-headline--wrap inlinetask nil info))
+ (org-odt-format-headline--wrap inlinetask nil info))
contents)
nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\"")))))
;;;; Italic
-(defun org-e-odt-italic (italic contents info)
+(defun org-odt-italic (italic contents info)
"Transcode ITALIC from Org to ODT.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
@@ -1937,7 +1967,7 @@ contextual information."
;;;; Item
-(defun org-e-odt-item (item contents info)
+(defun org-odt-item (item contents info)
"Transcode an ITEM element from Org to ODT.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1946,7 +1976,7 @@ contextual information."
(counter (org-element-property :counter item))
(tag (let ((tag (org-element-property :tag item)))
(and tag
- (concat (org-e-odt--checkbox item)
+ (concat (org-odt--checkbox item)
(org-export-data tag info))))))
(case type
((ordered unordered descriptive-1 descriptive-2)
@@ -1965,7 +1995,7 @@ contextual information."
;;;; Keyword
-(defun org-e-odt-keyword (keyword contents info)
+(defun org-odt-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword))
@@ -1983,7 +2013,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((depth (or (and (string-match "[0-9]+" value)
(string-to-number (match-string 0 value)))
(plist-get info :with-toc))))
- (when (wholenump depth) (org-e-odt-toc depth info))))
+ (when (wholenump depth) (org-odt-toc depth info))))
((member value '("tables" "figures" "listings"))
;; FIXME
(ignore))))))))
@@ -1992,25 +2022,20 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Latex Environment
-(eval-after-load 'org-odt
- '(ad-deactivate 'org-format-latex-as-mathml))
-
+;; (eval-after-load 'ox-odt '(ad-deactivate 'org-format-latex-as-mathml))
;; (defadvice org-format-latex-as-mathml ; FIXME
-;; (after org-e-odt-protect-latex-fragment activate)
+;; (after org-odt-protect-latex-fragment activate)
;; "Encode LaTeX fragment as XML.
;; Do this when translation to MathML fails."
-;; (when (or (not (> (length ad-return-value) 0))
-;; (get-text-property 0 'org-protected ad-return-value))
-;; (setq ad-return-value
-;; (org-propertize (org-e-odt--encode-plain-text (ad-get-arg 0))
-;; 'org-protected t))))
+;; (unless (> (length ad-return-value) 0)
+;; (setq ad-return-value (org-odt--encode-plain-text (ad-get-arg 0)))))
-(defun org-e-odt-latex-environment (latex-environment contents info)
+(defun org-odt-latex-environment (latex-environment contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let* ((latex-frag (org-remove-indentation
(org-element-property :value latex-environment))))
- (org-e-odt-do-format-code latex-frag)))
+ (org-odt-do-format-code latex-frag)))
;;;; Latex Fragment
@@ -2021,18 +2046,18 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; handle verbatim
;; provide descriptions
-(defun org-e-odt-latex-fragment (latex-fragment contents info)
+(defun org-odt-latex-fragment (latex-fragment contents info)
"Transcode a LATEX-FRAGMENT object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let* ((latex-frag (org-element-property :value latex-fragment))
- (processing-type (plist-get info :LaTeX-fragments)))
+ (processing-type (plist-get info :with-latex)))
(format "<text:span text:style-name=\"%s\">%s</text:span>"
- "OrgCode" (org-e-odt--encode-plain-text latex-frag t))))
+ "OrgCode" (org-odt--encode-plain-text latex-frag t))))
;;;; Line Break
-(defun org-e-odt-line-break (line-break contents info)
+(defun org-odt-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
"<text:line-break/>\n")
@@ -2042,31 +2067,30 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Links :: Label references
-(defun org-e-odt--enumerate (element info &optional predicate n)
+(defun org-odt--enumerate (element info &optional predicate n)
(when predicate (assert (funcall predicate element info)))
(let* ((--numbered-parent-headline-at-<=-n
(function
(lambda (element n info)
(loop for x in (org-export-get-genealogy element)
thereis (and (eq (org-element-type x) 'headline)
- (<= (org-export-get-relative-level x info) n)
- (org-export-numbered-headline-p x info)
- x)))))
+ (<= (org-export-get-relative-level x info) n)
+ (org-export-numbered-headline-p x info)
+ x)))))
(--enumerate
(function
(lambda (element scope info &optional predicate)
(let ((counter 0))
- (org-element-map
- (or scope (plist-get info :parse-tree))
- (org-element-type element)
- (lambda (el)
- (and (or (not predicate) (funcall predicate el info))
- (incf counter)
- (eq element el)
- counter))
- info 'first-match)))))
+ (org-element-map (or scope (plist-get info :parse-tree))
+ (org-element-type element)
+ (lambda (el)
+ (and (or (not predicate) (funcall predicate el info))
+ (incf counter)
+ (eq element el)
+ counter))
+ info 'first-match)))))
(scope (funcall --numbered-parent-headline-at-<=-n
- element (or n org-e-odt-display-outline-level) info))
+ element (or n org-odt-display-outline-level) info))
(ordinal (funcall --enumerate element scope info predicate))
(tag
(concat
@@ -2080,7 +2104,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(number-to-string ordinal))))
tag))
-(defun org-e-odt-format-label (element info op)
+(defun org-odt-format-label (element info op)
(assert (memq (org-element-type element) '(link table src-block paragraph)))
(let* ((caption-from
(case (org-element-type element)
@@ -2098,7 +2122,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;
;; - Table Of Contents: Currently, there is no support for
;; building TOC for figures, listings and tables. See
- ;; `org-e-odt-keyword'. User instead has to rely on
+ ;; `org-odt-keyword'. User instead has to rely on
;; external application for building such indices. Within
;; LibreOffice, building an "Illustration Index" or "Index
;; of Tables" will create a table with long captions (only)
@@ -2136,11 +2160,11 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(src-block "__Listing__")
((link paragraph)
(cond
- ((org-e-odt--enumerable-latex-image-p element info)
+ ((org-odt--enumerable-latex-image-p element info)
"__DvipngImage__")
- ((org-e-odt--enumerable-image-p element info)
+ ((org-odt--enumerable-image-p element info)
"__Figure__")
- ((org-e-odt--enumerable-formula-p element info)
+ ((org-odt--enumerable-formula-p element info)
"__MathFormula__")
(t (error "Don't know how to format label for link: %S"
element))))
@@ -2149,9 +2173,9 @@ CONTENTS is nil. INFO is a plist holding contextual information."
seqno)
(assert default-category)
(destructuring-bind (counter label-style category predicate)
- (assoc-default default-category org-e-odt-category-map-alist)
+ (assoc-default default-category org-odt-category-map-alist)
;; Compute sequence number of the element.
- (setq seqno (org-e-odt--enumerate element info predicate))
+ (setq seqno (org-odt--enumerate element info predicate))
;; Localize category string.
(setq category (org-export-translate category :utf-8 info))
(case op
@@ -2169,7 +2193,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; Label definition: Typically formatted as below:
;; CATEGORY SEQ-NO: LONG CAPTION
(format-spec
- (cadr (assoc-string label-style org-e-odt-label-styles t))
+ (cadr (assoc-string label-style org-odt-label-styles t))
`((?e . ,category)
(?n . ,(format
"<text:sequence text:ref-name=\"%s\" text:name=\"%s\" text:formula=\"ooow:%s+1\" style:num-format=\"1\">%s</text:sequence>"
@@ -2180,7 +2204,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(reference
(assert label)
(setq label (org-export-solidify-link-text label))
- (let* ((fmt (cddr (assoc-string label-style org-e-odt-label-styles t)))
+ (let* ((fmt (cddr (assoc-string label-style org-odt-label-styles t)))
(fmt1 (car fmt))
(fmt2 (cadr fmt)))
(format "<text:sequence-ref text:reference-format=\"%s\" text:ref-name=\"%s\">%s</text:sequence-ref>"
@@ -2191,26 +2215,26 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Links :: Inline Images
-(defun org-e-odt--copy-image-file (path)
+(defun org-odt--copy-image-file (path)
"Returns the internal name of the file"
(let* ((image-type (file-name-extension path))
(media-type (format "image/%s" image-type))
(target-dir "Images/")
(target-file
(format "%s%04d.%s" target-dir
- (incf org-e-odt-embedded-images-count) image-type)))
+ (incf org-odt-embedded-images-count) image-type)))
(message "Embedding %s as %s ..."
(substring-no-properties path) target-file)
- (when (= 1 org-e-odt-embedded-images-count)
- (make-directory (concat org-e-odt-zip-dir target-dir))
- (org-e-odt-create-manifest-file-entry "" target-dir))
+ (when (= 1 org-odt-embedded-images-count)
+ (make-directory (concat org-odt-zip-dir target-dir))
+ (org-odt-create-manifest-file-entry "" target-dir))
- (copy-file path (concat org-e-odt-zip-dir target-file) 'overwrite)
- (org-e-odt-create-manifest-file-entry media-type target-file)
+ (copy-file path (concat org-odt-zip-dir target-file) 'overwrite)
+ (org-odt-create-manifest-file-entry media-type target-file)
target-file))
-(defun org-e-odt--image-size (file &optional user-width
+(defun org-odt--image-size (file &optional user-width
user-height scale dpi embed-as)
(let* ((--pixels-to-cms
(function (lambda (pixels dpi)
@@ -2223,7 +2247,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(and size-in-pixels
(cons (funcall --pixels-to-cms (car size-in-pixels) dpi)
(funcall --pixels-to-cms (cdr size-in-pixels) dpi))))))
- (dpi (or dpi org-e-odt-pixels-per-inch))
+ (dpi (or dpi org-odt-pixels-per-inch))
(anchor-type (or embed-as "paragraph"))
(user-width (and (not scale) user-width))
(user-height (and (not scale) user-height))
@@ -2249,7 +2273,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(funcall --size-in-cms size-in-pixels dpi))
;; Use hard-coded values.
(cdr (assoc-string anchor-type
- org-e-odt-default-image-sizes-alist))
+ org-odt-default-image-sizes-alist))
;; Error out.
(error "Cannot determine image size, aborting"))))
(width (car size)) (height (cdr size)))
@@ -2264,8 +2288,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(setq height (* user-width (/ height width)) width user-width))
(t (ignore)))
;; ensure that an embedded image fits comfortably within a page
- (let ((max-width (car org-e-odt-max-image-size))
- (max-height (cdr org-e-odt-max-image-size)))
+ (let ((max-width (car org-odt-max-image-size))
+ (max-height (cdr org-odt-max-image-size)))
(when (or (> width max-width) (> height max-height))
(let* ((scale1 (/ max-width width))
(scale2 (/ max-height height))
@@ -2273,7 +2297,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(setq width (* scale width) height (* scale height)))))
(cons width height)))
-(defun org-e-odt-link--inline-image (element info)
+(defun org-odt-link--inline-image (element info)
"Return ODT code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel."
@@ -2290,7 +2314,7 @@ used as a communication channel."
(plist-get info :input-file)))))
(href (format
"\n<draw:image xlink:href=\"%s\" xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"/>"
- (org-e-odt--copy-image-file src-expanded)))
+ (org-odt--copy-image-file src-expanded)))
;; Extract attributes from #+ATTR_ODT line.
(attr-from (case (org-element-type element)
(link (org-export-get-parent-element element))
@@ -2310,16 +2334,16 @@ used as a communication channel."
;; (embed-as (or embed-as user-frame-anchor "paragraph"))
;; extrac
;; handle `:width', `:height' and `:scale' properties.
- (size (org-e-odt--image-size
+ (size (org-odt--image-size
src-expanded (plist-get attr-plist :width)
(plist-get attr-plist :height)
(plist-get attr-plist :scale) nil ;; embed-as
"paragraph" ; FIXME
))
(width (car size)) (height (cdr size))
- (standalone-link-p (org-e-odt--standalone-link-p element info))
+ (standalone-link-p (org-odt--standalone-link-p element info))
(embed-as (if standalone-link-p "paragraph" "as-char"))
- (captions (org-e-odt-format-label element info 'definition))
+ (captions (org-odt-format-label element info 'definition))
(caption (car captions)) (short-caption (cdr captions))
(entity (concat (and caption "Captioned") embed-as "Image"))
;; Check if this link was created by LaTeX-to-PNG converter.
@@ -2334,13 +2358,13 @@ used as a communication channel."
;; If yes, note down it's contents. It will go in to frame
;; description. This quite useful for debugging.
(desc (and replaces (org-element-property :value replaces))))
- (org-e-odt--render-image/formula entity href width height
+ (org-odt--render-image/formula entity href width height
captions user-frame-params title desc)))
;;;; Links :: Math formula
-(defun org-e-odt-link--inline-formula (element info)
+(defun org-odt-link--inline-formula (element info)
(let* ((src (let* ((type (org-element-property :type element))
(raw-path (org-element-property :path element)))
(cond
@@ -2354,10 +2378,10 @@ used as a communication channel."
(format
"\n<draw:object %s xlink:href=\"%s\" xlink:type=\"simple\"/>"
" xlink:show=\"embed\" xlink:actuate=\"onLoad\""
- (file-name-directory (org-e-odt--copy-formula-file src-expanded))))
- (standalone-link-p (org-e-odt--standalone-link-p element info))
+ (file-name-directory (org-odt--copy-formula-file src-expanded))))
+ (standalone-link-p (org-odt--standalone-link-p element info))
(embed-as (if standalone-link-p 'paragraph 'character))
- (captions (org-e-odt-format-label element info 'definition))
+ (captions (org-odt-format-label element info 'definition))
(caption (car captions)) (short-caption (cdr captions))
;; Check if this link was created by LaTeX-to-MathML
;; converter.
@@ -2375,28 +2399,28 @@ used as a communication channel."
width height)
(cond
((eq embed-as 'character)
- (org-e-odt--render-image/formula "InlineFormula" href width height
+ (org-odt--render-image/formula "InlineFormula" href width height
nil nil title desc))
(t
- (let* ((equation (org-e-odt--render-image/formula
+ (let* ((equation (org-odt--render-image/formula
"CaptionedDisplayFormula" href width height
captions nil title desc))
(label
- (let* ((org-e-odt-category-map-alist
+ (let* ((org-odt-category-map-alist
'(("__MathFormula__" "Text" "math-label" "Equation"
- org-e-odt--enumerable-formula-p))))
- (car (org-e-odt-format-label element info 'definition)))))
+ org-odt--enumerable-formula-p))))
+ (car (org-odt-format-label element info 'definition)))))
(concat equation "<text:tab/>" label))))))
-(defun org-e-odt--copy-formula-file (src-file)
+(defun org-odt--copy-formula-file (src-file)
"Returns the internal name of the file"
(let* ((target-dir (format "Formula-%04d/"
- (incf org-e-odt-embedded-formulas-count)))
+ (incf org-odt-embedded-formulas-count)))
(target-file (concat target-dir "content.xml")))
;; Create a directory for holding formula file. Also enter it in
;; to manifest.
- (make-directory (concat org-e-odt-zip-dir target-dir))
- (org-e-odt-create-manifest-file-entry
+ (make-directory (concat org-odt-zip-dir target-dir))
+ (org-odt-create-manifest-file-entry
"application/vnd.oasis.opendocument.formula" target-dir "1.2")
;; Copy over the formula file from user directory to zip
;; directory.
@@ -2405,19 +2429,19 @@ used as a communication channel."
(cond
;; Case 1: Mathml.
((string-match "\\.\\(mathml\\|mml\\)\\'" src-file)
- (copy-file src-file (concat org-e-odt-zip-dir target-file) 'overwrite))
+ (copy-file src-file (concat org-odt-zip-dir target-file) 'overwrite))
;; Case 2: OpenDocument formula.
((string-match "\\.odf\\'" src-file)
- (org-e-odt--zip-extract src-file "content.xml"
- (concat org-e-odt-zip-dir target-dir)))
+ (org-odt--zip-extract src-file "content.xml"
+ (concat org-odt-zip-dir target-dir)))
(t (error "%s is not a formula file" src-file))))
;; Enter the formula file in to manifest.
- (org-e-odt-create-manifest-file-entry "text/xml" target-file)
+ (org-odt-create-manifest-file-entry "text/xml" target-file)
target-file))
;;;; Targets
-(defun org-e-odt--render-image/formula (cfg-key href width height &optional
+(defun org-odt--render-image/formula (cfg-key href width height &optional
captions user-frame-params
&rest title-and-desc)
(let* ((frame-cfg-alist
@@ -2445,7 +2469,7 @@ used as a communication channel."
;; FRAME-PARAMS :: List of the form (FRAME-STYLE-NAME
;; FRAME-ATTRIBUTES FRAME-ANCHOR). Note
;; that these are the last three arguments
- ;; to `org-e-odt--frame'.
+ ;; to `org-odt--frame'.
;; Note that an un-captioned image/formula requires just an
;; INNER-FRAME, while a captioned image/formula requires
@@ -2493,7 +2517,7 @@ used as a communication channel."
((not caption)
;; Merge user frame params with that from configuration.
(setq inner (funcall --merge-frame-params inner user))
- (apply 'org-e-odt--frame href width height
+ (apply 'org-odt--frame href width height
(append inner title-and-desc)))
;; Case 2: Image/Formula is captioned or labeled.
;; There are two frames: The inner one surrounds the
@@ -2510,22 +2534,22 @@ used as a communication channel."
(when short-caption
(format " draw:name=\"%s\" " short-caption))))
frame-params))
- (apply 'org-e-odt--textbox
+ (apply 'org-odt--textbox
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Illustration"
(concat
- (apply 'org-e-odt--frame href width height
+ (apply 'org-odt--frame href width height
(append inner title-and-desc))
caption))
width height outer)))))
-(defun org-e-odt--enumerable-p (element info)
+(defun org-odt--enumerable-p (element info)
;; Element should have a caption or label.
(or (org-element-property :caption element)
(org-element-property :name element)))
-(defun org-e-odt--enumerable-image-p (element info)
- (org-e-odt--standalone-link-p
+(defun org-odt--enumerable-image-p (element info)
+ (org-odt--standalone-link-p
element info
;; Paragraph should have a caption or label. It SHOULD NOT be a
;; replacement element. (i.e., It SHOULD NOT be a result of LaTeX
@@ -2537,10 +2561,10 @@ used as a communication channel."
;; Link should point to an image file.
(lambda (l)
(assert (eq (org-element-type l) 'link))
- (org-export-inline-image-p l org-e-odt-inline-image-rules))))
+ (org-export-inline-image-p l org-odt-inline-image-rules))))
-(defun org-e-odt--enumerable-latex-image-p (element info)
- (org-e-odt--standalone-link-p
+(defun org-odt--enumerable-latex-image-p (element info)
+ (org-odt--standalone-link-p
element info
;; Paragraph should have a caption or label. It SHOULD also be a
;; replacement element. (i.e., It SHOULD be a result of LaTeX
@@ -2552,10 +2576,10 @@ used as a communication channel."
;; Link should point to an image file.
(lambda (l)
(assert (eq (org-element-type l) 'link))
- (org-export-inline-image-p l org-e-odt-inline-image-rules))))
+ (org-export-inline-image-p l org-odt-inline-image-rules))))
-(defun org-e-odt--enumerable-formula-p (element info)
- (org-e-odt--standalone-link-p
+(defun org-odt--enumerable-formula-p (element info)
+ (org-odt--standalone-link-p
element info
;; Paragraph should have a caption or label.
(lambda (p)
@@ -2564,9 +2588,9 @@ used as a communication channel."
;; Link should point to a MathML or ODF file.
(lambda (l)
(assert (eq (org-element-type l) 'link))
- (org-export-inline-image-p l org-e-odt-inline-formula-rules))))
+ (org-export-inline-image-p l org-odt-inline-formula-rules))))
-(defun org-e-odt--standalone-link-p (element info &optional
+(defun org-odt--standalone-link-p (element info &optional
paragraph-predicate
link-predicate)
"Test if ELEMENT is a standalone link for the purpose ODT export.
@@ -2603,12 +2627,12 @@ Return nil, otherwise."
(= (incf inline-image-count) 1)))
(t nil))))))))
-(defun org-e-odt-link--infer-description (destination info)
+(defun org-odt-link--infer-description (destination info)
;; DESTINATION is a HEADLINE, a "<<target>>" or an element (like
;; paragraph, verse-block etc) to which a "#+NAME: label" can be
;; attached. Note that labels that are attached to captioned
;; entities - inline images, math formulae and tables - get resolved
- ;; as part of `org-e-odt-format-label' and `org-e-odt--enumerate'.
+ ;; as part of `org-odt-format-label' and `org-odt--enumerate'.
;; Create a cross-reference to DESTINATION but make best-efforts to
;; create a *meaningful* description. Check item numbers, section
@@ -2693,7 +2717,7 @@ Return nil, otherwise."
(org-export-data title info)))))
(error "FIXME?"))))
-(defun org-e-odt-link (link desc info)
+(defun org-odt-link (link desc info)
"Transcode a LINK object from Org to ODT.
DESC is the description part of the link, or the empty string.
@@ -2704,7 +2728,7 @@ INFO is a plist holding contextual information. See
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
(imagep (org-export-inline-image-p
- link org-e-odt-inline-image-rules))
+ link org-odt-inline-image-rules))
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
@@ -2717,12 +2741,12 @@ INFO is a plist holding contextual information. See
(cond
;; Image file.
((and (not desc) (org-export-inline-image-p
- link org-e-odt-inline-image-rules))
- (org-e-odt-link--inline-image link info))
+ link org-odt-inline-image-rules))
+ (org-odt-link--inline-image link info))
;; Formula file.
((and (not desc) (org-export-inline-image-p
- link org-e-odt-inline-formula-rules))
- (org-e-odt-link--inline-formula link info))
+ link org-odt-inline-formula-rules))
+ (org-odt-link--inline-formula link info))
;; Radio target: Transcode target's contents and use them as
;; link's description.
((string= type "radio")
@@ -2764,7 +2788,7 @@ INFO is a plist holding contextual information. See
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
label desc))))
;; Case 4: LINK points to an Inline image, Math formula or a Table.
- (let ((label-reference (ignore-errors (org-e-odt-format-label
+ (let ((label-reference (ignore-errors (org-odt-format-label
destination info 'reference))))
(when label-reference
(cond
@@ -2792,7 +2816,7 @@ INFO is a plist holding contextual information. See
;; TARGET or an ELEMENT with a #+NAME: LABEL attached to it.
;; LINK to DESTINATION, but make a best effort to provide a
;; *meaningful* description.
- (org-e-odt-link--infer-description destination info))))
+ (org-odt-link--infer-description destination info))))
;; Coderef: replace link with the reference name or the
;; equivalent line number.
((string= type "coderef")
@@ -2814,7 +2838,7 @@ INFO is a plist holding contextual information. See
(let ((desc-element (car link-contents)))
(and (eq (org-element-type desc-element) 'link)
(org-export-inline-image-p
- desc-element org-e-odt-inline-image-rules))))
+ desc-element org-odt-inline-image-rules))))
;; Format link as a clickable image.
(format "\n<draw:a xlink:type=\"simple\" xlink:href=\"%s\">\n%s\n</draw:a>"
path desc)
@@ -2832,7 +2856,7 @@ INFO is a plist holding contextual information. See
;;;; Paragraph
-(defun org-e-odt-paragraph (paragraph contents info)
+(defun org-odt-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to ODT.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
@@ -2849,14 +2873,14 @@ the plist used as a communication channel."
;; together.
(when (and (eq (org-element-type parent) 'item)
(eq paragraph (car (org-element-contents parent))))
- (setq contents (concat (org-e-odt--checkbox parent) contents)))
+ (setq contents (concat (org-odt--checkbox parent) contents)))
(assert style)
(format "\n<text:p text:style-name=\"%s\">%s</text:p>" style contents)))
;;;; Plain List
-(defun org-e-odt-plain-list (plain-list contents info)
+(defun org-odt-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to ODT.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
@@ -2877,7 +2901,7 @@ contextual information."
;;;; Plain Text
-(defun org-e-odt--encode-tabs-and-spaces (line)
+(defun org-odt--encode-tabs-and-spaces (line)
(replace-regexp-in-string
"\\([\t]\\|\\([ ]+\\)\\)"
(lambda (s)
@@ -2890,21 +2914,21 @@ contextual information."
(t ""))))))
line))
-(defun org-e-odt--encode-plain-text (text &optional no-whitespace-filling)
+(defun org-odt--encode-plain-text (text &optional no-whitespace-filling)
(mapc
(lambda (pair)
(setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))
'(("&" . "&amp;") ("<" . "&lt;") (">" . "&gt;")))
(if no-whitespace-filling text
- (org-e-odt--encode-tabs-and-spaces text)))
+ (org-odt--encode-tabs-and-spaces text)))
-(defun org-e-odt-plain-text (text info)
+(defun org-odt-plain-text (text info)
"Transcode a TEXT string from Org to ODT.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
(let ((output text))
;; Protect &, < and >.
- (setq output (org-e-odt--encode-plain-text output t))
+ (setq output (org-odt--encode-plain-text output t))
;; Handle smart quotes. Be sure to provide original string since
;; OUTPUT may have been modified.
(setq output (org-export-activate-smart-quotes output :utf-8 info text))
@@ -2914,7 +2938,7 @@ contextual information."
(lambda (pair)
(setq output
(replace-regexp-in-string (car pair) (cdr pair) output t nil)))
- org-e-odt-special-string-regexps))
+ org-odt-special-string-regexps))
;; Handle break preservation if required.
(when (plist-get info :preserve-breaks)
(setq output (replace-regexp-in-string
@@ -2925,7 +2949,7 @@ contextual information."
;;;; Planning
-(defun org-e-odt-planning (planning contents info)
+(defun org-odt-planning (planning contents info)
"Transcode a PLANNING element from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -2937,24 +2961,24 @@ channel."
(concat
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgClosedKeyword" org-closed-string)
- (org-e-odt-timestamp closed contents info))))
+ (org-odt-timestamp closed contents info))))
(let ((deadline (org-element-property :deadline planning)))
(when deadline
(concat
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgDeadlineKeyword" org-deadline-string)
- (org-e-odt-timestamp deadline contents info))))
+ (org-odt-timestamp deadline contents info))))
(let ((scheduled (org-element-property :scheduled planning)))
(when scheduled
(concat
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgScheduledKeyword" org-deadline-string)
- (org-e-odt-timestamp scheduled contents info)))))))
+ (org-odt-timestamp scheduled contents info)))))))
;;;; Property Drawer
-(defun org-e-odt-property-drawer (property-drawer contents info)
+(defun org-odt-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -2965,7 +2989,7 @@ information."
;;;; Quote Block
-(defun org-e-odt-quote-block (quote-block contents info)
+(defun org-odt-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to ODT.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -2974,25 +2998,25 @@ holding contextual information."
;;;; Quote Section
-(defun org-e-odt-quote-section (quote-section contents info)
+(defun org-odt-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
(org-element-property :value quote-section))))
- (when value (org-e-odt-do-format-code value))))
+ (when value (org-odt-do-format-code value))))
;;;; Section
-(defun org-e-odt-format-section (text style &optional name)
- (let ((default-name (car (org-e-odt-add-automatic-style "Section"))))
+(defun org-odt-format-section (text style &optional name)
+ (let ((default-name (car (org-odt-add-automatic-style "Section"))))
(format "\n<text:section text:style-name=\"%s\" %s>\n%s\n</text:section>"
style
(format "text:name=\"%s\"" (or name default-name))
text)))
-(defun org-e-odt-section (section contents info) ; FIXME
+(defun org-odt-section (section contents info) ; FIXME
"Transcode a SECTION element from Org to ODT.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -3000,18 +3024,18 @@ holding contextual information."
;;;; Radio Target
-(defun org-e-odt-radio-target (radio-target text info)
+(defun org-odt-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to ODT.
TEXT is the text of the target. INFO is a plist holding
contextual information."
- (org-e-odt--target
+ (org-odt--target
text (org-export-solidify-link-text
(org-element-property :value radio-target))))
;;;; Special Block
-(defun org-e-odt-special-block (special-block contents info)
+(defun org-odt-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to ODT.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -3035,7 +3059,7 @@ holding contextual information."
(format "<dc:creator>%s</dc:creator>" author))
(and date
(format "<dc:date>%s</dc:date>"
- (org-e-odt--format-timestamp date nil 'iso-date)))
+ (org-odt--format-timestamp date nil 'iso-date)))
contents)))))
;; Textbox.
((string= type "textbox")
@@ -3045,14 +3069,14 @@ holding contextual information."
(extra (plist-get attributes :extra))
(anchor (plist-get attributes :anchor)))
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
- "Text_20_body" (org-e-odt--textbox contents width height
+ "Text_20_body" (org-odt--textbox contents width height
style extra anchor))))
(t contents))))
;;;; Src Block
-(defun org-e-odt-hfy-face-to-css (fn)
+(defun org-odt-hfy-face-to-css (fn)
"Create custom style for face FN.
When FN is the default face, use it's foreground and background
properties to create \"OrgSrcBlock\" paragraph style. Otherwise
@@ -3074,10 +3098,10 @@ and prefix with \"OrgSrc\". For example,
""))) fn))
(color-val (cdr (assoc "color" css-list)))
(background-color-val (cdr (assoc "background" css-list)))
- (style (and org-e-odt-create-custom-styles-for-srcblocks
+ (style (and org-odt-create-custom-styles-for-srcblocks
(cond
((eq fn 'default)
- (format org-e-odt-src-block-paragraph-format
+ (format org-odt-src-block-paragraph-format
background-color-val color-val))
(t
(format
@@ -3087,7 +3111,7 @@ and prefix with \"OrgSrc\". For example,
</style:style>" style-name color-val))))))
(cons style-name style)))
-(defun org-e-odt-htmlfontify-string (line)
+(defun org-odt-htmlfontify-string (line)
(let* ((hfy-html-quote-regex "\\([<\"&> ]\\)")
(hfy-html-quote-map '(("\"" "&quot;")
("<" "&lt;")
@@ -3095,7 +3119,7 @@ and prefix with \"OrgSrc\". For example,
(">" "&gt;")
(" " "<text:s/>")
(" " "<text:tab/>")))
- (hfy-face-to-css 'org-e-odt-hfy-face-to-css)
+ (hfy-face-to-css 'org-odt-hfy-face-to-css)
(hfy-optimisations-1 (copy-sequence hfy-optimisations))
(hfy-optimisations (add-to-list 'hfy-optimisations-1
'body-text-only))
@@ -3105,14 +3129,14 @@ and prefix with \"OrgSrc\". For example,
(hfy-end-span-handler (lambda nil (insert "</text:span>"))))
(org-no-warnings (htmlfontify-string line))))
-(defun org-e-odt-do-format-code
+(defun org-odt-do-format-code
(code &optional lang refs retain-labels num-start)
(let* ((lang (or (assoc-default lang org-src-lang-modes) lang))
(lang-mode (and lang (intern (format "%s-mode" lang))))
(code-lines (org-split-string code "\n"))
(code-length (length code-lines))
(use-htmlfontify-p (and (functionp lang-mode)
- org-e-odt-fontify-srcblocks
+ org-odt-fontify-srcblocks
(require 'htmlfontify nil t)
(fboundp 'htmlfontify-string)))
(code (if (not use-htmlfontify-p) code
@@ -3121,8 +3145,8 @@ and prefix with \"OrgSrc\". For example,
(funcall lang-mode)
(font-lock-fontify-buffer)
(buffer-string))))
- (fontifier (if use-htmlfontify-p 'org-e-odt-htmlfontify-string
- 'org-e-odt--encode-plain-text))
+ (fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
+ 'org-odt--encode-plain-text))
(par-style (if use-htmlfontify-p "OrgSrcBlock"
"OrgFixedWidthBlock"))
(i 0))
@@ -3137,7 +3161,7 @@ and prefix with \"OrgSrc\". For example,
(setq loc (concat loc (and ref retain-labels (format " (%s)" ref))))
(setq loc (funcall fontifier loc))
(when ref
- (setq loc (org-e-odt--target loc (concat "coderef-" ref))))
+ (setq loc (org-odt--target loc (concat "coderef-" ref))))
(assert par-style)
(setq loc (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
par-style loc))
@@ -3155,7 +3179,7 @@ and prefix with \"OrgSrc\". For example,
"\n<text:list text:style-name=\"OrgSrcBlockNumberedLine\"%s>%s</text:list>"
" text:continue-numbering=\"true\"" code)))))
-(defun org-e-odt-format-code (element info)
+(defun org-odt-format-code (element info)
(let* ((lang (org-element-property :language element))
;; Extract code and references.
(code-info (org-export-unravel-code element))
@@ -3167,30 +3191,30 @@ and prefix with \"OrgSrc\". For example,
(num-start (case (org-element-property :number-lines element)
(continued (org-export-get-loc element info))
(new 0))))
- (org-e-odt-do-format-code code lang refs retain-labels num-start)))
+ (org-odt-do-format-code code lang refs retain-labels num-start)))
-(defun org-e-odt-src-block (src-block contents info)
+(defun org-odt-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to ODT.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((lang (org-element-property :language src-block))
(attributes (org-export-read-attribute :attr_odt src-block))
- (captions (org-e-odt-format-label src-block info 'definition))
+ (captions (org-odt-format-label src-block info 'definition))
(caption (car captions)) (short-caption (cdr captions)))
(concat
(and caption
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Listing" caption))
- (let ((--src-block (org-e-odt-format-code src-block info)))
+ (let ((--src-block (org-odt-format-code src-block info)))
(if (not (plist-get attributes :textbox)) --src-block
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Text_20_body"
- (org-e-odt--textbox --src-block nil nil nil)))))))
+ (org-odt--textbox --src-block nil nil nil)))))))
;;;; Statistics Cookie
-(defun org-e-odt-statistics-cookie (statistics-cookie contents info)
+(defun org-odt-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((cookie-value (org-element-property :value statistics-cookie)))
@@ -3200,7 +3224,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Strike-Through
-(defun org-e-odt-strike-through (strike-through contents info)
+(defun org-odt-strike-through (strike-through contents info)
"Transcode STRIKE-THROUGH from Org to ODT.
CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information."
@@ -3210,7 +3234,7 @@ holding contextual information."
;;;; Subscript
-(defun org-e-odt-subscript (subscript contents info)
+(defun org-odt-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to ODT.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -3220,7 +3244,7 @@ contextual information."
;;;; Superscript
-(defun org-e-odt-superscript (superscript contents info)
+(defun org-odt-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to ODT.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -3230,16 +3254,16 @@ contextual information."
;;;; Table Cell
-(defun org-e-odt-table-style-spec (element info)
+(defun org-odt-table-style-spec (element info)
(let* ((table (org-export-get-parent-table element))
(table-attributes (org-export-read-attribute :attr_odt table))
(table-style (plist-get table-attributes :style)))
- (assoc table-style org-e-odt-table-styles)))
+ (assoc table-style org-odt-table-styles)))
-(defun org-e-odt-get-table-cell-styles (table-cell info)
+(defun org-odt-get-table-cell-styles (table-cell info)
"Retrieve styles applicable to a table cell.
R and C are (zero-based) row and column numbers of the table
-cell. STYLE-SPEC is an entry in `org-e-odt-table-styles'
+cell. STYLE-SPEC is an entry in `org-odt-table-styles'
applicable to the current table. It is `nil' if the table is not
associated with any style attributes.
@@ -3249,13 +3273,13 @@ When STYLE-SPEC is nil, style the table cell the conventional way
- choose cell borders based on row and column groupings and
choose paragraph alignment based on `org-col-cookies' text
property. See also
-`org-e-odt-get-paragraph-style-cookie-for-table-cell'.
+`org-odt-get-paragraph-style-cookie-for-table-cell'.
When STYLE-SPEC is non-nil, ignore the above cookie and return
styles congruent with the ODF-1.2 specification."
(let* ((table-cell-address (org-export-table-cell-address table-cell info))
(r (car table-cell-address)) (c (cdr table-cell-address))
- (style-spec (org-e-odt-table-style-spec table-cell info))
+ (style-spec (org-odt-table-style-spec table-cell info))
(table-dimensions (org-export-table-dimensions
(org-export-get-parent-table table-cell)
info)))
@@ -3296,7 +3320,7 @@ styles congruent with the ODF-1.2 specification."
(t ""))))
(concat template-name cell-type)))))
-(defun org-e-odt-table-cell (table-cell contents info)
+(defun org-odt-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -3305,7 +3329,7 @@ channel."
(c (cdr table-cell-address))
(horiz-span (or (org-export-table-cell-width table-cell info) 0))
(table-row (org-export-get-parent table-cell))
- (custom-style-prefix (org-e-odt-get-table-cell-styles
+ (custom-style-prefix (org-odt-get-table-cell-styles
table-cell info))
(paragraph-style
(or
@@ -3365,7 +3389,7 @@ channel."
;;;; Table Row
-(defun org-e-odt-table-row (table-row contents info)
+(defun org-odt-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to ODT.
CONTENTS is the contents of the row. INFO is a plist used as a
communication channel."
@@ -3385,28 +3409,27 @@ communication channel."
(concat
;; Does this row begin a rowgroup?
(when (org-export-table-row-starts-rowgroup-p table-row info)
- (car rowgroup-tags))
+ (car rowgroup-tags))
;; Actual table row
(format "\n<table:table-row>\n%s\n</table:table-row>" contents)
;; Does this row end a rowgroup?
(when (org-export-table-row-ends-rowgroup-p table-row info)
- (cdr rowgroup-tags))))))
+ (cdr rowgroup-tags))))))
;;;; Table
-(defun org-e-odt-table-first-row-data-cells (table info)
+(defun org-odt-table-first-row-data-cells (table info)
(let ((table-row
- (org-element-map
- table 'table-row
- (lambda (row)
- (unless (eq (org-element-property :type row) 'rule) row))
- info 'first-match))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (unless (eq (org-element-property :type row) 'rule) row))
+ info 'first-match))
(special-column-p (org-export-table-has-special-column-p table)))
(if (not special-column-p) (org-element-contents table-row)
(cdr (org-element-contents table-row)))))
-(defun org-e-odt--table (table contents info)
+(defun org-odt--table (table contents info)
"Transcode a TABLE element from Org to ODT.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
@@ -3417,15 +3440,15 @@ contextual information."
(prog1 nil
(message
(concat
- "(org-e-odt): Found table.el-type table in the source Org file."
+ "(ox-odt): Found table.el-type table in the source Org file."
" table.el doesn't support export to ODT format."
" Stripping the table from export."))))
;; Case 2: Native Org tables.
(otherwise
- (let* ((captions (org-e-odt-format-label table info 'definition))
+ (let* ((captions (org-odt-format-label table info 'definition))
(caption (car captions)) (short-caption (cdr captions))
(attributes (org-export-read-attribute :attr_odt table))
- (custom-table-style (nth 1 (org-e-odt-table-style-spec table info)))
+ (custom-table-style (nth 1 (org-odt-table-style-spec table info)))
(table-column-specs
(function
(lambda (table info)
@@ -3440,7 +3463,7 @@ contextual information."
column-style))
out)
(dotimes (i width out) (setq out (concat s out)))))
- (org-e-odt-table-first-row-data-cells table info) "\n"))))))
+ (org-odt-table-first-row-data-cells table info) "\n"))))))
(concat
;; caption.
(when caption
@@ -3448,7 +3471,7 @@ contextual information."
"Table" caption))
;; begin table.
(let* ((automatic-name
- (org-e-odt-add-automatic-style "Table" attributes)))
+ (org-odt-add-automatic-style "Table" attributes)))
(format
"\n<table:table table:style-name=\"%s\"%s>"
(or custom-table-style (cdr automatic-name) "OrgTable")
@@ -3461,12 +3484,12 @@ contextual information."
;; end table.
"</table:table>")))))
-(defun org-e-odt-table (table contents info)
+(defun org-odt-table (table contents info)
"Transcode a TABLE element from Org to ODT.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information.
-Use `org-e-odt--table' to typeset the table. Handle details
+Use `org-odt--table' to typeset the table. Handle details
pertaining to indentation here."
(let* ((--element-preceded-by-table-p
(function
@@ -3596,42 +3619,42 @@ pertaining to indentation here."
;; item, but also within description lists and low-level
;; headlines.
- ;; See `org-e-odt-translate-description-lists' and
- ;; `org-e-odt-translate-low-level-headlines' for how this is
+ ;; See `org-odt-translate-description-lists' and
+ ;; `org-odt-translate-low-level-headlines' for how this is
;; tackled.
(concat "\n"
;; Discontinue the list.
(mapconcat 'car close-open-tags "\n")
;; Put the table in an indented section.
- (let* ((table (org-e-odt--table table contents info))
+ (let* ((table (org-odt--table table contents info))
(level (/ (length (mapcar 'car close-open-tags)) 2))
(style (format "OrgIndentedSection-Level-%d" level)))
- (when table (org-e-odt-format-section table style)))
+ (when table (org-odt-format-section table style)))
;; Continue the list.
(mapconcat 'cdr (nreverse close-open-tags) "\n"))))
;;;; Target
-(defun org-e-odt-target (target contents info)
+(defun org-odt-target (target contents info)
"Transcode a TARGET object from Org to ODT.
CONTENTS is nil. INFO is a plist holding contextual
information."
(let ((value (org-element-property :value target)))
- (org-e-odt--target "" (org-export-solidify-link-text value))))
+ (org-odt--target "" (org-export-solidify-link-text value))))
;;;; Timestamp
-(defun org-e-odt-timestamp (timestamp contents info)
+(defun org-odt-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(let* ((raw-value (org-element-property :raw-value timestamp))
(type (org-element-property :type timestamp)))
- (if (not org-e-odt-use-date-fields)
- (let ((value (org-e-odt-plain-text
+ (if (not org-odt-use-date-fields)
+ (let ((value (org-odt-plain-text
(org-timestamp-translate timestamp) info)))
(case (org-element-property :type timestamp)
((active active-range)
@@ -3645,33 +3668,33 @@ channel."
(active
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgActiveTimestamp"
- (format "&lt;%s&gt;" (org-e-odt--format-timestamp timestamp))))
+ (format "&lt;%s&gt;" (org-odt--format-timestamp timestamp))))
(inactive
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgInactiveTimestamp"
- (format "[%s]" (org-e-odt--format-timestamp timestamp))))
+ (format "[%s]" (org-odt--format-timestamp timestamp))))
(active-range
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgActiveTimestamp"
(format "&lt;%s&gt;&#x2013;&lt;%s&gt;"
- (org-e-odt--format-timestamp timestamp)
- (org-e-odt--format-timestamp timestamp 'end))))
+ (org-odt--format-timestamp timestamp)
+ (org-odt--format-timestamp timestamp 'end))))
(inactive-range
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgInactiveTimestamp"
(format "[%s]&#x2013;[%s]"
- (org-e-odt--format-timestamp timestamp)
- (org-e-odt--format-timestamp timestamp 'end))))
+ (org-odt--format-timestamp timestamp)
+ (org-odt--format-timestamp timestamp 'end))))
(otherwise
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"OrgDiaryTimestamp"
- (org-e-odt-plain-text (org-timestamp-translate timestamp)
+ (org-odt-plain-text (org-timestamp-translate timestamp)
info)))))))
;;;; Underline
-(defun org-e-odt-underline (underline contents info)
+(defun org-odt-underline (underline contents info)
"Transcode UNDERLINE from Org to ODT.
CONTENTS is the text with underline markup. INFO is a plist
holding contextual information."
@@ -3681,7 +3704,7 @@ holding contextual information."
;;;; Verbatim
-(defun org-e-odt-verbatim (verbatim contents info)
+(defun org-odt-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to ODT.
CONTENTS is nil. INFO is a plist used as a communication
channel."
@@ -3691,7 +3714,7 @@ channel."
;;;; Verse Block
-(defun org-e-odt-verse-block (verse-block contents info)
+(defun org-odt-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to ODT.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
@@ -3700,7 +3723,7 @@ contextual information."
"\\(<text:line-break/>\\)?[ \t]*\n"
"<text:line-break/>" contents))
;; Replace tabs and spaces.
- (setq contents (org-e-odt--encode-tabs-and-spaces contents))
+ (setq contents (org-odt--encode-tabs-and-spaces contents))
;; Surround it in a verse environment.
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"OrgVerse" contents))
@@ -3711,8 +3734,8 @@ contextual information."
;;;; LaTeX fragments
-(defun org-e-odt--translate-latex-fragments (tree backend info)
- (let ((processing-type (plist-get info :LaTeX-fragments))
+(defun org-odt--translate-latex-fragments (tree backend info)
+ (let ((processing-type (plist-get info :with-latex))
(count 0))
;; Normalize processing-type to one of dvipng, mathml or verbatim.
;; If the desired converter is not available, force verbatim
@@ -3734,88 +3757,87 @@ contextual information."
(setq processing-type 'verbatim)))
;; Store normalized value for later use.
- (when (plist-get info :LaTeX-fragments)
- (plist-put info :LaTeX-fragments processing-type))
+ (when (plist-get info :with-latex)
+ (plist-put info :with-latex processing-type))
(message "Formatting LaTeX using %s" processing-type)
;; Convert `latex-fragment's and `latex-environment's.
(when (memq processing-type '(mathml dvipng))
- (org-element-map
- tree '(latex-fragment latex-environment)
- (lambda (latex-*)
- (incf count)
- (let* ((latex-frag (org-element-property :value latex-*))
- (input-file (plist-get info :input-file))
- (cache-dir (file-name-directory input-file))
- (cache-subdir (concat
- (case processing-type
- (dvipng "ltxpng/")
- (mathml "ltxmathml/"))
- (file-name-sans-extension
- (file-name-nondirectory input-file))))
- (display-msg
- (case processing-type
- (dvipng (format "Creating LaTeX Image %d..." count))
- (mathml (format "Creating MathML snippet %d..." count))))
- ;; Get an Org-style link to PNG image or the MathML
- ;; file.
- (org-link
- (let ((link (with-temp-buffer
- (insert latex-frag)
- (org-format-latex cache-subdir cache-dir
- nil display-msg
- nil nil processing-type)
- (buffer-substring-no-properties
- (point-min) (point-max)))))
- (if (not (string-match "file:\\([^]]*\\)" link))
- (prog1 nil (message "LaTeX Conversion failed."))
- link))))
- (when org-link
- ;; Conversion succeeded. Parse above Org-style link to a
- ;; `link' object.
- (let* ((link (car (org-element-map (with-temp-buffer
- (org-mode)
- (insert org-link)
- (org-element-parse-buffer))
- 'link 'identity))))
- ;; Orphan the link.
- (org-element-put-property link :parent nil)
- (let* (
- (replacement
- (case (org-element-type latex-*)
- ;; Case 1: LaTeX environment.
- ;; Mimic a "standalone image or formula" by
- ;; enclosing the `link' in a `paragraph'.
- ;; Copy over original attributes, captions to
- ;; the enclosing paragraph.
- (latex-environment
- (org-element-adopt-elements
- (list 'paragraph
- (list :style "OrgFormula"
- :name (org-element-property :name
- latex-*)
- :caption (org-element-property :caption
- latex-*)))
- link))
- ;; Case 2: LaTeX fragment.
- ;; No special action.
- (latex-fragment link))))
- ;; Note down the object that link replaces.
- (org-element-put-property replacement :replaces
- (list (org-element-type latex-*)
- (list :value latex-frag)))
- ;; Replace now.
- (org-element-set-element latex-* replacement))))))
- info)))
+ (org-element-map tree '(latex-fragment latex-environment)
+ (lambda (latex-*)
+ (incf count)
+ (let* ((latex-frag (org-element-property :value latex-*))
+ (input-file (plist-get info :input-file))
+ (cache-dir (file-name-directory input-file))
+ (cache-subdir (concat
+ (case processing-type
+ (dvipng "ltxpng/")
+ (mathml "ltxmathml/"))
+ (file-name-sans-extension
+ (file-name-nondirectory input-file))))
+ (display-msg
+ (case processing-type
+ (dvipng (format "Creating LaTeX Image %d..." count))
+ (mathml (format "Creating MathML snippet %d..." count))))
+ ;; Get an Org-style link to PNG image or the MathML
+ ;; file.
+ (org-link
+ (let ((link (with-temp-buffer
+ (insert latex-frag)
+ (org-format-latex cache-subdir cache-dir
+ nil display-msg
+ nil nil processing-type)
+ (buffer-substring-no-properties
+ (point-min) (point-max)))))
+ (if (not (string-match "file:\\([^]]*\\)" link))
+ (prog1 nil (message "LaTeX Conversion failed."))
+ link))))
+ (when org-link
+ ;; Conversion succeeded. Parse above Org-style link to a
+ ;; `link' object.
+ (let* ((link (car (org-element-map (with-temp-buffer
+ (org-mode)
+ (insert org-link)
+ (org-element-parse-buffer))
+ 'link 'identity))))
+ ;; Orphan the link.
+ (org-element-put-property link :parent nil)
+ (let* (
+ (replacement
+ (case (org-element-type latex-*)
+ ;; Case 1: LaTeX environment.
+ ;; Mimic a "standalone image or formula" by
+ ;; enclosing the `link' in a `paragraph'.
+ ;; Copy over original attributes, captions to
+ ;; the enclosing paragraph.
+ (latex-environment
+ (org-element-adopt-elements
+ (list 'paragraph
+ (list :style "OrgFormula"
+ :name (org-element-property :name
+ latex-*)
+ :caption (org-element-property :caption
+ latex-*)))
+ link))
+ ;; Case 2: LaTeX fragment.
+ ;; No special action.
+ (latex-fragment link))))
+ ;; Note down the object that link replaces.
+ (org-element-put-property replacement :replaces
+ (list (org-element-type latex-*)
+ (list :value latex-frag)))
+ ;; Replace now.
+ (org-element-set-element latex-* replacement))))))
+ info)))
tree)
;;;; Description lists
;; This translator is necessary to handle indented tables in a uniform
-;; manner. See comment in `org-e-odt--table'.
+;; manner. See comment in `org-odt--table'.
-(defun org-e-odt--translate-description-lists (tree backend info)
+(defun org-odt--translate-description-lists (tree backend info)
;; OpenDocument has no notion of a description list. So simulate it
;; using plain lists. Description lists in the exported document
;; are typeset in the same manner as they are in a typical HTML
@@ -3846,29 +3868,28 @@ contextual information."
;; 2. The paragraph containing the definition term is styled to be
;; in bold.
;;
- (org-element-map
- tree 'plain-list
- (lambda (el)
- (when (equal (org-element-property :type el) 'descriptive)
- (org-element-set-element
- el
- (apply 'org-element-adopt-elements
- (list 'plain-list (list :type 'descriptive-1))
- (mapcar
- (lambda (item)
- (org-element-adopt-elements
- (list 'item (list :checkbox (org-element-property
- :checkbox item)))
- (list 'paragraph (list :style "Text_20_body_20_bold")
- (or (org-element-property :tag item) "(no term)"))
+ (org-element-map tree 'plain-list
+ (lambda (el)
+ (when (equal (org-element-property :type el) 'descriptive)
+ (org-element-set-element
+ el
+ (apply 'org-element-adopt-elements
+ (list 'plain-list (list :type 'descriptive-1))
+ (mapcar
+ (lambda (item)
(org-element-adopt-elements
- (list 'plain-list (list :type 'descriptive-2))
- (apply 'org-element-adopt-elements
- (list 'item nil)
- (org-element-contents item)))))
- (org-element-contents el)))))
- nil)
- info)
+ (list 'item (list :checkbox (org-element-property
+ :checkbox item)))
+ (list 'paragraph (list :style "Text_20_body_20_bold")
+ (or (org-element-property :tag item) "(no term)"))
+ (org-element-adopt-elements
+ (list 'plain-list (list :type 'descriptive-2))
+ (apply 'org-element-adopt-elements
+ (list 'item nil)
+ (org-element-contents item)))))
+ (org-element-contents el)))))
+ nil)
+ info)
tree)
;;;; List tables
@@ -3912,66 +3933,61 @@ contextual information."
;; Translate lists to tables
-(defun org-e-odt--translate-list-tables (tree backend info)
- (org-element-map
- tree 'plain-list
- (lambda (l1-list)
- (when (org-export-read-attribute :attr_odt l1-list :list-table)
- ;; Replace list with table.
- (org-element-set-element
- l1-list
- ;; Build replacement table.
- (apply 'org-element-adopt-elements
- (list 'table '(:type org :attr_odt (":style \"GriddedTable\"")))
- (org-element-map
- l1-list
- 'item
- (lambda (l1-item)
- (let* ((l1-item-contents (org-element-contents l1-item))
- l1-item-leading-text l2-list)
- ;; Remove Level-2 list from the Level-item. It
- ;; will be subsequently attached as table-cells.
- (let ((cur l1-item-contents) prev)
- (while (and cur (not (eq (org-element-type (car cur))
- 'plain-list)))
- (setq prev cur)
- (setq cur (cdr cur)))
- (when prev
- (setcdr prev nil)
- (setq l2-list (car cur)))
- (setq l1-item-leading-text l1-item-contents))
- ;; Level-1 items start a table row.
- (apply 'org-element-adopt-elements
- (list 'table-row (list :type 'standard))
- ;; Leading text of level-1 item define the
- ;; first table-cell.
- (apply 'org-element-adopt-elements
- (list 'table-cell nil)
- l1-item-leading-text)
- ;; Level-2 items define subsequent
- ;; table-cells of the row.
- (org-element-map
- l2-list
- 'item
- (lambda (l2-item)
- (apply 'org-element-adopt-elements
- (list 'table-cell nil)
- (org-element-contents l2-item)))
- info nil 'item))))
- info nil 'item))))
- nil)
- info)
+(defun org-odt--translate-list-tables (tree backend info)
+ (org-element-map tree 'plain-list
+ (lambda (l1-list)
+ (when (org-export-read-attribute :attr_odt l1-list :list-table)
+ ;; Replace list with table.
+ (org-element-set-element
+ l1-list
+ ;; Build replacement table.
+ (apply 'org-element-adopt-elements
+ (list 'table '(:type org :attr_odt (":style \"GriddedTable\"")))
+ (org-element-map l1-list 'item
+ (lambda (l1-item)
+ (let* ((l1-item-contents (org-element-contents l1-item))
+ l1-item-leading-text l2-list)
+ ;; Remove Level-2 list from the Level-item. It
+ ;; will be subsequently attached as table-cells.
+ (let ((cur l1-item-contents) prev)
+ (while (and cur (not (eq (org-element-type (car cur))
+ 'plain-list)))
+ (setq prev cur)
+ (setq cur (cdr cur)))
+ (when prev
+ (setcdr prev nil)
+ (setq l2-list (car cur)))
+ (setq l1-item-leading-text l1-item-contents))
+ ;; Level-1 items start a table row.
+ (apply 'org-element-adopt-elements
+ (list 'table-row (list :type 'standard))
+ ;; Leading text of level-1 item define
+ ;; the first table-cell.
+ (apply 'org-element-adopt-elements
+ (list 'table-cell nil)
+ l1-item-leading-text)
+ ;; Level-2 items define subsequent
+ ;; table-cells of the row.
+ (org-element-map l2-list 'item
+ (lambda (l2-item)
+ (apply 'org-element-adopt-elements
+ (list 'table-cell nil)
+ (org-element-contents l2-item)))
+ info nil 'item))))
+ info nil 'item))))
+ nil)
+ info)
tree)
;;; Interactive functions
-(defun org-e-odt-create-manifest-file-entry (&rest args)
- (push args org-e-odt-manifest-file-entries))
+(defun org-odt-create-manifest-file-entry (&rest args)
+ (push args org-odt-manifest-file-entries))
-(defun org-e-odt-write-manifest-file ()
- (make-directory (concat org-e-odt-zip-dir "META-INF"))
- (let ((manifest-file (concat org-e-odt-zip-dir "META-INF/manifest.xml")))
+(defun org-odt-write-manifest-file ()
+ (make-directory (concat org-odt-zip-dir "META-INF"))
+ (let ((manifest-file (concat org-odt-zip-dir "META-INF/manifest.xml")))
(with-current-buffer
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect manifest-file t))
@@ -3984,36 +4000,36 @@ contextual information."
(extra (if (not version) ""
(format " manifest:version=\"%s\"" version))))
(insert
- (format org-e-odt-manifest-file-entry-tag
+ (format org-odt-manifest-file-entry-tag
(nth 0 file-entry) (nth 1 file-entry) extra))))
- org-e-odt-manifest-file-entries)
+ org-odt-manifest-file-entries)
(insert "\n</manifest:manifest>"))))
-(defmacro org-e-odt--export-wrap (out-file &rest body)
+(defmacro org-odt--export-wrap (out-file &rest body)
`(let* ((--out-file ,out-file)
(out-file-type (file-name-extension --out-file))
- (org-e-odt-xml-files '("META-INF/manifest.xml" "content.xml"
+ (org-odt-xml-files '("META-INF/manifest.xml" "content.xml"
"meta.xml" "styles.xml"))
;; Initialize temporary workarea. All files that end up in
;; the exported document get parked/created here.
- (org-e-odt-zip-dir (file-name-as-directory
+ (org-odt-zip-dir (file-name-as-directory
(make-temp-file (format "%s-" out-file-type) t)))
- (org-e-odt-manifest-file-entries nil)
+ (org-odt-manifest-file-entries nil)
(--cleanup-xml-buffers
(function
(lambda nil
;; Kill all XML buffers.
(mapc (lambda (file)
(let ((buf (find-buffer-visiting
- (concat org-e-odt-zip-dir file))))
+ (concat org-odt-zip-dir file))))
(when buf
(with-current-buffer buf
(set-buffer-modified-p nil)
(kill-buffer buf)))))
- org-e-odt-xml-files)
+ org-odt-xml-files)
;; Delete temporary directory and also other embedded
;; files that get copied there.
- (delete-directory org-e-odt-zip-dir t)))))
+ (delete-directory org-odt-zip-dir t)))))
(condition-case err
(progn
(unless (executable-find "zip")
@@ -4023,7 +4039,7 @@ contextual information."
;; saved and zipped.
(progn ,@body)
;; Create a manifest entry for content.xml.
- (org-e-odt-create-manifest-file-entry "text/xml" "content.xml")
+ (org-odt-create-manifest-file-entry "text/xml" "content.xml")
;; Write mimetype file
(let* ((mimetypes
'(("odt" . "application/vnd.oasis.opendocument.text")
@@ -4031,21 +4047,21 @@ contextual information."
(mimetype (cdr (assoc-string out-file-type mimetypes t))))
(unless mimetype
(error "Unknown OpenDocument backend %S" out-file-type))
- (write-region mimetype nil (concat org-e-odt-zip-dir "mimetype"))
- (org-e-odt-create-manifest-file-entry mimetype "/" "1.2"))
+ (write-region mimetype nil (concat org-odt-zip-dir "mimetype"))
+ (org-odt-create-manifest-file-entry mimetype "/" "1.2"))
;; Write out the manifest entries before zipping
- (org-e-odt-write-manifest-file)
+ (org-odt-write-manifest-file)
;; Save all XML files.
(mapc (lambda (file)
(let ((buf (find-buffer-visiting
- (concat org-e-odt-zip-dir file))))
+ (concat org-odt-zip-dir file))))
(when buf
(with-current-buffer buf
;; Prettify output if needed.
- (when org-e-odt-prettify-xml
+ (when org-odt-prettify-xml
(indent-region (point-min) (point-max)))
(save-buffer 0)))))
- org-e-odt-xml-files)
+ org-odt-xml-files)
;; Run zip.
(let* ((target --out-file)
(target-name (file-name-nondirectory target))
@@ -4059,10 +4075,10 @@ contextual information."
(let ((coding-system-for-write 'no-conversion) exitcode err-string)
(message "Creating ODT file...")
;; Switch temporarily to content.xml. This way Zip
- ;; process will inherit `org-e-odt-zip-dir' as the current
+ ;; process will inherit `org-odt-zip-dir' as the current
;; directory.
(with-current-buffer
- (find-file-noselect (concat org-e-odt-zip-dir "content.xml") t)
+ (find-file-noselect (concat org-odt-zip-dir "content.xml") t)
(mapc
(lambda (cmd)
(message "Running %s" (mapconcat 'identity cmd " "))
@@ -4078,7 +4094,7 @@ contextual information."
cmds)))
;; Move the zip file from temporary work directory to
;; user-mandated location.
- (rename-file (concat org-e-odt-zip-dir target-name) target)
+ (rename-file (concat org-odt-zip-dir target-name) target)
(message "Created %s" (expand-file-name target))
;; Cleanup work directory and work files.
(funcall --cleanup-xml-buffers)
@@ -4090,8 +4106,8 @@ contextual information."
;; Case 1: Conversion desired on exported file. Run the
;; converter on the OpenDocument file. Return the
;; converted file.
- (org-e-odt-preferred-output-format
- (or (org-e-odt-convert target org-e-odt-preferred-output-format)
+ (org-odt-preferred-output-format
+ (or (org-odt-convert target org-odt-preferred-output-format)
target))
;; Case 2: No further conversion. Return exported
;; OpenDocument file.
@@ -4106,7 +4122,7 @@ contextual information."
;;;; Export to OpenDocument formula
;;;###autoload
-(defun org-e-odt-export-as-odf (latex-frag &optional odf-file)
+(defun org-odt-export-as-odf (latex-frag &optional odf-file)
"Export LATEX-FRAG as OpenDocument formula file ODF-FILE.
Use `org-create-math-formula' to convert LATEX-FRAG first to
MathML. When invoked as an interactive command, use
@@ -4138,12 +4154,12 @@ non-nil."
(or (file-name-nondirectory buffer-file-name)))
"." "odf")
(file-name-directory buffer-file-name)))))
- (org-e-odt--export-wrap
+ (org-odt--export-wrap
filename
(let* ((buffer (progn
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
- (find-file-noselect (concat org-e-odt-zip-dir
+ (find-file-noselect (concat org-odt-zip-dir
"content.xml") t))))
(coding-system-for-write 'utf-8)
(save-buffer-coding-system 'utf-8))
@@ -4157,18 +4173,18 @@ non-nil."
(org-kill-new (buffer-string))))))))
;;;###autoload
-(defun org-e-odt-export-as-odf-and-open ()
+(defun org-odt-export-as-odf-and-open ()
"Export LaTeX fragment as OpenDocument formula and immediately open it.
-Use `org-e-odt-export-as-odf' to read LaTeX fragment and OpenDocument
+Use `org-odt-export-as-odf' to read LaTeX fragment and OpenDocument
formula file."
(interactive)
- (org-open-file (call-interactively 'org-e-odt-export-as-odf) 'system))
+ (org-open-file (call-interactively 'org-odt-export-as-odf) 'system))
;;;; Export to OpenDocument Text
;;;###autoload
-(defun org-e-odt-export-to-odt (&optional async subtreep visible-only ext-plist)
+(defun org-odt-export-to-odt (&optional async subtreep visible-only ext-plist)
"Export current buffer to a ODT file.
If narrowing is active in the current buffer, only export its
@@ -4195,14 +4211,14 @@ Return output file's name."
(interactive)
(let ((outfile (org-export-output-file-name ".odt" subtreep)))
(if async
- (org-export-async-start (lambda (f) (org-export-add-to-stack f 'e-odt))
+ (org-export-async-start (lambda (f) (org-export-add-to-stack f 'odt))
`(expand-file-name
- (org-e-odt--export-wrap
+ (org-odt--export-wrap
,outfile
- (let* ((org-e-odt-embedded-images-count 0)
- (org-e-odt-embedded-formulas-count 0)
- (org-e-odt-automatic-styles nil)
- (org-e-odt-object-counters nil)
+ (let* ((org-odt-embedded-images-count 0)
+ (org-odt-embedded-formulas-count 0)
+ (org-odt-automatic-styles nil)
+ (org-odt-object-counters nil)
;; Let `htmlfontify' know that we are interested in
;; collecting styles.
(hfy-user-sheet-assoc nil))
@@ -4213,15 +4229,15 @@ Return output file's name."
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect
- (concat org-e-odt-zip-dir "content.xml") t)))))
+ (concat org-odt-zip-dir "content.xml") t)))))
(org-export-to-buffer
- 'e-odt out-buf ,subtreep ,visible-only nil ',ext-plist))))))
- (org-e-odt--export-wrap
+ 'odt out-buf ,subtreep ,visible-only nil ',ext-plist))))))
+ (org-odt--export-wrap
outfile
- (let* ((org-e-odt-embedded-images-count 0)
- (org-e-odt-embedded-formulas-count 0)
- (org-e-odt-automatic-styles nil)
- (org-e-odt-object-counters nil)
+ (let* ((org-odt-embedded-images-count 0)
+ (org-odt-embedded-formulas-count 0)
+ (org-odt-automatic-styles nil)
+ (org-odt-object-counters nil)
;; Let `htmlfontify' know that we are interested in collecting
;; styles.
(hfy-user-sheet-assoc nil))
@@ -4230,31 +4246,31 @@ Return output file's name."
(require 'nxml-mode)
(let ((nxml-auto-insert-xml-declaration-flag nil))
(find-file-noselect
- (concat org-e-odt-zip-dir "content.xml") t)))))
+ (concat org-odt-zip-dir "content.xml") t)))))
(org-export-to-buffer
- 'e-odt out-buf subtreep visible-only nil ext-plist)))))))
+ 'odt out-buf subtreep visible-only nil ext-plist)))))))
;;;; Convert between OpenDocument and other formats
-(defun org-e-odt-reachable-p (in-fmt out-fmt)
+(defun org-odt-reachable-p (in-fmt out-fmt)
"Return non-nil if IN-FMT can be converted to OUT-FMT."
(catch 'done
- (let ((reachable-formats (org-e-odt-do-reachable-formats in-fmt)))
+ (let ((reachable-formats (org-odt-do-reachable-formats in-fmt)))
(dolist (e reachable-formats)
(let ((out-fmt-spec (assoc out-fmt (cdr e))))
(when out-fmt-spec
(throw 'done (cons (car e) out-fmt-spec))))))))
-(defun org-e-odt-do-convert (in-file out-fmt &optional prefix-arg)
- "Workhorse routine for `org-e-odt-convert'."
+(defun org-odt-do-convert (in-file out-fmt &optional prefix-arg)
+ "Workhorse routine for `org-odt-convert'."
(require 'browse-url)
(let* ((in-file (expand-file-name (or in-file buffer-file-name)))
(dummy (or (file-readable-p in-file)
(error "Cannot read %s" in-file)))
(in-fmt (file-name-extension in-file))
(out-fmt (or out-fmt (error "Output format unspecified")))
- (how (or (org-e-odt-reachable-p in-fmt out-fmt)
+ (how (or (org-odt-reachable-p in-fmt out-fmt)
(error "Cannot convert from %s format to %s format?"
in-fmt out-fmt)))
(convert-process (car how))
@@ -4289,21 +4305,21 @@ Return output file's name."
(message "Export to %s failed" out-file)
nil))))
-(defun org-e-odt-do-reachable-formats (in-fmt)
+(defun org-odt-do-reachable-formats (in-fmt)
"Return verbose info about formats to which IN-FMT can be converted.
Return a list where each element is of the
form (CONVERTER-PROCESS . OUTPUT-FMT-ALIST). See
-`org-e-odt-convert-processes' for CONVERTER-PROCESS and see
-`org-e-odt-convert-capabilities' for OUTPUT-FMT-ALIST."
+`org-odt-convert-processes' for CONVERTER-PROCESS and see
+`org-odt-convert-capabilities' for OUTPUT-FMT-ALIST."
(let* ((converter
- (and org-e-odt-convert-process
- (cadr (assoc-string org-e-odt-convert-process
- org-e-odt-convert-processes t))))
+ (and org-odt-convert-process
+ (cadr (assoc-string org-odt-convert-process
+ org-odt-convert-processes t))))
(capabilities
- (and org-e-odt-convert-process
- (cadr (assoc-string org-e-odt-convert-process
- org-e-odt-convert-processes t))
- org-e-odt-convert-capabilities))
+ (and org-odt-convert-process
+ (cadr (assoc-string org-odt-convert-process
+ org-odt-convert-processes t))
+ org-odt-convert-capabilities))
reachable-formats)
(when converter
(dolist (c capabilities)
@@ -4311,24 +4327,24 @@ form (CONVERTER-PROCESS . OUTPUT-FMT-ALIST). See
(push (cons converter (nth 2 c)) reachable-formats))))
reachable-formats))
-(defun org-e-odt-reachable-formats (in-fmt)
+(defun org-odt-reachable-formats (in-fmt)
"Return list of formats to which IN-FMT can be converted.
The list of the form (OUTPUT-FMT-1 OUTPUT-FMT-2 ...)."
(let (l)
(mapc (lambda (e) (add-to-list 'l e))
(apply 'append (mapcar
(lambda (e) (mapcar 'car (cdr e)))
- (org-e-odt-do-reachable-formats in-fmt))))
+ (org-odt-do-reachable-formats in-fmt))))
l))
-(defun org-e-odt-convert-read-params ()
- "Return IN-FILE and OUT-FMT params for `org-e-odt-do-convert'.
+(defun org-odt-convert-read-params ()
+ "Return IN-FILE and OUT-FMT params for `org-odt-do-convert'.
This is a helper routine for interactive use."
(let* ((input (if (featurep 'ido) 'ido-completing-read 'completing-read))
(in-file (read-file-name "File to be converted: "
nil buffer-file-name t))
(in-fmt (file-name-extension in-file))
- (out-fmt-choices (org-e-odt-reachable-formats in-fmt))
+ (out-fmt-choices (org-odt-reachable-formats in-fmt))
(out-fmt
(or (and out-fmt-choices
(funcall input "Output format: "
@@ -4339,16 +4355,16 @@ This is a helper routine for interactive use."
(list in-file out-fmt)))
;;;###autoload
-(defun org-e-odt-convert (&optional in-file out-fmt prefix-arg)
+(defun org-odt-convert (&optional in-file out-fmt prefix-arg)
"Convert IN-FILE to format OUT-FMT using a command line converter.
IN-FILE is the file to be converted. If unspecified, it defaults
to variable `buffer-file-name'. OUT-FMT is the desired output
-format. Use `org-e-odt-convert-process' as the converter.
+format. Use `org-odt-convert-process' as the converter.
If PREFIX-ARG is non-nil then the newly converted file is opened
using `org-open-file'."
(interactive
- (append (org-e-odt-convert-read-params) current-prefix-arg))
- (org-e-odt-do-convert in-file out-fmt prefix-arg))
+ (append (org-odt-convert-read-params) current-prefix-arg))
+ (org-odt-do-convert in-file out-fmt prefix-arg))
;;; Library Initializations
@@ -4357,8 +4373,12 @@ using `org-open-file'."
;; Let Emacs open all OpenDocument files in archive mode
(add-to-list 'auto-mode-alist
(cons (concat "\\." (car desc) "\\'") 'archive-mode)))
- org-e-odt-file-extensions)
+ org-odt-file-extensions)
+
+(provide 'ox-odt)
-(provide 'org-e-odt)
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
-;;; org-e-odt.el ends here
+;;; ox-odt.el ends here
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
new file mode 100644
index 0000000..6b33bcf
--- /dev/null
+++ b/lisp/ox-org.el
@@ -0,0 +1,114 @@
+;;; ox-org.el --- Org Back-End for Org Export Engine
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
+;; Keywords: org, wp
+
+;; 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:
+
+;; This library implements an Org back-end for Org exporter. Since
+;; its usage is mainly internal, it doesn't provide any interactive
+;; function.
+
+;;; Code:
+(require 'ox)
+
+(org-export-define-backend org
+ ((babel-call . org-org-identity)
+ (bold . org-org-identity)
+ (center-block . org-org-identity)
+ (clock . org-org-identity)
+ (code . org-org-identity)
+ (diary-sexp . org-org-identity)
+ (drawer . org-org-identity)
+ (dynamic-block . org-org-identity)
+ (entity . org-org-identity)
+ (example-block . org-org-identity)
+ (fixed-width . org-org-identity)
+ (footnote-definition . org-org-identity)
+ (footnote-reference . org-org-identity)
+ (headline . org-org-headline)
+ (horizontal-rule . org-org-identity)
+ (inline-babel-call . org-org-identity)
+ (inline-src-block . org-org-identity)
+ (inlinetask . org-org-identity)
+ (italic . org-org-identity)
+ (item . org-org-identity)
+ (keyword . org-org-keyword)
+ (latex-environment . org-org-identity)
+ (latex-fragment . org-org-identity)
+ (line-break . org-org-identity)
+ (link . org-org-identity)
+ (node-property . org-org-identity)
+ (paragraph . org-org-identity)
+ (plain-list . org-org-identity)
+ (planning . org-org-identity)
+ (property-drawer . org-org-identity)
+ (quote-block . org-org-identity)
+ (quote-section . org-org-identity)
+ (radio-target . org-org-identity)
+ (section . org-org-identity)
+ (special-block . org-org-identity)
+ (src-block . org-org-identity)
+ (statistics-cookie . org-org-identity)
+ (strike-through . org-org-identity)
+ (subscript . org-org-identity)
+ (superscript . org-org-identity)
+ (table . org-org-identity)
+ (table-cell . org-org-identity)
+ (table-row . org-org-identity)
+ (target . org-org-identity)
+ (timestamp . org-org-identity)
+ (underline . org-org-identity)
+ (verbatim . org-org-identity)
+ (verse-block . org-org-identity)))
+
+(defun org-org-identity (blob contents info)
+ "Transcode BLOB element or object back into Org syntax."
+ (funcall
+ (intern (format "org-element-%s-interpreter" (org-element-type blob)))
+ blob contents))
+
+(defun org-org-headline (headline contents info)
+ "Transcode HEADLINE element back into Org syntax."
+ (unless (plist-get info :with-todo-keywords)
+ (org-element-put-property headline :todo-keyword nil))
+ (unless (plist-get info :with-tags)
+ (org-element-put-property headline :tags nil))
+ (unless (plist-get info :with-priority)
+ (org-element-put-property headline :priority nil))
+ (org-element-headline-interpreter headline contents))
+
+(defun org-org-keyword (keyword contents info)
+ "Transcode KEYWORD element back into Org syntax.
+Ignore keywords targeted at other export back-ends."
+ (unless (member (org-element-property :key keyword)
+ (mapcar
+ (lambda (block-cons)
+ (and (eq (cdr block-cons) 'org-element-export-block-parser)
+ (car block-cons)))
+ org-element-block-name-alist))
+ (org-element-keyword-interpreter keyword nil)))
+
+
+(provide 'ox-org)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-org.el ends here
diff --git a/contrib/lisp/org-e-publish.el b/lisp/ox-publish.el
index 3b6d5c3..8918d8e 100644
--- a/contrib/lisp/org-e-publish.el
+++ b/lisp/ox-publish.el
@@ -1,4 +1,4 @@
-;;; org-e-publish.el --- publish related org-mode files as a website
+;;; ox-publish.el --- Publish Related Org Mode Files as a Website
;; Copyright (C) 2006-2013 Free Software Foundation, Inc.
;; Author: David O'Toole <dto@gnu.org>
@@ -25,9 +25,9 @@
;; This program allow configurable publishing of related sets of
;; Org mode files as a complete website.
;;
-;; org-e-publish.el can do the following:
+;; ox-publish.el can do the following:
;;
-;; + Publish all one's Org files to HTML or PDF
+;; + Publish all one's Org files to a given export back-end
;; + Upload HTML, images, attachments and other files to a web server
;; + Exclude selected private pages from publishing
;; + Publish a clickable sitemap of pages
@@ -40,26 +40,26 @@
(eval-when-compile (require 'cl))
(require 'format-spec)
-(require 'org-export)
+(require 'ox)
;;; Variables
-(defvar org-e-publish-temp-files nil
+(defvar org-publish-temp-files nil
"Temporary list of files to be published.")
;; Here, so you find the variable right before it's used the first time:
-(defvar org-e-publish-cache nil
+(defvar org-publish-cache nil
"This will cache timestamps and titles for files in publishing projects.
Blocks could hash sha1 values here.")
-(defgroup org-e-publish nil
+(defgroup org-publish nil
"Options for publishing a set of Org-mode and related files."
:tag "Org Publishing"
:group 'org)
-(defcustom org-e-publish-project-alist nil
+(defcustom org-publish-project-alist nil
"Association list to control publishing behavior.
Each element of the alist is a publishing 'project.' The CAR of
each element is a string, uniquely identifying the project. The
@@ -76,15 +76,15 @@ CDR of each element is in one of the following forms:
\(:components \(\"project-1\" \"project-2\" ...))
-When the CDR of an element of org-e-publish-project-alist is in
+When the CDR of an element of org-publish-project-alist is in
this second form, the elements of the list after `:components'
are taken to be components of the project, which group together
files requiring different publishing options. When you publish
-such a project with \\[org-e-publish], the components all
+such a project with \\[org-publish], the components all
publish.
When a property is given a value in
-`org-e-publish-project-alist', its setting overrides the value of
+`org-publish-project-alist', its setting overrides the value of
the corresponding user variable \(if any) during publishing.
However, options set within a file override everything.
@@ -118,14 +118,14 @@ the exclusion step happens first.
One special property controls which back-end function to use for
publishing files in the project. This can be used to extend the
-set of file types publishable by `org-e-publish', as well as the
+set of file types publishable by `org-publish', as well as the
set of output formats.
`:publishing-function'
Function to publish file. Each back-end may define its
- own (i.e. `org-e-latex-publish-to-pdf',
- `org-e-html-publish-to-html'). May be a list of functions,
+ own (i.e. `org-latex-publish-to-pdf',
+ `org-html-publish-to-html'). May be a list of functions,
in which case each function in the list is invoked in turn.
Another property allows you to insert code that prepares
@@ -148,34 +148,39 @@ and are equivalent to the corresponding user variables listed in
the right column. Back-end specific properties may also be
included. See the back-end documentation for more information.
- :author `user-full-name'
- :creator `org-export-creator-string'
- :email `user-mail-address'
- :exclude-tags `org-export-exclude-tags'
- :headline-levels `org-export-headline-levels'
- :language `org-export-default-language'
- :preserve-breaks `org-export-preserve-breaks'
- :section-numbers `org-export-with-section-numbers'
- :select-tags `org-export-select-tags'
- :time-stamp-file `org-export-time-stamp-file'
- :with-archived-trees `org-export-with-archived-trees'
- :with-author `org-export-with-author'
- :with-creator `org-export-with-creator'
- :with-drawers `org-export-with-drawers'
- :with-email `org-export-with-email'
- :with-emphasize `org-export-with-emphasize'
- :with-entities `org-export-with-entities'
- :with-fixed-width `org-export-with-fixed-width'
- :with-footnotes `org-export-with-footnotes'
- :with-priority `org-export-with-priority'
- :with-special-strings `org-export-with-special-strings'
- :with-sub-superscript `org-export-with-sub-superscripts'
- :with-toc `org-export-with-toc'
- :with-tables `org-export-with-tables'
- :with-tags `org-export-with-tags'
- :with-tasks `org-export-with-tasks'
- :with-timestamps `org-export-with-timestamps'
- :with-todo-keywords `org-export-with-todo-keywords'
+ :author `user-full-name'
+ :creator `org-export-creator-string'
+ :email `user-mail-address'
+ :exclude-tags `org-export-exclude-tags'
+ :headline-levels `org-export-headline-levels'
+ :language `org-export-default-language'
+ :preserve-breaks `org-export-preserve-breaks'
+ :section-numbers `org-export-with-section-numbers'
+ :select-tags `org-export-select-tags'
+ :time-stamp-file `org-export-time-stamp-file'
+ :with-archived-trees `org-export-with-archived-trees'
+ :with-author `org-export-with-author'
+ :with-creator `org-export-with-creator'
+ :with-date `org-export-with-date'
+ :with-drawers `org-export-with-drawers'
+ :with-email `org-export-with-email'
+ :with-emphasize `org-export-with-emphasize'
+ :with-entities `org-export-with-entities'
+ :with-fixed-width `org-export-with-fixed-width'
+ :with-footnotes `org-export-with-footnotes'
+ :with-inlinetasks `org-export-with-inlinetasks'
+ :with-latex `org-export-with-latex'
+ :with-priority `org-export-with-priority'
+ :with-smart-quotes `org-export-with-smart-quotes'
+ :with-special-strings `org-export-with-special-strings'
+ :with-statistics-cookies' `org-export-with-statistics-cookies'
+ :with-sub-superscript `org-export-with-sub-superscripts'
+ :with-toc `org-export-with-toc'
+ :with-tables `org-export-with-tables'
+ :with-tags `org-export-with-tags'
+ :with-tasks `org-export-with-tasks'
+ :with-timestamps `org-export-with-timestamps'
+ :with-todo-keywords `org-export-with-todo-keywords'
The following properties may be used to control publishing of
a site-map of files or summary page for a given project.
@@ -183,7 +188,7 @@ a site-map of files or summary page for a given project.
`:auto-sitemap'
Whether to publish a site-map during
- `org-e-publish-current-project' or `org-e-publish-all'.
+ `org-publish-current-project' or `org-publish-all'.
`:sitemap-filename'
@@ -196,7 +201,7 @@ a site-map of files or summary page for a given project.
`:sitemap-function'
Plugin function to use for generation of site-map. Defaults to
- `org-e-publish-org-sitemap', which generates a plain list of
+ `org-publish-org-sitemap', which generates a plain list of
links to all files in the project.
`:sitemap-style'
@@ -242,27 +247,27 @@ Other properties affecting publication.
`:body-only'
Set this to t to publish only the body of the documents."
- :group 'org-e-publish
+ :group 'org-export-publish
:type 'alist)
-(defcustom org-e-publish-use-timestamps-flag t
+(defcustom org-publish-use-timestamps-flag t
"Non-nil means use timestamp checking to publish only changed files.
When nil, do no timestamp checking and always publish all files."
- :group 'org-e-publish
+ :group 'org-export-publish
:type 'boolean)
-(defcustom org-e-publish-timestamp-directory
+(defcustom org-publish-timestamp-directory
(convert-standard-filename "~/.org-timestamps/")
"Name of directory in which to store publishing timestamps."
- :group 'org-e-publish
+ :group 'org-export-publish
:type 'directory)
-(defcustom org-e-publish-list-skipped-files t
+(defcustom org-publish-list-skipped-files t
"Non-nil means show message about files *not* published."
- :group 'org-e-publish
+ :group 'org-export-publish
:type 'boolean)
-(defcustom org-e-publish-sitemap-sort-files 'alphabetically
+(defcustom org-publish-sitemap-sort-files 'alphabetically
"Method to sort files in site-maps.
Possible values are `alphabetically', `chronologically',
`anti-chronologically' and nil.
@@ -273,11 +278,11 @@ time first. If `anti-chronologically', files will be sorted with
newer modification time first. nil won't sort files.
You can overwrite this default per project in your
-`org-e-publish-project-alist', using `:sitemap-sort-files'."
- :group 'org-e-publish
+`org-publish-project-alist', using `:sitemap-sort-files'."
+ :group 'org-export-publish
:type 'symbol)
-(defcustom org-e-publish-sitemap-sort-folders 'first
+(defcustom org-publish-sitemap-sort-folders 'first
"A symbol, denoting if folders are sorted first in sitemaps.
Possible values are `first', `last', and nil.
If `first', folders will be sorted before files.
@@ -285,32 +290,32 @@ If `last', folders are sorted to the end after the files.
Any other value will not mix files and folders.
You can overwrite this default per project in your
-`org-e-publish-project-alist', using `:sitemap-sort-folders'."
- :group 'org-e-publish
+`org-publish-project-alist', using `:sitemap-sort-folders'."
+ :group 'org-export-publish
:type 'symbol)
-(defcustom org-e-publish-sitemap-sort-ignore-case nil
+(defcustom org-publish-sitemap-sort-ignore-case nil
"Non-nil when site-map sorting should ignore case.
You can overwrite this default per project in your
-`org-e-publish-project-alist', using `:sitemap-ignore-case'."
- :group 'org-e-publish
+`org-publish-project-alist', using `:sitemap-ignore-case'."
+ :group 'org-export-publish
:type 'boolean)
-(defcustom org-e-publish-sitemap-date-format "%Y-%m-%d"
+(defcustom org-publish-sitemap-date-format "%Y-%m-%d"
"Format for `format-time-string' which is used to print a date
in the sitemap."
- :group 'org-e-publish
+ :group 'org-export-publish
:type 'string)
-(defcustom org-e-publish-sitemap-file-entry-format "%t"
+(defcustom org-publish-sitemap-file-entry-format "%t"
"Format string for site-map file entry.
You could use brackets to delimit on what part the link will be.
%t is the title.
%a is the author.
-%d is the date formatted using `org-e-publish-sitemap-date-format'."
- :group 'org-e-publish
+%d is the date formatted using `org-publish-sitemap-date-format'."
+ :group 'org-export-publish
:type 'string)
@@ -318,13 +323,13 @@ You could use brackets to delimit on what part the link will be.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Timestamp-related functions
-(defun org-e-publish-timestamp-filename (filename &optional pub-dir pub-func)
+(defun org-publish-timestamp-filename (filename &optional pub-dir pub-func)
"Return path to timestamp file for filename FILENAME."
(setq filename (concat filename "::" (or pub-dir "") "::"
(format "%s" (or pub-func ""))))
(concat "X" (if (fboundp 'sha1) (sha1 filename) (md5 filename))))
-(defun org-e-publish-needed-p
+(defun org-publish-needed-p
(filename &optional pub-dir pub-func true-pub-dir base-dir)
"Non-nil if FILENAME should be published in PUB-DIR using PUB-FUNC.
TRUE-PUB-DIR is where the file will truly end up. Currently we
@@ -333,43 +338,43 @@ the file is present at the target location, and how old it is.
Right now we cannot do this, because we do not know under what
file name the file will be stored - the publishing function can
still decide about that independently."
- (let ((rtn (if (not org-e-publish-use-timestamps-flag) t
- (org-e-publish-cache-file-needs-publishing
+ (let ((rtn (if (not org-publish-use-timestamps-flag) t
+ (org-publish-cache-file-needs-publishing
filename pub-dir pub-func base-dir))))
(if rtn (message "Publishing file %s using `%s'" filename pub-func)
- (when org-e-publish-list-skipped-files
+ (when org-publish-list-skipped-files
(message "Skipping unmodified file %s" filename)))
rtn))
-(defun org-e-publish-update-timestamp
+(defun org-publish-update-timestamp
(filename &optional pub-dir pub-func base-dir)
"Update publishing timestamp for file FILENAME.
If there is no timestamp, create one."
- (let ((key (org-e-publish-timestamp-filename filename pub-dir pub-func))
- (stamp (org-e-publish-cache-ctime-of-src filename)))
- (org-e-publish-cache-set key stamp)))
+ (let ((key (org-publish-timestamp-filename filename pub-dir pub-func))
+ (stamp (org-publish-cache-ctime-of-src filename)))
+ (org-publish-cache-set key stamp)))
-(defun org-e-publish-remove-all-timestamps ()
+(defun org-publish-remove-all-timestamps ()
"Remove all files in the timestamp directory."
- (let ((dir org-e-publish-timestamp-directory)
+ (let ((dir org-publish-timestamp-directory)
files)
(when (and (file-exists-p dir) (file-directory-p dir))
(mapc 'delete-file (directory-files dir 'full "[^.]\\'"))
- (org-e-publish-reset-cache))))
+ (org-publish-reset-cache))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Getting project information out of `org-e-publish-project-alist'
+;;; Getting project information out of `org-publish-project-alist'
-(defun org-e-publish-expand-projects (projects-alist)
+(defun org-publish-expand-projects (projects-alist)
"Expand projects in PROJECTS-ALIST.
This splices all the components into the list."
(let ((rest projects-alist) rtn p components)
(while (setq p (pop rest))
(if (setq components (plist-get (cdr p) :components))
(setq rest (append
- (mapcar (lambda (x) (assoc x org-e-publish-project-alist))
+ (mapcar (lambda (x) (assoc x org-publish-project-alist))
components)
rest))
(push p rtn)))
@@ -381,7 +386,7 @@ This splices all the components into the list."
(defvar org-sitemap-requested)
(defvar org-sitemap-date-format)
(defvar org-sitemap-file-entry-format)
-(defun org-e-publish-compare-directory-files (a b)
+(defun org-publish-compare-directory-files (a b)
"Predicate for `sort', that sorts folders and files for sitemap."
(let ((retval t))
(when (or org-sitemap-sort-files org-sitemap-sort-folders)
@@ -394,15 +399,15 @@ This splices all the components into the list."
(bdir (file-directory-p b))
(borg (and (string-match "\\.org$" b) (not bdir)))
(A (if aorg (concat (file-name-directory a)
- (org-e-publish-find-title a)) a))
+ (org-publish-find-title a)) a))
(B (if borg (concat (file-name-directory b)
- (org-e-publish-find-title b)) b)))
+ (org-publish-find-title b)) b)))
(setq retval (if org-sitemap-ignore-case
(not (string-lessp (upcase B) (upcase A)))
(not (string-lessp B A))))))
((anti-chronologically chronologically)
- (let* ((adate (org-e-publish-find-date a))
- (bdate (org-e-publish-find-date b))
+ (let* ((adate (org-publish-find-date a))
+ (bdate (org-publish-find-date b))
(A (+ (lsh (car adate) 16) (cadr adate)))
(B (+ (lsh (car bdate) 16) (cadr bdate))))
(setq retval
@@ -419,9 +424,9 @@ This splices all the components into the list."
(setq retval (equal org-sitemap-sort-folders 'last))))))
retval))
-(defun org-e-publish-get-base-files-1
+(defun org-publish-get-base-files-1
(base-dir &optional recurse match skip-file skip-dir)
- "Set `org-e-publish-temp-files' with files from BASE-DIR directory.
+ "Set `org-publish-temp-files' with files from BASE-DIR directory.
If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is
non-nil, restrict this list to the files matching the regexp
MATCH. If SKIP-FILE is non-nil, skip file matching the regexp
@@ -433,20 +438,20 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR."
(if (and fd-p recurse
(not (string-match "^\\.+$" fnd))
(if skip-dir (not (string-match skip-dir fnd)) t))
- (org-e-publish-get-base-files-1
+ (org-publish-get-base-files-1
f recurse match skip-file skip-dir)
(unless (or fd-p ;; this is a directory
(and skip-file (string-match skip-file fnd))
(not (file-exists-p (file-truename f)))
(not (string-match match fnd)))
- (pushnew f org-e-publish-temp-files)))))
+ (pushnew f org-publish-temp-files)))))
(if org-sitemap-requested
(sort (directory-files base-dir t (unless recurse match))
- 'org-e-publish-compare-directory-files)
+ 'org-publish-compare-directory-files)
(directory-files base-dir t (unless recurse match)))))
-(defun org-e-publish-get-base-files (project &optional exclude-regexp)
+(defun org-publish-get-base-files (project &optional exclude-regexp)
"Return a list of all files in PROJECT.
If EXCLUDE-REGEXP is set, this will be used to filter out
matching filenames."
@@ -457,7 +462,7 @@ matching filenames."
(recurse (plist-get project-plist :recursive))
(extension (or (plist-get project-plist :base-extension) "org"))
;; sitemap-... variables are dynamically scoped for
- ;; org-e-publish-compare-directory-files:
+ ;; org-publish-compare-directory-files:
(org-sitemap-requested
(plist-get project-plist :auto-sitemap))
(sitemap-filename
@@ -465,7 +470,7 @@ matching filenames."
(org-sitemap-sort-folders
(if (plist-member project-plist :sitemap-sort-folders)
(plist-get project-plist :sitemap-sort-folders)
- org-e-publish-sitemap-sort-folders))
+ org-publish-sitemap-sort-folders))
(org-sitemap-sort-files
(cond ((plist-member project-plist :sitemap-sort-files)
(plist-get project-plist :sitemap-sort-files))
@@ -473,39 +478,39 @@ matching filenames."
((plist-member project-plist :sitemap-alphabetically)
(if (plist-get project-plist :sitemap-alphabetically)
'alphabetically nil))
- (t org-e-publish-sitemap-sort-files)))
+ (t org-publish-sitemap-sort-files)))
(org-sitemap-ignore-case
(if (plist-member project-plist :sitemap-ignore-case)
(plist-get project-plist :sitemap-ignore-case)
- org-e-publish-sitemap-sort-ignore-case))
+ org-publish-sitemap-sort-ignore-case))
(match (if (eq extension 'any) "^[^\\.]"
(concat "^[^\\.].*\\.\\(" extension "\\)$"))))
;; Make sure `org-sitemap-sort-folders' has an accepted value
(unless (memq org-sitemap-sort-folders '(first last))
(setq org-sitemap-sort-folders nil))
- (setq org-e-publish-temp-files nil)
+ (setq org-publish-temp-files nil)
(if org-sitemap-requested
(pushnew (expand-file-name (concat base-dir sitemap-filename))
- org-e-publish-temp-files))
- (org-e-publish-get-base-files-1 base-dir recurse match
+ org-publish-temp-files))
+ (org-publish-get-base-files-1 base-dir recurse match
;; FIXME distinguish exclude regexp
;; for skip-file and skip-dir?
exclude-regexp exclude-regexp)
(mapc (lambda (f)
(pushnew
(expand-file-name (concat base-dir f))
- org-e-publish-temp-files))
+ org-publish-temp-files))
include-list)
- org-e-publish-temp-files))
+ org-publish-temp-files))
-(defun org-e-publish-get-project-from-filename (filename &optional up)
+(defun org-publish-get-project-from-filename (filename &optional up)
"Return the project that FILENAME belongs to."
(let* ((filename (expand-file-name filename))
project-name)
(catch 'p-found
- (dolist (prj org-e-publish-project-alist)
+ (dolist (prj org-publish-project-alist)
(unless (plist-get (cdr prj) :components)
;; [[info:org:Selecting%20files]] shows how this is supposed to work:
(let* ((r (plist-get (cdr prj) :recursive))
@@ -526,17 +531,17 @@ matching filenames."
(setq project-name (car prj))
(throw 'p-found project-name))))))
(when up
- (dolist (prj org-e-publish-project-alist)
+ (dolist (prj org-publish-project-alist)
(if (member project-name (plist-get (cdr prj) :components))
(setq project-name (car prj)))))
- (assoc project-name org-e-publish-project-alist)))
+ (assoc project-name org-publish-project-alist)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Tools for publishing functions in back-ends
-(defun org-e-publish-org-to (backend filename extension plist &optional pub-dir)
+(defun org-publish-org-to (backend filename extension plist &optional pub-dir)
"Publish an Org file to a specified back-end.
BACKEND is a symbol representing the back-end used for
@@ -559,19 +564,19 @@ Return output file name."
(body-p (plist-get plist :body-only)))
(org-export-to-file
backend output-file nil nil body-p
- ;; Install `org-e-publish-collect-index' in parse tree
+ ;; Install `org-publish-collect-index' in parse tree
;; filters. It isn't dependent on `:makeindex', since
;; we want to keep it up-to-date in cache anyway.
(org-combine-plists
plist `(:filter-parse-tree
- (org-e-publish-collect-index
+ (org-publish-collect-index
,@(plist-get plist :filter-parse-tree)))))))
;; Remove opened buffer in the process.
(unless visitingp (kill-buffer work-buffer)))))
(defvar project-plist)
-(defun org-e-publish-attachment (plist filename pub-dir)
+(defun org-publish-attachment (plist filename pub-dir)
"Publish a file with no transformation of any kind.
FILENAME is the filename of the Org file to be published. PLIST
@@ -592,15 +597,15 @@ Return output file name."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Publishing files, sets of files, and indices
-(defun org-e-publish-file (filename &optional project no-cache)
+(defun org-publish-file (filename &optional project no-cache)
"Publish file FILENAME from PROJECT.
-If NO-CACHE is not nil, do not initialize org-e-publish-cache and
+If NO-CACHE is not nil, do not initialize org-publish-cache and
write it to disk. This is needed, since this function is used to
publish single files, when entire projects are published.
-See `org-e-publish-projects'."
+See `org-publish-projects'."
(let* ((project
(or project
- (or (org-e-publish-get-project-from-filename filename)
+ (or (org-publish-get-project-from-filename filename)
(error "File %s not part of any known project"
(abbreviate-file-name filename)))))
(project-plist (cdr project))
@@ -622,7 +627,7 @@ See `org-e-publish-projects'."
(car project))))))
tmp-pub-dir)
- (unless no-cache (org-e-publish-initialize-cache (car project)))
+ (unless no-cache (org-publish-initialize-cache (car project)))
(setq tmp-pub-dir
(file-name-directory
@@ -632,58 +637,58 @@ See `org-e-publish-projects'."
(if (listp publishing-function)
;; allow chain of publishing functions
(mapc (lambda (f)
- (when (org-e-publish-needed-p
+ (when (org-publish-needed-p
filename pub-dir f tmp-pub-dir base-dir)
(funcall f project-plist filename tmp-pub-dir)
- (org-e-publish-update-timestamp filename pub-dir f base-dir)))
+ (org-publish-update-timestamp filename pub-dir f base-dir)))
publishing-function)
- (when (org-e-publish-needed-p
+ (when (org-publish-needed-p
filename pub-dir publishing-function tmp-pub-dir base-dir)
(funcall publishing-function project-plist filename tmp-pub-dir)
- (org-e-publish-update-timestamp
+ (org-publish-update-timestamp
filename pub-dir publishing-function base-dir)))
- (unless no-cache (org-e-publish-write-cache-file))))
+ (unless no-cache (org-publish-write-cache-file))))
-(defun org-e-publish-projects (projects)
+(defun org-publish-projects (projects)
"Publish all files belonging to the PROJECTS alist.
If `:auto-sitemap' is set, publish the sitemap too. If
`:makeindex' is set, also produce a file theindex.org."
(mapc
(lambda (project)
;; Each project uses its own cache file:
- (org-e-publish-initialize-cache (car project))
+ (org-publish-initialize-cache (car project))
(let* ((project-plist (cdr project))
(exclude-regexp (plist-get project-plist :exclude))
(sitemap-p (plist-get project-plist :auto-sitemap))
(sitemap-filename (or (plist-get project-plist :sitemap-filename)
"sitemap.org"))
(sitemap-function (or (plist-get project-plist :sitemap-function)
- 'org-e-publish-org-sitemap))
+ 'org-publish-org-sitemap))
(org-sitemap-date-format
(or (plist-get project-plist :sitemap-date-format)
- org-e-publish-sitemap-date-format))
+ org-publish-sitemap-date-format))
(org-sitemap-file-entry-format
(or (plist-get project-plist :sitemap-file-entry-format)
- org-e-publish-sitemap-file-entry-format))
+ org-publish-sitemap-file-entry-format))
(preparation-function
(plist-get project-plist :preparation-function))
(completion-function (plist-get project-plist :completion-function))
- (files (org-e-publish-get-base-files project exclude-regexp)) file)
+ (files (org-publish-get-base-files project exclude-regexp)) file)
(when preparation-function (run-hooks 'preparation-function))
(if sitemap-p (funcall sitemap-function project sitemap-filename))
- (dolist (file files) (org-e-publish-file file project t))
+ (dolist (file files) (org-publish-file file project t))
(when (plist-get project-plist :makeindex)
- (org-e-publish-index-generate-theindex
+ (org-publish-index-generate-theindex
project (plist-get project-plist :base-directory))
- (org-e-publish-file
+ (org-publish-file
(expand-file-name
"theindex.org" (plist-get project-plist :base-directory))
project t))
(when completion-function (run-hooks 'completion-function))
- (org-e-publish-write-cache-file)))
- (org-e-publish-expand-projects projects)))
+ (org-publish-write-cache-file)))
+ (org-publish-expand-projects projects)))
-(defun org-e-publish-org-sitemap (project &optional sitemap-filename)
+(defun org-publish-org-sitemap (project &optional sitemap-filename)
"Create a sitemap of pages in set defined by PROJECT.
Optionally set the filename of the sitemap with SITEMAP-FILENAME.
Default for SITEMAP-FILENAME is 'sitemap.org'."
@@ -694,7 +699,7 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(indent-str (make-string 2 ?\ ))
(exclude-regexp (plist-get project-plist :exclude))
(files (nreverse
- (org-e-publish-get-base-files project exclude-regexp)))
+ (org-publish-get-base-files project exclude-regexp)))
(sitemap-filename (concat dir (or sitemap-filename "sitemap.org")))
(sitemap-title (or (plist-get project-plist :sitemap-title)
(concat "Sitemap for project " (car project))))
@@ -746,7 +751,7 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(+ (length indent-str) 2) ?\ )))))))
;; This is common to 'flat and 'tree
(let ((entry
- (org-e-publish-format-file-entry
+ (org-publish-format-file-entry
org-sitemap-file-entry-format file project-plist))
(regexp "\\(.*\\)\\[\\([^][]+\\)\\]\\(.*\\)"))
(cond ((string-match-p regexp entry)
@@ -762,17 +767,17 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(save-buffer))
(or visiting (kill-buffer sitemap-buffer))))
-(defun org-e-publish-format-file-entry (fmt file project-plist)
+(defun org-publish-format-file-entry (fmt file project-plist)
(format-spec fmt
- `((?t . ,(org-e-publish-find-title file t))
+ `((?t . ,(org-publish-find-title file t))
(?d . ,(format-time-string org-sitemap-date-format
- (org-e-publish-find-date file)))
+ (org-publish-find-date file)))
(?a . ,(or (plist-get project-plist :author) user-full-name)))))
-(defun org-e-publish-find-title (file &optional reset)
+(defun org-publish-find-title (file &optional reset)
"Find the title of FILE in project."
(or
- (and (not reset) (org-e-publish-cache-get-file-property file :title nil t))
+ (and (not reset) (org-publish-cache-get-file-property file :title nil t))
(let* ((visiting (find-buffer-visiting file))
(buffer (or visiting (find-file-noselect file)))
title)
@@ -783,10 +788,10 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(plist-get (org-export-get-environment) :title))
(file-name-nondirectory (file-name-sans-extension file)))))
(unless visiting (kill-buffer buffer))
- (org-e-publish-cache-set-file-property file :title title)
+ (org-publish-cache-set-file-property file :title title)
title)))
-(defun org-e-publish-find-date (file)
+(defun org-publish-find-date (file)
"Find the date of FILE in project.
If FILE provides a #+date keyword use it else use the file
system's modification time.
@@ -810,14 +815,14 @@ It returns time in `current-time' format."
;;; Interactive publishing functions
;;;###autoload
-(defalias 'org-e-publish-project 'org-e-publish)
+(defalias 'org-publish-project 'org-publish)
;;;###autoload
-(defun org-e-publish (project &optional force async)
+(defun org-publish (project &optional force async)
"Publish PROJECT.
PROJECT is either a project name, as a string, or a project
-alist (see `org-e-publish-project-alist' variable).
+alist (see `org-publish-project-alist' variable).
When optional argument FORCE is non-nil, force publishing all
files in PROJECT. With a non-nil optional argument ASYNC,
@@ -826,25 +831,25 @@ publishing will be done asynchronously, in another process."
(list
(assoc (org-icompleting-read
"Publish project: "
- org-e-publish-project-alist nil t)
- org-e-publish-project-alist)
+ org-publish-project-alist nil t)
+ org-publish-project-alist)
current-prefix-arg))
(let ((project-alist (if (not (stringp project)) (list project)
;; If this function is called in batch mode,
;; project is still a string here.
- (list (assoc project org-e-publish-project-alist)))))
+ (list (assoc project org-publish-project-alist)))))
(if async
(org-export-async-start 'ignore
- `(let ((org-e-publish-use-timestamps-flag
- (if ',force nil ,org-e-publish-use-timestamps-flag)))
- (org-e-publish-projects ',project-alist)))
+ `(let ((org-publish-use-timestamps-flag
+ (if ',force nil ,org-publish-use-timestamps-flag)))
+ (org-publish-projects ',project-alist)))
(save-window-excursion
- (let* ((org-e-publish-use-timestamps-flag
- (if force nil org-e-publish-use-timestamps-flag)))
- (org-e-publish-projects project-alist))))))
+ (let* ((org-publish-use-timestamps-flag
+ (if force nil org-publish-use-timestamps-flag)))
+ (org-publish-projects project-alist))))))
;;;###autoload
-(defun org-e-publish-all (&optional force async)
+(defun org-publish-all (&optional force async)
"Publish all projects.
With prefix argument FORCE, remove all files in the timestamp
directory and force publishing all projects. With a non-nil
@@ -853,19 +858,19 @@ in another process."
(interactive "P")
(if async
(org-export-async-start 'ignore
- `(when ',force (org-e-publish-remove-all-timestamps))
- `(let ((org-e-publish-use-timestamps-flag
- (if ',force nil ,org-e-publish-use-timestamps-flag)))
- (org-e-publish-projects ',org-e-publish-project-alist)))
- (when force (org-e-publish-remove-all-timestamps))
+ `(when ',force (org-publish-remove-all-timestamps))
+ `(let ((org-publish-use-timestamps-flag
+ (if ',force nil ,org-publish-use-timestamps-flag)))
+ (org-publish-projects ',org-publish-project-alist)))
+ (when force (org-publish-remove-all-timestamps))
(save-window-excursion
- (let ((org-e-publish-use-timestamps-flag
- (if force nil org-e-publish-use-timestamps-flag)))
- (org-e-publish-projects org-e-publish-project-alist)))))
+ (let ((org-publish-use-timestamps-flag
+ (if force nil org-publish-use-timestamps-flag)))
+ (org-publish-projects org-publish-project-alist)))))
;;;###autoload
-(defun org-e-publish-current-file (&optional force async)
+(defun org-publish-current-file (&optional force async)
"Publish the current file.
With prefix argument FORCE, force publish the file. When
optional argument ASYNC is non-nil, publishing will be done
@@ -874,24 +879,24 @@ asynchronously, in another process."
(let ((file (buffer-file-name (buffer-base-buffer))))
(if async
(org-export-async-start 'ignore
- `(let ((org-e-publish-use-timestamps-flag
- (if ',force nil ,org-e-publish-use-timestamps-flag)))
- (org-e-publish-file ,file)))
+ `(let ((org-publish-use-timestamps-flag
+ (if ',force nil ,org-publish-use-timestamps-flag)))
+ (org-publish-file ,file)))
(save-window-excursion
- (let ((org-e-publish-use-timestamps-flag
- (if force nil org-e-publish-use-timestamps-flag)))
- (org-e-publish-file file))))))
+ (let ((org-publish-use-timestamps-flag
+ (if force nil org-publish-use-timestamps-flag)))
+ (org-publish-file file))))))
;;;###autoload
-(defun org-e-publish-current-project (&optional force async)
+(defun org-publish-current-project (&optional force async)
"Publish the project associated with the current file.
With a prefix argument, force publishing of all files in
the project."
(interactive "P")
(save-window-excursion
- (let ((project (org-e-publish-get-project-from-filename
+ (let ((project (org-publish-get-project-from-filename
(buffer-file-name (buffer-base-buffer)) 'up)))
- (if project (org-e-publish project force async)
+ (if project (org-publish project force async)
(error "File %s is not part of any known project"
(buffer-file-name (buffer-base-buffer)))))))
@@ -899,7 +904,7 @@ the project."
;;; Index generation
-(defun org-e-publish-collect-index (tree backend info)
+(defun org-publish-collect-index (tree backend info)
"Update index for a file with TREE in cache.
BACKEND is the back-end being used for transcoding. INFO is
@@ -914,39 +919,38 @@ original index keyword. When non-nil, this reference is a cons
cell. Its CAR is a symbol among `id', `custom-id' and `name' and
its CDR is a string."
(let ((file (plist-get info :input-file)))
- (org-e-publish-cache-set-file-property
+ (org-publish-cache-set-file-property
file :index
(delete-dups
- (org-element-map
- tree 'keyword
- (lambda (k)
- (when (equal (upcase (org-element-property :key k)) "INDEX")
- (let ((parent (org-export-get-parent-headline k)))
- (list (org-element-property :value k)
- file
- (cond
- ((not parent) nil)
- ((let ((id (org-element-property :id parent)))
- (and id (cons 'id id))))
- ((let ((id (org-element-property :custom-id parent)))
- (and id (cons 'custom-id id))))
- (t (cons 'name
- (org-element-property :raw-value parent))))))))
- info))))
+ (org-element-map tree 'keyword
+ (lambda (k)
+ (when (equal (upcase (org-element-property :key k)) "INDEX")
+ (let ((parent (org-export-get-parent-headline k)))
+ (list (org-element-property :value k)
+ file
+ (cond
+ ((not parent) nil)
+ ((let ((id (org-element-property :id parent)))
+ (and id (cons 'id id))))
+ ((let ((id (org-element-property :custom-id parent)))
+ (and id (cons 'custom-id id))))
+ (t (cons 'name
+ (org-element-property :raw-value parent))))))))
+ info))))
;; Return parse-tree to avoid altering output.
tree)
-(defun org-e-publish-index-generate-theindex (project directory)
+(defun org-publish-index-generate-theindex (project directory)
"Retrieve full index from cache and build \"theindex.org\".
PROJECT is the project the index relates to. DIRECTORY is the
publishing directory."
- (let ((all-files (org-e-publish-get-base-files
+ (let ((all-files (org-publish-get-base-files
project (plist-get (cdr project) :exclude)))
full-index)
;; Compile full index.
(mapc
(lambda (file)
- (let ((index (org-e-publish-cache-get-file-property file :index)))
+ (let ((index (org-publish-cache-get-file-property file :index)))
(dolist (term index)
(unless (member term full-index) (push term full-index)))))
all-files)
@@ -1005,76 +1009,76 @@ publishing directory."
;;; Caching functions
-(defun org-e-publish-write-cache-file (&optional free-cache)
- "Write `org-e-publish-cache' to file.
+(defun org-publish-write-cache-file (&optional free-cache)
+ "Write `org-publish-cache' to file.
If FREE-CACHE, empty the cache."
- (unless org-e-publish-cache
- (error "`org-e-publish-write-cache-file' called, but no cache present"))
+ (unless org-publish-cache
+ (error "`org-publish-write-cache-file' called, but no cache present"))
- (let ((cache-file (org-e-publish-cache-get ":cache-file:")))
+ (let ((cache-file (org-publish-cache-get ":cache-file:")))
(unless cache-file
- (error "Cannot find cache-file name in `org-e-publish-write-cache-file'"))
+ (error "Cannot find cache-file name in `org-publish-write-cache-file'"))
(with-temp-file cache-file
(let (print-level print-length)
- (insert "(setq org-e-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))\n")
+ (insert "(setq org-publish-cache (make-hash-table :test 'equal :weakness nil :size 100))\n")
(maphash (lambda (k v)
(insert
(format (concat "(puthash %S "
(if (or (listp v) (symbolp v))
"'" "")
- "%S org-e-publish-cache)\n") k v)))
- org-e-publish-cache)))
- (when free-cache (org-e-publish-reset-cache))))
+ "%S org-publish-cache)\n") k v)))
+ org-publish-cache)))
+ (when free-cache (org-publish-reset-cache))))
-(defun org-e-publish-initialize-cache (project-name)
+(defun org-publish-initialize-cache (project-name)
"Initialize the projects cache if not initialized yet and return it."
(unless project-name
- (error "Cannot initialize `org-e-publish-cache' without projects name in `org-e-publish-initialize-cache'"))
+ (error "Cannot initialize `org-publish-cache' without projects name in `org-publish-initialize-cache'"))
- (unless (file-exists-p org-e-publish-timestamp-directory)
- (make-directory org-e-publish-timestamp-directory t))
- (unless (file-directory-p org-e-publish-timestamp-directory)
+ (unless (file-exists-p org-publish-timestamp-directory)
+ (make-directory org-publish-timestamp-directory t))
+ (unless (file-directory-p org-publish-timestamp-directory)
(error "Org publish timestamp: %s is not a directory"
- org-e-publish-timestamp-directory))
+ org-publish-timestamp-directory))
- (unless (and org-e-publish-cache
- (string= (org-e-publish-cache-get ":project:") project-name))
+ (unless (and org-publish-cache
+ (string= (org-publish-cache-get ":project:") project-name))
(let* ((cache-file
(concat
- (expand-file-name org-e-publish-timestamp-directory)
+ (expand-file-name org-publish-timestamp-directory)
project-name ".cache"))
(cexists (file-exists-p cache-file)))
- (when org-e-publish-cache (org-e-publish-reset-cache))
+ (when org-publish-cache (org-publish-reset-cache))
(if cexists (load-file cache-file)
- (setq org-e-publish-cache
+ (setq org-publish-cache
(make-hash-table :test 'equal :weakness nil :size 100))
- (org-e-publish-cache-set ":project:" project-name)
- (org-e-publish-cache-set ":cache-file:" cache-file))
- (unless cexists (org-e-publish-write-cache-file nil))))
- org-e-publish-cache)
-
-(defun org-e-publish-reset-cache ()
- "Empty org-e-publish-cache and reset it nil."
- (message "%s" "Resetting org-e-publish-cache")
- (when (hash-table-p org-e-publish-cache)
- (clrhash org-e-publish-cache))
- (setq org-e-publish-cache nil))
-
-(defun org-e-publish-cache-file-needs-publishing
+ (org-publish-cache-set ":project:" project-name)
+ (org-publish-cache-set ":cache-file:" cache-file))
+ (unless cexists (org-publish-write-cache-file nil))))
+ org-publish-cache)
+
+(defun org-publish-reset-cache ()
+ "Empty org-publish-cache and reset it nil."
+ (message "%s" "Resetting org-publish-cache")
+ (when (hash-table-p org-publish-cache)
+ (clrhash org-publish-cache))
+ (setq org-publish-cache nil))
+
+(defun org-publish-cache-file-needs-publishing
(filename &optional pub-dir pub-func base-dir)
"Check the timestamp of the last publishing of FILENAME.
Non-nil if the file needs publishing. The function also checks
if any included files have been more recently published, so that
the file including them will be republished as well."
- (unless org-e-publish-cache
+ (unless org-publish-cache
(error
- "`org-e-publish-cache-file-needs-publishing' called, but no cache present"))
+ "`org-publish-cache-file-needs-publishing' called, but no cache present"))
(let* ((case-fold-search t)
- (key (org-e-publish-timestamp-filename filename pub-dir pub-func))
- (pstamp (org-e-publish-cache-get key))
+ (key (org-publish-timestamp-filename filename pub-dir pub-func))
+ (pstamp (org-publish-cache-get key))
(visiting (find-buffer-visiting filename))
included-files-ctime buf)
@@ -1086,62 +1090,62 @@ the file including them will be republished as well."
"^#\\+INCLUDE:[ \t]+\"\\([^\t\n\r\"]*\\)\"[ \t]*.*$" nil t)
(let* ((included-file (expand-file-name (match-string 1))))
(add-to-list 'included-files-ctime
- (org-e-publish-cache-ctime-of-src included-file) t))))
+ (org-publish-cache-ctime-of-src included-file) t))))
(unless visiting (kill-buffer buf)))
(if (null pstamp) t
- (let ((ctime (org-e-publish-cache-ctime-of-src filename)))
+ (let ((ctime (org-publish-cache-ctime-of-src filename)))
(or (< pstamp ctime)
(when included-files-ctime
(not (null (delq nil (mapcar (lambda(ct) (< ctime ct))
included-files-ctime))))))))))
-(defun org-e-publish-cache-set-file-property
+(defun org-publish-cache-set-file-property
(filename property value &optional project-name)
"Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE.
Use cache file of PROJECT-NAME. If the entry does not exist, it
will be created. Return VALUE."
;; Evtl. load the requested cache file:
- (if project-name (org-e-publish-initialize-cache project-name))
- (let ((pl (org-e-publish-cache-get filename)))
+ (if project-name (org-publish-initialize-cache project-name))
+ (let ((pl (org-publish-cache-get filename)))
(if pl (progn (plist-put pl property value) value)
- (org-e-publish-cache-get-file-property
+ (org-publish-cache-get-file-property
filename property value nil project-name))))
-(defun org-e-publish-cache-get-file-property
+(defun org-publish-cache-get-file-property
(filename property &optional default no-create project-name)
"Return the value for a PROPERTY of file FILENAME in publishing cache.
Use cache file of PROJECT-NAME. Return the value of that PROPERTY
or DEFAULT, if the value does not yet exist. If the entry will
be created, unless NO-CREATE is not nil."
;; Evtl. load the requested cache file:
- (if project-name (org-e-publish-initialize-cache project-name))
- (let ((pl (org-e-publish-cache-get filename)) retval)
+ (if project-name (org-publish-initialize-cache project-name))
+ (let ((pl (org-publish-cache-get filename)) retval)
(if pl
(if (plist-member pl property)
(setq retval (plist-get pl property))
(setq retval default))
;; no pl yet:
(unless no-create
- (org-e-publish-cache-set filename (list property default)))
+ (org-publish-cache-set filename (list property default)))
(setq retval default))
retval))
-(defun org-e-publish-cache-get (key)
- "Return the value stored in `org-e-publish-cache' for key KEY.
+(defun org-publish-cache-get (key)
+ "Return the value stored in `org-publish-cache' for key KEY.
Returns nil, if no value or nil is found, or the cache does not
exist."
- (unless org-e-publish-cache
- (error "`org-e-publish-cache-get' called, but no cache present"))
- (gethash key org-e-publish-cache))
+ (unless org-publish-cache
+ (error "`org-publish-cache-get' called, but no cache present"))
+ (gethash key org-publish-cache))
-(defun org-e-publish-cache-set (key value)
- "Store KEY VALUE pair in `org-e-publish-cache'.
+(defun org-publish-cache-set (key value)
+ "Store KEY VALUE pair in `org-publish-cache'.
Returns value on success, else nil."
- (unless org-e-publish-cache
- (error "`org-e-publish-cache-set' called, but no cache present"))
- (puthash key value org-e-publish-cache))
+ (unless org-publish-cache
+ (error "`org-publish-cache-set' called, but no cache present"))
+ (puthash key value org-publish-cache))
-(defun org-e-publish-cache-ctime-of-src (file)
+(defun org-publish-cache-ctime-of-src (file)
"Get the ctime of FILE as an integer."
(let ((attr (file-attributes
(expand-file-name (or (file-symlink-p file) file)
@@ -1150,6 +1154,10 @@ Returns value on success, else nil."
(cadr (nth 5 attr)))))
-(provide 'org-e-publish)
+(provide 'ox-publish)
-;;; org-e-publish.el ends here
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-publish.el ends here
diff --git a/contrib/lisp/org-e-texinfo.el b/lisp/ox-texinfo.el
index a14998c..618e0c6 100644
--- a/contrib/lisp/org-e-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -1,4 +1,4 @@
-;;; org-e-texinfo.el --- Texinfo Back-End For Org Export Engine
+;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine
;; Copyright (C) 2012, 2013 Jonathan Leech-Pepin
;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
@@ -26,11 +26,10 @@
;;
;; To test it, run
;;
-;; M-: (org-export-to-buffer 'e-texinfo "*Test e-texinfo*") RET
+;; M-: (org-export-to-buffer 'texinfo "*Test Texinfo*") RET
;;
-;; in an org-mode buffer then switch to the buffer to see the Texinfo
-;; export. See contrib/lisp/org-export.el for more details on how
-;; this exporter works.
+;; in an Org mode buffer then switch to the buffer to see the Texinfo
+;; export. See ox.el for more details on how this exporter works.
;;
;; It introduces nine new buffer keywords: "TEXINFO_CLASS",
@@ -46,24 +45,19 @@
;; and @key{} commands), the following export-snippet keys are
;; accepted:
;;
+;; texinfo
;; info
-;; e-info
-;; e-texinfo
;;
;; You can add them for export snippets via any of the below:
;;
;; (add-to-list 'org-export-snippet-translation-alist
-;; '("e-info" . "e-texinfo"))
-;; (add-to-list 'org-export-snippet-translation-alist
-;; '("e-texinfo" . "e-texinfo"))
-;; (add-to-list 'org-export-snippet-translation-alist
-;; '("info" . "e-texinfo"))
+;; '("info" . "texinfo"))
;;
;;; Code:
(eval-when-compile (require 'cl))
-(require 'org-export)
+(require 'ox)
(defvar orgtbl-exp-regexp)
@@ -71,63 +65,63 @@
;;; Define Back-End
-(org-export-define-backend e-texinfo
- ((bold . org-e-texinfo-bold)
- (center-block . org-e-texinfo-center-block)
- (clock . org-e-texinfo-clock)
- (code . org-e-texinfo-code)
- (comment . org-e-texinfo-comment)
- (comment-block . org-e-texinfo-comment-block)
- (drawer . org-e-texinfo-drawer)
- (dynamic-block . org-e-texinfo-dynamic-block)
- (entity . org-e-texinfo-entity)
- (example-block . org-e-texinfo-example-block)
- (export-block . org-e-texinfo-export-block)
- (export-snippet . org-e-texinfo-export-snippet)
- (fixed-width . org-e-texinfo-fixed-width)
- (footnote-definition . org-e-texinfo-footnote-definition)
- (footnote-reference . org-e-texinfo-footnote-reference)
- (headline . org-e-texinfo-headline)
- (inline-src-block . org-e-texinfo-inline-src-block)
- (inlinetask . org-e-texinfo-inlinetask)
- (italic . org-e-texinfo-italic)
- (item . org-e-texinfo-item)
- (keyword . org-e-texinfo-keyword)
- (line-break . org-e-texinfo-line-break)
- (link . org-e-texinfo-link)
- (paragraph . org-e-texinfo-paragraph)
- (plain-list . org-e-texinfo-plain-list)
- (plain-text . org-e-texinfo-plain-text)
- (planning . org-e-texinfo-planning)
- (property-drawer . org-e-texinfo-property-drawer)
- (quote-block . org-e-texinfo-quote-block)
- (quote-section . org-e-texinfo-quote-section)
- (radio-target . org-e-texinfo-radio-target)
- (section . org-e-texinfo-section)
- (special-block . org-e-texinfo-special-block)
- (src-block . org-e-texinfo-src-block)
- (statistics-cookie . org-e-texinfo-statistics-cookie)
- (subscript . org-e-texinfo-subscript)
- (superscript . org-e-texinfo-superscript)
- (table . org-e-texinfo-table)
- (table-cell . org-e-texinfo-table-cell)
- (table-row . org-e-texinfo-table-row)
- (target . org-e-texinfo-target)
- (template . org-e-texinfo-template)
- (timestamp . org-e-texinfo-timestamp)
- (verbatim . org-e-texinfo-verbatim)
- (verse-block . org-e-texinfo-verse-block))
+(org-export-define-backend texinfo
+ ((bold . org-texinfo-bold)
+ (center-block . org-texinfo-center-block)
+ (clock . org-texinfo-clock)
+ (code . org-texinfo-code)
+ (comment . org-texinfo-comment)
+ (comment-block . org-texinfo-comment-block)
+ (drawer . org-texinfo-drawer)
+ (dynamic-block . org-texinfo-dynamic-block)
+ (entity . org-texinfo-entity)
+ (example-block . org-texinfo-example-block)
+ (export-block . org-texinfo-export-block)
+ (export-snippet . org-texinfo-export-snippet)
+ (fixed-width . org-texinfo-fixed-width)
+ (footnote-definition . org-texinfo-footnote-definition)
+ (footnote-reference . org-texinfo-footnote-reference)
+ (headline . org-texinfo-headline)
+ (inline-src-block . org-texinfo-inline-src-block)
+ (inlinetask . org-texinfo-inlinetask)
+ (italic . org-texinfo-italic)
+ (item . org-texinfo-item)
+ (keyword . org-texinfo-keyword)
+ (line-break . org-texinfo-line-break)
+ (link . org-texinfo-link)
+ (paragraph . org-texinfo-paragraph)
+ (plain-list . org-texinfo-plain-list)
+ (plain-text . org-texinfo-plain-text)
+ (planning . org-texinfo-planning)
+ (property-drawer . org-texinfo-property-drawer)
+ (quote-block . org-texinfo-quote-block)
+ (quote-section . org-texinfo-quote-section)
+ (radio-target . org-texinfo-radio-target)
+ (section . org-texinfo-section)
+ (special-block . org-texinfo-special-block)
+ (src-block . org-texinfo-src-block)
+ (statistics-cookie . org-texinfo-statistics-cookie)
+ (subscript . org-texinfo-subscript)
+ (superscript . org-texinfo-superscript)
+ (table . org-texinfo-table)
+ (table-cell . org-texinfo-table-cell)
+ (table-row . org-texinfo-table-row)
+ (target . org-texinfo-target)
+ (template . org-texinfo-template)
+ (timestamp . org-texinfo-timestamp)
+ (verbatim . org-texinfo-verbatim)
+ (verse-block . org-texinfo-verse-block))
:export-block "TEXINFO"
:filters-alist
- ((:filter-headline . org-e-texinfo-filter-section-blank-lines)
- (:filter-section . org-e-texinfo-filter-section-blank-lines))
+ ((:filter-headline . org-texinfo-filter-section-blank-lines)
+ (:filter-section . org-texinfo-filter-section-blank-lines))
:menu-entry
(?i "Export to Texinfo"
- ((?t "As TEXI file" org-e-texinfo-export-to-texinfo)
- (?i "As INFO file" org-e-texinfo-export-to-info)))
+ ((?t "As TEXI file" org-texinfo-export-to-texinfo)
+ (?i "As INFO file" org-texinfo-export-to-info)))
:options-alist
- ((:texinfo-filename "TEXINFO_FILENAME" nil org-e-texinfo-filename t)
- (:texinfo-class "TEXINFO_CLASS" nil org-e-texinfo-default-class t)
+ ((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t)
+ (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t)
(:texinfo-header "TEXINFO_HEADER" nil nil newline)
(:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline)
(:subtitle "SUBTITLE" nil nil newline)
@@ -141,24 +135,24 @@
;;; User Configurable Variables
-(defgroup org-export-e-texinfo nil
+(defgroup org-export-texinfo nil
"Options for exporting Org mode files to Texinfo."
:tag "Org Export Texinfo"
:group 'org-export)
;;; Preamble
-(defcustom org-e-texinfo-filename nil
+(defcustom org-texinfo-filename nil
"Default filename for texinfo output."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type '(string :tag "Export Filename"))
-(defcustom org-e-texinfo-default-class "info"
+(defcustom org-texinfo-default-class "info"
"The default Texinfo class."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type '(string :tag "Texinfo class"))
-(defcustom org-e-texinfo-classes
+(defcustom org-texinfo-classes
'(("info"
"\\input texinfo @c -*- texinfo -*-"
("@chapter %s" . "@unnumbered %s")
@@ -187,7 +181,7 @@ a function name. That function will be called with two
parameters, the \(reduced) level of the headline, and a predicate
non-nil when the headline should be numbered. It must return
a format string in which the section title will be added."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type '(repeat
(list (string :tag "Texinfo class")
(string :tag "Texinfo header")
@@ -200,7 +194,7 @@ a format string in which the section title will be added."
;;; Headline
-(defcustom org-e-texinfo-format-headline-function nil
+(defcustom org-texinfo-format-headline-function nil
"Function to format headline text.
This function will be called with 5 arguments:
@@ -215,7 +209,7 @@ 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:
-\(defun org-e-texinfo-format-headline (todo todo-type priority text tags)
+\(defun org-texinfo-format-headline (todo todo-type priority text tags)
\"Default format function for an headline.\"
\(concat (when todo
\(format \"\\\\textbf{\\\\textsc{\\\\textsf{%s}}} \" todo))
@@ -225,7 +219,7 @@ order to reproduce the default set-up:
\(when tags
\(format \"\\\\hfill{}\\\\textsc{%s}\"
\(mapconcat 'identity tags \":\"))))"
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'function)
@@ -235,56 +229,56 @@ order to reproduce the default set-up:
;;; Timestamps
-(defcustom org-e-texinfo-active-timestamp-format "@emph{%s}"
+(defcustom org-texinfo-active-timestamp-format "@emph{%s}"
"A printf format string to be applied to active timestamps."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'string)
-(defcustom org-e-texinfo-inactive-timestamp-format "@emph{%s}"
+(defcustom org-texinfo-inactive-timestamp-format "@emph{%s}"
"A printf format string to be applied to inactive timestamps."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'string)
-(defcustom org-e-texinfo-diary-timestamp-format "@emph{%s}"
+(defcustom org-texinfo-diary-timestamp-format "@emph{%s}"
"A printf format string to be applied to diary timestamps."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'string)
;;; Links
-(defcustom org-e-texinfo-link-with-unknown-path-format "@indicateurl{%s}"
+(defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}"
"Format string for links with unknown path type."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'string)
;;; Tables
-(defcustom org-e-texinfo-tables-verbatim nil
+(defcustom org-texinfo-tables-verbatim nil
"When non-nil, tables are exported verbatim."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'boolean)
-(defcustom org-e-texinfo-table-scientific-notation "%s\\,(%s)"
+(defcustom org-texinfo-table-scientific-notation "%s\\,(%s)"
"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."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type '(choice
(string :tag "Format string")
(const :tag "No formatting")))
-(defcustom org-e-texinfo-def-table-markup "@samp"
+(defcustom org-texinfo-def-table-markup "@samp"
"Default setting for @table environments.")
;;; Text markup
-(defcustom org-e-texinfo-text-markup-alist '((bold . "@strong{%s}")
- (code . code)
- (italic . "@emph{%s}")
- (verbatim . verb)
- (comment . "@c %s"))
+(defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}")
+ (code . code)
+ (italic . "@emph{%s}")
+ (verbatim . verb)
+ (comment . "@c %s"))
"Alist of Texinfo expressions to convert text markup.
The key must be a symbol among `bold', `italic' and `comment'.
@@ -298,13 +292,13 @@ to typeset and try to protect special characters.
If no association can be found for a given markup, text will be
returned as-is."
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'alist
:options '(bold code italic verbatim comment))
;;; Drawers
-(defcustom org-e-texinfo-format-drawer-function nil
+(defcustom org-texinfo-format-drawer-function nil
"Function called to format a drawer in Texinfo code.
The function must accept two parameters:
@@ -316,15 +310,15 @@ 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:
-\(defun org-e-texinfo-format-drawer-default \(name contents\)
+\(defun org-texinfo-format-drawer-default \(name contents\)
\"Format a drawer element for Texinfo export.\"
contents\)"
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'function)
;;; Inlinetasks
-(defcustom org-e-texinfo-format-inlinetask-function nil
+(defcustom org-texinfo-format-inlinetask-function nil
"Function called to format an inlinetask in Texinfo code.
The function must accept six parameters:
@@ -340,7 +334,7 @@ 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:
-\(defun org-e-texinfo-format-inlinetask \(todo type priority name tags contents\)
+\(defun org-texinfo-format-inlinetask \(todo type priority name tags contents\)
\"Format an inline task element for Texinfo export.\"
\(let ((full-title
\(concat
@@ -355,7 +349,7 @@ in order to mimic default behaviour:
\"%s\"
\"\n\"))
full-title contents))"
- :group 'org-export-e-texinfo
+ :group 'org-export-texinfo
:type 'function)
;;; Src blocks
@@ -364,7 +358,7 @@ in order to mimic default behaviour:
;;; Compilation
-(defcustom org-e-texinfo-info-process
+(defcustom org-texinfo-info-process
'("makeinfo %f")
"Commands to process a texinfo file to an INFO file.
This is list of strings, each of them will be given to the shell
@@ -378,27 +372,12 @@ file name, %b by the file base name \(i.e without extension) and
;;; Internal Functions
-(defun org-e-texinfo-filter-section-blank-lines (headline back-end info)
+(defun org-texinfo-filter-section-blank-lines (headline back-end info)
"Filter controlling number of blank lines after a section."
(let ((blanks (make-string 2 ?\n)))
(replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))
-(defun org-e-texinfo--find-copying (info)
- "Retrieve the headline identified by the property :copying:.
-
-INFO is the plist containing the export options and tree. It is
-used to find and extract the single desired headline. This
-cannot be treated as a standard headline since it must be
-inserted in a specific location."
- (let (copying)
- (org-element-map (plist-get info :parse-tree) 'headline
- (lambda (copy)
- (when (org-element-property :copying copy)
- (push copy copying))) info t)
- ;; Retrieve the single entry
- (car copying)))
-
-(defun org-e-texinfo--find-verb-separator (s)
+(defun org-texinfo--find-verb-separator (s)
"Return a character not used in string S.
This is used to choose a separator for constructs like \\verb."
(let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
@@ -406,7 +385,7 @@ This is used to choose a separator for constructs like \\verb."
when (not (string-match (regexp-quote (char-to-string c)) s))
return (char-to-string c))))
-(defun org-e-texinfo--make-option-string (options)
+(defun org-texinfo--make-option-string (options)
"Return a comma separated string of keywords and values.
OPTIONS is an alist where the key is the options keyword as
a string, and the value a list containing the keyword value, or
@@ -418,15 +397,15 @@ nil."
options
","))
-(defun org-e-texinfo--text-markup (text markup)
+(defun org-texinfo--text-markup (text markup)
"Format TEXT depending on MARKUP text markup.
-See `org-e-texinfo-text-markup-alist' for details."
- (let ((fmt (cdr (assq markup org-e-texinfo-text-markup-alist))))
+See `org-texinfo-text-markup-alist' for details."
+ (let ((fmt (cdr (assq markup org-texinfo-text-markup-alist))))
(cond
;; No format string: Return raw text.
((not fmt) text)
((eq 'verb fmt)
- (let ((separator (org-e-texinfo--find-verb-separator text)))
+ (let ((separator (org-texinfo--find-verb-separator text)))
(concat "@verb{" separator text separator "}")))
((eq 'code fmt)
(let ((start 0)
@@ -447,13 +426,13 @@ See `org-e-texinfo-text-markup-alist' for details."
;;; Headline sanitizing
-(defun org-e-texinfo--sanitize-headline (headline info)
+(defun org-texinfo--sanitize-headline (headline info)
"Remove all formatting from the text of a headline for use in
node and menu listing."
(mapconcat 'identity
- (org-e-texinfo--sanitize-headline-contents headline info) " "))
+ (org-texinfo--sanitize-headline-contents headline info) " "))
-(defun org-e-texinfo--sanitize-headline-contents (headline info)
+(defun org-texinfo--sanitize-headline-contents (headline info)
"Retrieve the content of the headline.
Any content that can contain further formatting is checked
@@ -466,16 +445,15 @@ retrieved."
(list (replace-regexp-in-string " $" "" contents)))
;; Is exported as-is (value)
((org-element-map contents '(verbatim code)
- (lambda (value)
- (org-element-property :value value)) info))
+ (lambda (value) (org-element-property :value value)) info))
;; Has content and recurse into the content
((org-element-contents contents)
- (org-e-texinfo--sanitize-headline-contents
+ (org-texinfo--sanitize-headline-contents
(org-element-contents contents) info)))))
;;; Menu sanitizing
-(defun org-e-texinfo--sanitize-menu (title)
+(defun org-texinfo--sanitize-menu (title)
"Remove invalid characters from TITLE for use in menus and
nodes.
@@ -485,7 +463,7 @@ Based on TEXINFO specifications, the following must be removed:
;;; Content sanitizing
-(defun org-e-texinfo--sanitize-content (text)
+(defun org-texinfo--sanitize-content (text)
"Ensure characters are properly escaped when used in headlines or blocks.
Escape characters are: @ { }"
@@ -493,7 +471,7 @@ Escape characters are: @ { }"
;;; Menu creation
-(defun org-e-texinfo--build-menu (tree level info &optional detailed)
+(defun org-texinfo--build-menu (tree level info &optional detailed)
"Create the @menu/@end menu information from TREE at headline
level LEVEL.
@@ -504,19 +482,19 @@ a plist containing contextual information.
Detailed determines whether to build a single level of menu, or
recurse into all children as well."
- (let ((menu (org-e-texinfo--generate-menu-list tree level info))
+ (let ((menu (org-texinfo--generate-menu-list tree level info))
output text-menu)
(cond
(detailed
;; Looping is done within the menu generation.
- (setq text-menu (org-e-texinfo--generate-detailed menu level info)))
+ (setq text-menu (org-texinfo--generate-detailed menu level info)))
(t
- (setq text-menu (org-e-texinfo--generate-menu-items menu info))))
+ (setq text-menu (org-texinfo--generate-menu-items menu info))))
(when text-menu
- (setq output (org-e-texinfo--format-menu text-menu))
+ (setq output (org-texinfo--format-menu text-menu))
(mapconcat 'identity output "\n"))))
-(defun org-e-texinfo--generate-detailed (menu level info)
+(defun org-texinfo--generate-detailed (menu level info)
"Generate a detailed listing of all subheadings within MENU starting at LEVEL.
MENU is the parse-tree to work with. LEVEL is the starting level
@@ -526,49 +504,40 @@ a plist containing contextual information."
(let ((max-depth (plist-get info :headline-levels)))
(when (> max-depth level)
(loop for headline in menu append
- (let* ((title (org-e-texinfo--menu-headlines headline info))
+ (let* ((title (org-texinfo--menu-headlines headline info))
;; Create list of menu entries for the next level
- (sublist (org-e-texinfo--generate-menu-list
+ (sublist (org-texinfo--generate-menu-list
headline (1+ level) info))
;; Generate the menu items for that level. If
;; there are none omit that heading completely,
;; otherwise join the title to it's related entries.
- (submenu (if (org-e-texinfo--generate-menu-items sublist info)
+ (submenu (if (org-texinfo--generate-menu-items sublist info)
(append (list title)
- (org-e-texinfo--generate-menu-items sublist info))
+ (org-texinfo--generate-menu-items sublist info))
'nil))
;; Start the process over the next level down.
- (recursion (org-e-texinfo--generate-detailed sublist (1+ level) info)))
+ (recursion (org-texinfo--generate-detailed sublist (1+ level) info)))
(setq recursion (append submenu recursion))
recursion))))))
-(defun org-e-texinfo--generate-menu-list (tree level info)
+(defun org-texinfo--generate-menu-list (tree level info)
"Generate the list of headlines that are within a given level
of the tree for further formatting.
TREE is the parse-tree containing the headlines. LEVEL is the
headline level to generate a list of. INFO is a plist holding
contextual information."
- (let (seq
- (noexport (string= "noexport"
- (and (plist-get info :with-tags)
- (org-export-get-tags tree info)))))
- (org-element-map
- tree 'headline
- (lambda (head)
- (when (org-element-property :level head)
- (if (and (eq level (org-element-property :level head))
- ;; Do not take note of footnotes or copying
- ;; headlines. Also ignore :noexport: headlines
- (not noexport)
- (not (org-element-property :copying head))
- (not (org-element-property :footnote-section-p head)))
- (push head seq))))
- info)
- ;; Return the list of headlines (reverse to have in actual order)
- (reverse seq)))
-
-(defun org-e-texinfo--generate-menu-items (items info)
+ (org-element-map tree 'headline
+ (lambda (head)
+ (and (= (org-export-get-relative-level head info) level)
+ ;; Do not take note of footnotes or copying headlines.
+ (not (org-element-property :copying head))
+ (not (org-element-property :footnote-section-p head))
+ ;; Collect headline.
+ head))
+ info))
+
+(defun org-texinfo--generate-menu-items (items info)
"Generate a list of headline information from the listing ITEMS.
ITEMS is a list of the headlines to be converted into entries.
@@ -576,14 +545,14 @@ INFO is a plist containing contextual information.
Returns a list containing the following information from each
headline: length, title, description. This is used to format the
-menu using `org-e-texinfo--format-menu'."
+menu using `org-texinfo--format-menu'."
(loop for headline in items collect
- (let* ((menu-title (org-e-texinfo--sanitize-menu
+ (let* ((menu-title (org-texinfo--sanitize-menu
(org-export-data
(org-element-property :texinfo-menu-title headline)
info)))
- (title (org-e-texinfo--sanitize-menu
- (org-e-texinfo--sanitize-headline
+ (title (org-texinfo--sanitize-menu
+ (org-texinfo--sanitize-headline
(org-element-property :title headline) info)))
(descr (org-export-data
(org-element-property :description headline)
@@ -593,20 +562,20 @@ menu using `org-e-texinfo--format-menu'."
(output (list len menu-entry descr)))
output)))
-(defun org-e-texinfo--menu-headlines (headline info)
+(defun org-texinfo--menu-headlines (headline info)
"Retrieve the title from HEADLINE.
INFO is a plist holding contextual information.
Return the headline as a list of (length title description) with
length of -1 and nil description. This is used in
-`org-e-texinfo--format-menu' to identify headlines as opposed to
+`org-texinfo--format-menu' to identify headlines as opposed to
entries."
(let ((title (org-export-data
(org-element-property :title headline) info)))
(list -1 title 'nil)))
-(defun org-e-texinfo--format-menu (text-menu)
+(defun org-texinfo--format-menu (text-menu)
"Format the TEXT-MENU items to be properly printed in the menu.
Each entry in the menu should be provided as (length title
@@ -643,7 +612,7 @@ of the longest menu entry."
;;; Template
-(defun org-e-texinfo-template (contents info)
+(defun org-texinfo-template (contents info)
"Return complete document string after Texinfo conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
@@ -657,16 +626,18 @@ holding export options."
(subtitle (plist-get info :subtitle))
(subauthor (plist-get info :subauthor))
(class (plist-get info :texinfo-class))
- (header (nth 1 (assoc class org-e-texinfo-classes)))
- (copying (org-e-texinfo--find-copying info))
+ (header (nth 1 (assoc class org-texinfo-classes)))
+ (copying
+ (org-element-map (plist-get info :parse-tree) 'headline
+ (lambda (hl) (and (org-element-property :copying hl) hl)) info t))
(dircat (plist-get info :texinfo-dircat))
(dirtitle (plist-get info :texinfo-dirtitle))
(dirdesc (plist-get info :texinfo-dirdesc))
;; Spacing to align description (column 32 - 3 for `* ' and
;; `.' in text.
(dirspacing (- 29 (length dirtitle)))
- (menu (org-e-texinfo-make-menu info 'main))
- (detail-menu (org-e-texinfo-make-menu info 'detailed)))
+ (menu (org-texinfo-make-menu info 'main))
+ (detail-menu (org-texinfo-make-menu info 'detailed)))
(concat
;; Header
header "\n"
@@ -772,15 +743,15 @@ holding export options."
;;; Bold
-(defun org-e-texinfo-bold (bold contents info)
+(defun org-texinfo-bold (bold contents info)
"Transcode BOLD from Org to Texinfo.
CONTENTS is the text with bold markup. INFO is a plist holding
contextual information."
- (org-e-texinfo--text-markup contents 'bold))
+ (org-texinfo--text-markup contents 'bold))
;;; Center Block
-(defun org-e-texinfo-center-block (center-block contents info)
+(defun org-texinfo-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist used
as a communication channel."
@@ -788,14 +759,14 @@ as a communication channel."
;;; Clock
-(defun org-e-texinfo-clock (clock contents info)
+(defun org-texinfo-clock (clock contents info)
"Transcode a CLOCK element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
(concat
"@noindent"
(format "@strong{%s} " org-clock-string)
- (format org-e-texinfo-inactive-timestamp-format
+ (format org-texinfo-inactive-timestamp-format
(concat (org-translate-time
(org-element-property :raw-value
(org-element-property :value clock)))
@@ -805,23 +776,23 @@ information."
;;; Code
-(defun org-e-texinfo-code (code contents info)
+(defun org-texinfo-code (code contents info)
"Transcode a CODE object from Org to Texinfo.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-texinfo--text-markup (org-element-property :value code) 'code))
+ (org-texinfo--text-markup (org-element-property :value code) 'code))
;;; Comment
-(defun org-e-texinfo-comment (comment contents info)
+(defun org-texinfo-comment (comment contents info)
"Transcode a COMMENT object from Org to Texinfo.
CONTENTS is the text in the comment. INFO is a plist holding
contextual information."
- (org-e-texinfo--text-markup (org-element-property :value comment) 'comment))
+ (org-texinfo--text-markup (org-element-property :value comment) 'comment))
;;; Comment Block
-(defun org-e-texinfo-comment-block (comment-block contents info)
+(defun org-texinfo-comment-block (comment-block contents info)
"Transcode a COMMENT-BLOCK object from Org to Texinfo.
CONTENTS is the text within the block. INFO is a plist holding
contextual information."
@@ -829,13 +800,13 @@ contextual information."
;;; Drawer
-(defun org-e-texinfo-drawer (drawer contents info)
+(defun org-texinfo-drawer (drawer contents info)
"Transcode a DRAWER element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let* ((name (org-element-property :drawer-name drawer))
- (output (if (functionp org-e-texinfo-format-drawer-function)
- (funcall org-e-texinfo-format-drawer-function
+ (output (if (functionp org-texinfo-format-drawer-function)
+ (funcall org-texinfo-format-drawer-function
name contents)
;; If there's no user defined function: simply
;; display contents of the drawer.
@@ -844,7 +815,7 @@ holding contextual information."
;;; Dynamic Block
-(defun org-e-texinfo-dynamic-block (dynamic-block contents info)
+(defun org-texinfo-dynamic-block (dynamic-block contents info)
"Transcode a DYNAMIC-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
@@ -852,7 +823,7 @@ holding contextual information. See `org-export-data'."
;;; Entity
-(defun org-e-texinfo-entity (entity contents info)
+(defun org-texinfo-entity (entity contents info)
"Transcode an ENTITY object from Org to Texinfo.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
@@ -861,7 +832,7 @@ contextual information."
;;; Example Block
-(defun org-e-texinfo-example-block (example-block contents info)
+(defun org-texinfo-example-block (example-block contents info)
"Transcode an EXAMPLE-BLOCK element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -870,7 +841,7 @@ information."
;;; Export Block
-(defun org-e-texinfo-export-block (export-block contents info)
+(defun org-texinfo-export-block (export-block contents info)
"Transcode a EXPORT-BLOCK element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "TEXINFO")
@@ -878,26 +849,26 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Export Snippet
-(defun org-e-texinfo-export-snippet (export-snippet contents info)
+(defun org-texinfo-export-snippet (export-snippet contents info)
"Transcode a EXPORT-SNIPPET object from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
- (when (eq (org-export-snippet-backend export-snippet) 'e-texinfo)
+ (when (eq (org-export-snippet-backend export-snippet) 'texinfo)
(org-element-property :value export-snippet)))
;;; Fixed Width
-(defun org-e-texinfo-fixed-width (fixed-width contents info)
+(defun org-texinfo-fixed-width (fixed-width contents info)
"Transcode a FIXED-WIDTH element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
(format "@example\n%s\n@end example"
(org-remove-indentation
- (org-e-texinfo--sanitize-content
+ (org-texinfo--sanitize-content
(org-element-property :value fixed-width)))))
;;; Footnote Reference
;;
-(defun org-e-texinfo-footnote-reference (footnote contents info)
+(defun org-texinfo-footnote-reference (footnote contents info)
"Create a footnote reference for FOOTNOTE.
FOOTNOTE is the footnote to define. CONTENTS is nil. INFO is a
@@ -908,28 +879,28 @@ plist holding contextual information."
;;; Headline
-(defun org-e-texinfo-headline (headline contents info)
+(defun org-texinfo-headline (headline contents info)
"Transcode an HEADLINE element from Org to Texinfo.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
(let* ((class (plist-get info :texinfo-class))
(level (org-export-get-relative-level headline info))
(numberedp (org-export-numbered-headline-p headline info))
- (class-sectionning (assoc class org-e-texinfo-classes))
+ (class-sectionning (assoc class org-texinfo-classes))
;; Find the index type, if any
(index (org-element-property :index headline))
;; Retrieve custom menu title (if any)
- (menu-title (org-e-texinfo--sanitize-menu
+ (menu-title (org-texinfo--sanitize-menu
(org-export-data
(org-element-property :texinfo-menu-title headline)
info)))
;; Retrieve headline text
- (text (org-e-texinfo--sanitize-headline
+ (text (org-texinfo--sanitize-headline
(org-element-property :title headline) info))
;; Create node info, to insert it before section formatting.
;; Use custom menu title if present
(node (format "@node %s\n"
- (org-e-texinfo--sanitize-menu
+ (org-texinfo--sanitize-menu
(replace-regexp-in-string "%" "%%"
(if (not (string= "" menu-title))
menu-title
@@ -938,25 +909,24 @@ holding contextual information."
;; will not nest properly
(menu (let* ((first (org-export-first-sibling-p headline info))
(parent (org-export-get-parent-headline headline))
- (title (org-e-texinfo--sanitize-headline
+ (title (org-texinfo--sanitize-headline
(org-element-property :title parent) info))
heading listing
(tree (plist-get info :parse-tree)))
(if first
- (org-element-map
- (plist-get info :parse-tree) 'headline
- (lambda (ref)
- (if (member title (org-element-property :title ref))
- (push ref heading)))
- info t))
- (setq listing (org-e-texinfo--build-menu
+ (org-element-map (plist-get info :parse-tree) 'headline
+ (lambda (ref)
+ (if (member title (org-element-property :title ref))
+ (push ref heading)))
+ info t))
+ (setq listing (org-texinfo--build-menu
(car heading) level info))
- (if listing
- (setq listing (replace-regexp-in-string
+ (if listing
+ (setq listing (replace-regexp-in-string
"%" "%%" listing)
listing (format
"\n@menu\n%s\n@end menu\n\n" listing))
- 'nil)))
+ 'nil)))
;; Section formatting will set two placeholders: one for the
;; title and the other for the contents.
(section-fmt
@@ -989,10 +959,10 @@ holding contextual information."
(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.
- (full-text (org-e-texinfo--sanitize-content
- (if (functionp org-e-texinfo-format-headline-function)
+ (full-text (org-texinfo--sanitize-content
+ (if (functionp org-texinfo-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-texinfo-format-headline-function
+ (funcall org-texinfo-format-headline-function
todo todo-type priority text tags)
;; Default formatting.
(concat
@@ -1004,10 +974,10 @@ holding contextual information."
(format ":%s:"
(mapconcat 'identity tags ":")))))))
(full-text-no-tag
- (org-e-texinfo--sanitize-content
- (if (functionp org-e-texinfo-format-headline-function)
+ (org-texinfo--sanitize-content
+ (if (functionp org-texinfo-format-headline-function)
;; User-defined formatting function.
- (funcall org-e-texinfo-format-headline-function
+ (funcall org-texinfo-format-headline-function
todo todo-type priority text nil)
;; Default formatting.
(concat
@@ -1082,17 +1052,17 @@ holding contextual information."
;;; Inline Src Block
-(defun org-e-texinfo-inline-src-block (inline-src-block contents info)
+(defun org-texinfo-inline-src-block (inline-src-block contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((code (org-element-property :value inline-src-block))
- (separator (org-e-texinfo--find-verb-separator code)))
+ (separator (org-texinfo--find-verb-separator code)))
(concat "@verb{" separator code separator "}")))
;;; Inlinetask
-(defun org-e-texinfo-inlinetask (inlinetask contents info)
+(defun org-texinfo-inlinetask (inlinetask contents info)
"Transcode an INLINETASK element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1105,10 +1075,10 @@ holding contextual information."
(org-export-get-tags inlinetask info)))
(priority (and (plist-get info :with-priority)
(org-element-property :priority inlinetask))))
- ;; If `org-e-texinfo-format-inlinetask-function' is provided, call it
+ ;; If `org-texinfo-format-inlinetask-function' is provided, call it
;; with appropriate arguments.
- (if (functionp org-e-texinfo-format-inlinetask-function)
- (funcall org-e-texinfo-format-inlinetask-function
+ (if (functionp org-texinfo-format-inlinetask-function)
+ (funcall org-texinfo-format-inlinetask-function
todo todo-type priority title tags contents)
;; Otherwise, use a default template.
(let ((full-title
@@ -1125,15 +1095,15 @@ holding contextual information."
;;; Italic
-(defun org-e-texinfo-italic (italic contents info)
+(defun org-texinfo-italic (italic contents info)
"Transcode ITALIC from Org to Texinfo.
CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
- (org-e-texinfo--text-markup contents 'italic))
+ (org-texinfo--text-markup contents 'italic))
;;; Item
-(defun org-e-texinfo-item (item contents info)
+(defun org-texinfo-item (item contents info)
"Transcode an ITEM element from Org to Texinfo.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1144,7 +1114,7 @@ contextual information."
;;; Keyword
-(defun org-e-texinfo-keyword (keyword contents info)
+(defun org-texinfo-keyword (keyword contents info)
"Transcode a KEYWORD element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword))
@@ -1160,14 +1130,14 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Line Break
-(defun org-e-texinfo-line-break (line-break contents info)
+(defun org-texinfo-line-break (line-break contents info)
"Transcode a LINE-BREAK object from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
"@*\n")
;;; Link
-(defun org-e-texinfo-link (link desc info)
+(defun org-texinfo-link (link desc info)
"Transcode a LINK object from Org to Texinfo.
DESC is the description part of the link, or the empty string.
@@ -1245,12 +1215,12 @@ INFO is a plist holding contextual information. See
;; External link without a description part.
(path (format "@uref{%s}" path))
;; No path, only description. Try to do something useful.
- (t (format org-e-texinfo-link-with-unknown-path-format desc)))))
+ (t (format org-texinfo-link-with-unknown-path-format desc)))))
;;; Menu
-(defun org-e-texinfo-make-menu (info level)
+(defun org-texinfo-make-menu (info level)
"Create the menu for inclusion in the texifo document.
INFO is the parsed buffer that contains the headlines. LEVEL
@@ -1258,28 +1228,19 @@ determines whether to make the main menu, or the detailed menu.
This is only used for generating the primary menu. In-Node menus
are generated directly."
- (let* ((parse (plist-get info :parse-tree))
- ;; Top determines level to build menu from, it finds the
- ;; level of the first headline in the export.
- (top (org-element-map
- parse 'headline
- (lambda (headline)
- (org-element-property :level headline)) info t)))
+ (let ((parse (plist-get info :parse-tree)))
(cond
;; Generate the main menu
- ((eq level 'main)
- (org-e-texinfo--build-menu parse top info))
+ ((eq level 'main) (org-texinfo--build-menu parse 1 info))
;; Generate the detailed (recursive) menu
((eq level 'detailed)
;; Requires recursion
- ;;(org-e-texinfo--build-detailed-menu parse top info)
- (org-e-texinfo--build-menu parse top info 'detailed))
- ;; Otherwise do nothing
- (t))))
+ ;;(org-texinfo--build-detailed-menu parse top info)
+ (org-texinfo--build-menu parse 1 info 'detailed)))))
;;; Paragraph
-(defun org-e-texinfo-paragraph (paragraph contents info)
+(defun org-texinfo-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to Texinfo.
CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel."
@@ -1287,13 +1248,13 @@ the plist used as a communication channel."
;;; Plain List
-(defun org-e-texinfo-plain-list (plain-list contents info)
+(defun org-texinfo-plain-list (plain-list contents info)
"Transcode a PLAIN-LIST element from Org to Texinfo.
CONTENTS is the contents of the list. INFO is a plist holding
contextual information."
(let* ((attr (org-export-read-attribute :attr_texinfo plain-list))
(indic (or (plist-get attr :indic)
- org-e-texinfo-def-table-markup))
+ org-texinfo-def-table-markup))
(type (org-element-property :type plain-list))
(table-type (or (plist-get attr :table-type)
"table"))
@@ -1314,12 +1275,12 @@ contextual information."
;;; Plain Text
-(defun org-e-texinfo-plain-text (text info)
+(defun org-texinfo-plain-text (text info)
"Transcode a TEXT string from Org to Texinfo.
TEXT is the string to transcode. INFO is a plist holding
contextual information."
;; First protect @, { and }.
- (let ((output (org-e-texinfo--sanitize-content text)))
+ (let ((output (org-texinfo--sanitize-content text)))
;; Activate smart quotes. Be sure to provide original TEXT string
;; since OUTPUT may have been modified.
(when (plist-get info :with-smart-quotes)
@@ -1345,7 +1306,7 @@ contextual information."
;;; Planning
-(defun org-e-texinfo-planning (planning contents info)
+(defun org-texinfo-planning (planning contents info)
"Transcode a PLANNING element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1359,21 +1320,21 @@ information."
(when closed
(concat
(format "@strong{%s} " org-closed-string)
- (format org-e-texinfo-inactive-timestamp-format
+ (format org-texinfo-inactive-timestamp-format
(org-translate-time
(org-element-property :raw-value closed))))))
(let ((deadline (org-element-property :deadline planning)))
(when deadline
(concat
(format "@strong{%s} " org-deadline-string)
- (format org-e-texinfo-active-timestamp-format
+ (format org-texinfo-active-timestamp-format
(org-translate-time
(org-element-property :raw-value deadline))))))
(let ((scheduled (org-element-property :scheduled planning)))
(when scheduled
(concat
(format "@strong{%s} " org-scheduled-string)
- (format org-e-texinfo-active-timestamp-format
+ (format org-texinfo-active-timestamp-format
(org-translate-time
(org-element-property :raw-value scheduled))))))))
" ")
@@ -1381,7 +1342,7 @@ information."
;;; Property Drawer
-(defun org-e-texinfo-property-drawer (property-drawer contents info)
+(defun org-texinfo-property-drawer (property-drawer contents info)
"Transcode a PROPERTY-DRAWER element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1391,7 +1352,7 @@ information."
;;; Quote Block
-(defun org-e-texinfo-quote-block (quote-block contents info)
+(defun org-texinfo-quote-block (quote-block contents info)
"Transcode a QUOTE-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
@@ -1403,7 +1364,7 @@ holding contextual information."
;;; Quote Section
-(defun org-e-texinfo-quote-section (quote-section contents info)
+(defun org-texinfo-quote-section (quote-section contents info)
"Transcode a QUOTE-SECTION element from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-remove-indentation
@@ -1412,7 +1373,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;; Radio Target
-(defun org-e-texinfo-radio-target (radio-target text info)
+(defun org-texinfo-radio-target (radio-target text info)
"Transcode a RADIO-TARGET object from Org to Texinfo.
TEXT is the text of the target. INFO is a plist holding
contextual information."
@@ -1423,7 +1384,7 @@ contextual information."
;;; Section
-(defun org-e-texinfo-section (section contents info)
+(defun org-texinfo-section (section contents info)
"Transcode a SECTION element from Org to Texinfo.
CONTENTS holds the contents of the section. INFO is a plist
holding contextual information."
@@ -1431,7 +1392,7 @@ holding contextual information."
;;; Special Block
-(defun org-e-texinfo-special-block (special-block contents info)
+(defun org-texinfo-special-block (special-block contents info)
"Transcode a SPECIAL-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the block. INFO is a plist used
as a communication channel."
@@ -1439,7 +1400,7 @@ as a communication channel."
;;; Src Block
-(defun org-e-texinfo-src-block (src-block contents info)
+(defun org-texinfo-src-block (src-block contents info)
"Transcode a SRC-BLOCK element from Org to Texinfo.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
@@ -1457,14 +1418,14 @@ contextual information."
;;; Statistics Cookie
-(defun org-e-texinfo-statistics-cookie (statistics-cookie contents info)
+(defun org-texinfo-statistics-cookie (statistics-cookie contents info)
"Transcode a STATISTICS-COOKIE object from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value statistics-cookie))
;;; Subscript
-(defun org-e-texinfo-subscript (subscript contents info)
+(defun org-texinfo-subscript (subscript contents info)
"Transcode a SUBSCRIPT object from Org to Texinfo.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1472,7 +1433,7 @@ contextual information."
;;; Superscript
-(defun org-e-texinfo-superscript (superscript contents info)
+(defun org-texinfo-superscript (superscript contents info)
"Transcode a SUPERSCRIPT object from Org to Texinfo.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
@@ -1480,22 +1441,22 @@ contextual information."
;;; Table
;;
-;; `org-e-texinfo-table' is the entry point for table transcoding. It
+;; `org-texinfo-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" attribute. Otherwise, it
-;; delegates the job to either `org-e-texinfo-table--table.el-table' or
-;; `org-e-texinfo-table--org-table' functions, depending of the type of
+;; delegates the job to either `org-texinfo-table--table.el-table' or
+;; `org-texinfo-table--org-table' functions, depending of the type of
;; the table.
;;
-;; `org-e-texinfo-table--align-string' is a subroutine used to build
+;; `org-texinfo-table--align-string' is a subroutine used to build
;; alignment string for Org tables.
-(defun org-e-texinfo-table (table contents info)
+(defun org-texinfo-table (table contents info)
"Transcode a TABLE element from Org to Texinfo.
CONTENTS is the contents of the table. INFO is a plist holding
contextual information."
(cond
;; Case 1: verbatim table.
- ((or org-e-texinfo-tables-verbatim
+ ((or org-texinfo-tables-verbatim
(let ((attr (mapconcat 'identity
(org-element-property :attr_latex table)
" ")))
@@ -1507,11 +1468,11 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: table.el table. Convert it using appropriate tools.
((eq (org-element-property :type table) 'table.el)
- (org-e-texinfo-table--table.el-table table contents info))
+ (org-texinfo-table--table.el-table table contents info))
;; Case 3: Standard table.
- (t (org-e-texinfo-table--org-table table contents info))))
+ (t (org-texinfo-table--org-table table contents info))))
-(defun org-e-texinfo-table-column-widths (table info)
+(defun org-texinfo-table-column-widths (table info)
"Determine the largest table cell in each column to process alignment.
TABLE is the table element to transcode. INFO is a plist used as
@@ -1536,7 +1497,7 @@ a communication channel."
(apply 'max `,@ref)) (car counts))
"} {")))
-(defun org-e-texinfo-table--org-table (table contents info)
+(defun org-texinfo-table--org-table (table contents info)
"Return appropriate Texinfo code for an Org table.
TABLE is the table type element to transcode. CONTENTS is its
@@ -1550,7 +1511,7 @@ This function assumes TABLE has `org' as its `:type' attribute."
(format "@columnfractions %s"
col-width)
(format "{%s}"
- (org-e-texinfo-table-column-widths
+ (org-texinfo-table-column-widths
table info)))))
;; Prepare the final format string for the table.
(cond
@@ -1561,7 +1522,7 @@ This function assumes TABLE has `org' as its `:type' attribute."
columns
contents))))))
-(defun org-e-texinfo-table--table.el-table (table contents info)
+(defun org-texinfo-table--table.el-table (table contents info)
"Returns nothing.
Rather than return an invalid table, nothing is returned."
@@ -1569,16 +1530,16 @@ Rather than return an invalid table, nothing is returned."
;;; Table Cell
-(defun org-e-texinfo-table-cell (table-cell contents info)
+(defun org-texinfo-table-cell (table-cell contents info)
"Transcode a TABLE-CELL element from Org to Texinfo.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
(concat (if (and contents
- org-e-texinfo-table-scientific-notation
+ org-texinfo-table-scientific-notation
(string-match orgtbl-exp-regexp contents))
;; Use appropriate format string for scientific
;; notation.
- (format org-e-texinfo-table-scientific-notation
+ (format org-texinfo-table-scientific-notation
(match-string 1 contents)
(match-string 2 contents))
contents)
@@ -1586,7 +1547,7 @@ a communication channel."
;;; Table Row
-(defun org-e-texinfo-table-row (table-row contents info)
+(defun org-texinfo-table-row (table-row contents info)
"Transcode a TABLE-ROW element from Org to Texinfo.
CONTENTS is the contents of the row. INFO is a plist used as
a communication channel."
@@ -1609,7 +1570,7 @@ a communication channel."
;;; Target
-(defun org-e-texinfo-target (target contents info)
+(defun org-texinfo-target (target contents info)
"Transcode a TARGET object from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
@@ -1618,30 +1579,30 @@ information."
;;; Timestamp
-(defun org-e-texinfo-timestamp (timestamp contents info)
+(defun org-texinfo-timestamp (timestamp contents info)
"Transcode a TIMESTAMP object from Org to Texinfo.
CONTENTS is nil. INFO is a plist holding contextual
information."
- (let ((value (org-e-texinfo-plain-text
+ (let ((value (org-texinfo-plain-text
(org-timestamp-translate timestamp) info)))
(case (org-element-property :type timestamp)
((active active-range)
- (format org-e-texinfo-active-timestamp-format value))
+ (format org-texinfo-active-timestamp-format value))
((inactive inactive-range)
- (format org-e-texinfo-inactive-timestamp-format value))
- (t (format org-e-texinfo-diary-timestamp-format value)))))
+ (format org-texinfo-inactive-timestamp-format value))
+ (t (format org-texinfo-diary-timestamp-format value)))))
;;; Verbatim
-(defun org-e-texinfo-verbatim (verbatim contents info)
+(defun org-texinfo-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to Texinfo.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-texinfo--text-markup (org-element-property :value verbatim) 'verbatim))
+ (org-texinfo--text-markup (org-element-property :value verbatim) 'verbatim))
;;; Verse Block
-(defun org-e-texinfo-verse-block (verse-block contents info)
+(defun org-texinfo-verse-block (verse-block contents info)
"Transcode a VERSE-BLOCK element from Org to Texinfo.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
@@ -1663,7 +1624,7 @@ contextual information."
;;; Interactive functions
-(defun org-e-texinfo-export-to-texinfo
+(defun org-texinfo-export-to-texinfo
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a Texinfo file.
@@ -1695,15 +1656,15 @@ Return output file's name."
(let ((outfile (org-export-output-file-name ".texi" subtreep)))
(if async
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-texinfo))
+ (lambda (f) (org-export-add-to-stack f 'texinfo))
`(expand-file-name
(org-export-to-file
- 'e-texinfo ,outfile ,subtreep ,visible-only ,body-only
+ 'texinfo ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))
(org-export-to-file
- 'e-texinfo outfile subtreep visible-only body-only ext-plist))))
+ 'texinfo outfile subtreep visible-only body-only ext-plist))))
-(defun org-e-texinfo-export-to-info
+(defun org-texinfo-export-to-info
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to Texinfo then process through to INFO.
@@ -1738,21 +1699,21 @@ Return INFO file's name."
(if async
(let ((outfile (org-export-output-file-name ".texi" subtreep)))
(org-export-async-start
- (lambda (f) (org-export-add-to-stack f 'e-texinfo))
+ (lambda (f) (org-export-add-to-stack f 'texinfo))
`(expand-file-name
- (org-e-texinfo-compile
+ (org-texinfo-compile
(org-export-to-file
- 'e-texinfo ,outfile ,subtreep ,visible-only ,body-only
+ 'texinfo ,outfile ,subtreep ,visible-only ,body-only
',ext-plist)))))
- (org-e-texinfo-compile
- (org-e-texinfo-export-to-texinfo
+ (org-texinfo-compile
+ (org-texinfo-export-to-texinfo
nil subtreep visible-only body-only ext-plist))))
-(defun org-e-texinfo-compile (file)
+(defun org-texinfo-compile (file)
"Compile a texinfo file.
FILE is the name of the file being compiled. Processing is
-done through the command specified in `org-e-texinfo-info-process'.
+done through the command specified in `org-texinfo-info-process'.
Return INFO file name or an error if it couldn't be produced."
(let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
@@ -1766,12 +1727,12 @@ Return INFO file name or an error if it couldn't be produced."
(save-window-excursion
(cond
;; A function is provided: Apply it.
- ((functionp org-e-texinfo-info-process)
- (funcall org-e-texinfo-info-process (shell-quote-argument file)))
+ ((functionp org-texinfo-info-process)
+ (funcall org-texinfo-info-process (shell-quote-argument file)))
;; A list is provided: Replace %b, %f and %o with appropriate
;; values in each command before applying it. Output is
;; redirected to "*Org INFO Texinfo Output*" buffer.
- ((consp org-e-texinfo-info-process)
+ ((consp org-texinfo-info-process)
(let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
(mapc
(lambda (command)
@@ -1783,9 +1744,9 @@ Return INFO file name or an error if it couldn't be produced."
(replace-regexp-in-string
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
outbuf))
- org-e-texinfo-info-process)
+ org-texinfo-info-process)
;; Collect standard errors from output buffer.
- (setq errors (org-e-texinfo-collect-errors outbuf))))
+ (setq errors (org-texinfo-collect-errors outbuf))))
(t (error "No valid command to process to Info")))
(let ((infofile (concat out-dir base-name ".info")))
;; Check for process failure. Provide collected errors if
@@ -1801,7 +1762,7 @@ Return INFO file name or an error if it couldn't be produced."
;; Return output file name.
infofile))))
-(defun org-e-texinfo-collect-errors (buffer)
+(defun org-texinfo-collect-errors (buffer)
"Collect some kind of errors from \"makeinfo\" command output.
BUFFER is the buffer containing output.
@@ -1838,5 +1799,11 @@ none."
(setq errors (concat errors " [syntax error]")))
(and (org-string-nw-p errors) (org-trim errors)))))))
-(provide 'org-e-texinfo)
-;;; org-e-texinfo.el ends here
+
+(provide 'ox-texinfo)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox-texinfo.el ends here
diff --git a/contrib/lisp/org-export.el b/lisp/ox.el
index 54b5c2e..41e1917 100644
--- a/contrib/lisp/org-export.el
+++ b/lisp/ox.el
@@ -1,4 +1,4 @@
-;;; org-export.el --- Generic Export Engine For Org
+;;; ox.el --- Generic Export Engine for Org Mode
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
@@ -80,14 +80,14 @@
(require 'org-element)
(require 'ob-exp)
-(declare-function org-e-publish "org-e-publish" (project &optional force async))
-(declare-function org-e-publish-all "org-e-publish" (&optional force async))
+(declare-function org-publish "ox-publish" (project &optional force async))
+(declare-function org-publish-all "ox-publish" (&optional force async))
(declare-function
- org-e-publish-current-file "org-e-publish" (&optional force async))
-(declare-function org-e-publish-current-project "org-e-publish"
+ org-publish-current-file "ox-publish" (&optional force async))
+(declare-function org-publish-current-project "ox-publish"
(&optional force async))
-(defvar org-e-publish-project-alist)
+(defvar org-publish-project-alist)
(defvar org-table-number-fraction)
(defvar org-table-number-regexp)
@@ -129,6 +129,7 @@
(:with-fixed-width nil ":" org-export-with-fixed-width)
(:with-footnotes nil "f" org-export-with-footnotes)
(:with-inlinetasks nil "inline" org-export-with-inlinetasks)
+ (:with-latex nil "tex" org-export-with-latex)
(:with-plannings nil "p" org-export-with-planning)
(:with-priority nil "pri" org-export-with-priority)
(:with-smart-quotes nil "'" org-export-with-smart-quotes)
@@ -170,7 +171,7 @@ All these properties should be back-end agnostic. Back-end
specific properties are set through `org-export-define-backend'.
Properties redefined there have precedence over these.")
-(defconst org-export-special-keywords '("FILETAGS" "SETUP_FILE" "OPTIONS")
+(defconst org-export-special-keywords '("FILETAGS" "SETUPFILE" "OPTIONS")
"List of in-buffer keywords that require special treatment.
These keywords are not directly associated to a property. The
way they are handled must be hard-coded into
@@ -371,12 +372,14 @@ e.g. \"date:nil\".")
:group 'org-export-general
:type '(string :tag "Creator string"))
-(defcustom org-export-with-drawers t
+(defcustom org-export-with-drawers '(not "LOGBOOK")
"Non-nil means export contents of standard drawers.
When t, all drawers are exported. This may also be a list of
-drawer names to export. This variable doesn't apply to
-properties drawers.
+drawer names to export. If that list starts with `not', only
+drawers with such names will be ignored.
+
+This variable doesn't apply to properties drawers.
This option can also be set with the #+OPTIONS line,
e.g. \"d:nil\"."
@@ -385,7 +388,12 @@ e.g. \"d:nil\"."
(const :tag "All drawers" t)
(const :tag "None" nil)
(repeat :tag "Selected drawers"
- (string :tag "Drawer name"))))
+ (string :tag "Drawer name"))
+ (list :tag "Ignored drawers"
+ (const :format "" not)
+ (repeat :tag "Specify names of drawers to ignore during export"
+ :inline t
+ (string :tag "Drawer name")))))
(defcustom org-export-with-email nil
"Non-nil means insert author email into the exported file.
@@ -428,7 +436,7 @@ will be looking just like this in also HTML. See also the QUOTE
keyword. Not all export backends support this.
This option can also be set with the #+OPTIONS line, e.g. \"::nil\"."
- :group 'org-export-translation
+ :group 'org-export-general
:type 'boolean)
(defcustom org-export-with-footnotes t
@@ -438,10 +446,26 @@ e.g. \"f:nil\"."
:group 'org-export-general
:type 'boolean)
+(defcustom org-export-with-latex t
+ "Non-nil means process LaTeX environments and fragments.
+
+This option can also be set with the +OPTIONS line,
+e.g. \"tex:verbatim\". Allowed values are:
+
+nil Ignore math snippets.
+`verbatim' Keep everything in verbatim.
+t Allow export of math snippets."
+ :group 'org-export-general
+ :type '(choice
+ (const :tag "Do not process math in any way" nil)
+ (const :tag "Interpret math snippets" t)
+ (const :tag "Leave math verbatim" verbatim)))
+
(defcustom org-export-headline-levels 3
"The last level which is still exported as a headline.
-Inferior levels will produce itemize lists when exported.
+Inferior levels will produce itemize or enumerate lists when
+exported.
This option can also be set with the #+OPTIONS line, e.g. \"H:2\"."
:group 'org-export-general
@@ -456,9 +480,6 @@ This may have an association in
(defcustom org-export-preserve-breaks nil
"Non-nil means preserve all line breaks when exporting.
-
-Normally, in HTML output paragraphs will be reformatted.
-
This option can also be set with the #+OPTIONS line,
e.g. \"\\n:t\"."
:group 'org-export-general
@@ -679,29 +700,25 @@ When nil, remove all these keywords from the export."
:group 'org-export-general
:type 'boolean)
-(defcustom org-export-allow-BIND 'confirm
- "Non-nil means allow #+BIND to define local variable values for export.
-This is a potential security risk, which is why the user must
-confirm the use of these lines."
+(defcustom org-export-allow-bind-keywords nil
+ "Non-nil means BIND keywords can define local variable values.
+This is a potential security risk, which is why the default value
+is nil. You can also allow them through local buffer variables."
:group 'org-export-general
- :type '(choice
- (const :tag "Never" nil)
- (const :tag "Always" t)
- (const :tag "Ask a confirmation for each file" confirm)))
+ :type 'boolean)
(defcustom org-export-snippet-translation-alist nil
"Alist between export snippets back-ends and exporter back-ends.
This variable allows to provide shortcuts for export snippets.
-For example, with a value of '\(\(\"h\" . \"e-html\"\)\), the
+For example, with a value of '\(\(\"h\" . \"html\"\)\), the
HTML back-end will recognize the contents of \"@@h:<b>@@\" as
HTML code while every other back-end will ignore it."
:group 'org-export-general
:type '(repeat
- (cons
- (string :tag "Shortcut")
- (string :tag "Back-end"))))
+ (cons (string :tag "Shortcut")
+ (string :tag "Back-end"))))
(defcustom org-export-coding-system nil
"Coding system for the exported file."
@@ -733,8 +750,8 @@ these cases."
(defcustom org-export-in-background nil
"Non-nil means export and publishing commands will run in background.
-Results from an asynchronous export are never displayed. You can
-retrieve them with \\[org-export-stack]."
+Results from an asynchronous export are never displayed
+automatically. But you can retrieve them with \\[org-export-stack]."
:group 'org-export-general
:type 'boolean)
@@ -746,15 +763,28 @@ process faster and the export more portable."
:group 'org-export-general
:type '(file :must-match t))
+(defcustom org-export-invisible-backends nil
+ "List of back-ends that shouldn't appear in the dispatcher.
+
+Any back-end belonging to this list or derived from a back-end
+belonging to it will not appear in the dispatcher menu.
+
+Indeed, Org may require some export back-ends without notice. If
+these modules are never to be used interactively, adding them
+here will avoid cluttering the dispatcher menu."
+ :group 'org-export-general
+ :type '(repeat (symbol :tag "Back-End")))
+
(defcustom org-export-dispatch-use-expert-ui nil
"Non-nil means using a non-intrusive `org-export-dispatch'.
In that case, no help buffer is displayed. Though, an indicator
for current export scope is added to the prompt (\"b\" when
output is restricted to body only, \"s\" when it is restricted to
the current subtree, \"v\" when only visible elements are
-considered for export and \"f\" when publishing functions should
-be passed the FORCE argument). Also, \[?] allows to switch back
-to standard mode."
+considered for export, \"f\" when publishing functions should be
+passed the FORCE argument and \"a\" when the export should be
+asynchronous). Also, \[?] allows to switch back to standard
+mode."
:group 'org-export-general
:type 'boolean)
@@ -873,19 +903,19 @@ keywords are understood:
or
\(?l \"Export to LaTeX\"
- \(?p \"As PDF file\" org-e-latex-export-to-pdf)
+ \(?p \"As PDF file\" org-latex-export-to-pdf)
\(?o \"As PDF file and open\"
\(lambda (a s v b)
- \(if a (org-e-latex-export-to-pdf t s v b)
+ \(if a (org-latex-export-to-pdf t s v b)
\(org-open-file
- \(org-e-latex-export-to-pdf nil s v b)))))))
+ \(org-latex-export-to-pdf nil s v b)))))))
or the following, which will be added to the previous
sub-menu,
\(?l 1
- \((?B \"As TEX buffer (Beamer)\" org-e-beamer-export-as-latex)
- \(?P \"As PDF file (Beamer)\" org-e-beamer-export-to-pdf)))
+ \((?B \"As TEX buffer (Beamer)\" org-beamer-export-as-latex)
+ \(?P \"As PDF file (Beamer)\" org-beamer-export-to-pdf)))
:options-alist
@@ -969,10 +999,9 @@ keywords are understood:
about transcoders.
As an example, here is how one could define \"my-latex\" back-end
-as a variant of `e-latex' back-end with a custom template
-function:
+as a variant of `latex' back-end with a custom template function:
- \(org-export-define-derived-backend my-latex e-latex
+ \(org-export-define-derived-backend my-latex latex
:translate-alist ((template . my-latex-template-fun)))
The back-end could then be called with, for example:
@@ -980,7 +1009,6 @@ The back-end could then be called with, for example:
\(org-export-to-buffer 'my-latex \"*Test my-latex*\")"
(declare (debug (&define name sexp [&rest [keywordp sexp]] def-body))
(indent 2))
- (org-export-barf-if-invalid-backend parent)
(let (export-block filters menu-entry options translators contents)
(while (keywordp (car body))
(case (pop body)
@@ -1003,6 +1031,7 @@ The back-end could then be called with, for example:
(list :options-alist (append options p-options)))
(and menu-entry (list :menu-entry menu-entry))))
`(progn
+ (org-export-barf-if-invalid-backend ',parent)
;; Register back-end.
(let ((registeredp (assq ',child org-export-registered-backends)))
(if registeredp (setcdr registeredp ',contents)
@@ -1017,6 +1046,10 @@ The back-end could then be called with, for example:
;; Splice in the body, if any.
,@body)))
+(defun org-export-backend-parent (backend)
+ "Return back-end from which BACKEND is derived, or nil."
+ (plist-get (cdr (assq backend org-export-registered-backends)) :parent))
+
(defun org-export-backend-filters (backend)
"Return filters for BACKEND."
(plist-get (cdr (assq backend org-export-registered-backends))
@@ -1046,10 +1079,7 @@ The back-end could then be called with, for example:
"Non-nil if BACKEND is derived from one of BACKENDS."
(let ((parent backend))
(while (and (not (memq parent backends))
- (setq parent
- (plist-get (cdr (assq parent
- org-export-registered-backends))
- :parent))))
+ (setq parent (org-export-backend-parent parent))))
parent))
@@ -1190,12 +1220,6 @@ The back-end could then be called with, for example:
;; - category :: option
;; - type :: list of strings
;;
-;; + `:target-list' :: List of targets encountered in the parse tree.
-;; This is used to partly resolve "fuzzy" links
-;; (cf. `org-export-resolve-fuzzy-link').
-;; - category :: tree
-;; - type :: list of strings
-;;
;; + `:time-stamp-file' :: Non-nil means transcoding should insert
;; a time stamp in the output.
;; - category :: option
@@ -1234,7 +1258,8 @@ The back-end could then be called with, for example:
;;
;; + `:with-drawers' :: Non-nil means drawers should be exported. If
;; its value is a list of names, only drawers with such names
-;; will be transcoded.
+;; will be transcoded. If that list starts with `not', drawer
+;; with these names will be skipped.
;; - category :: option
;; - type :: symbol (nil, t) or list of strings
;;
@@ -1258,6 +1283,12 @@ The back-end could then be called with, for example:
;; - category :: option
;; - type :: symbol (nil, t)
;;
+;; + `:with-latex' :: Non-nil means `latex-environment' elements and
+;; `latex-fragment' objects should appear in export output. When
+;; this property is set to `verbatim', they will be left as-is.
+;; - category :: option
+;; - symbol (`verbatim', nil, t)
+;;
;; + `:with-plannings' :: Non-nil means transcoding should include
;; planning info.
;; - category :: option
@@ -1417,25 +1448,24 @@ inferior to file-local settings."
"Parse an OPTIONS line and return values as a plist.
Optional argument BACKEND is a symbol specifying which back-end
specific items to read, if any."
- (let* ((all (append org-export-options-alist
- (and backend (org-export-backend-options backend))))
- ;; Build an alist between #+OPTION: item and property-name.
- (alist (delq nil
- (mapcar (lambda (e)
- (when (nth 2 e) (cons (regexp-quote (nth 2 e))
- (car e))))
- all)))
+ (let* ((all
+ ;; Priority is given to back-end specific options.
+ (append (and backend (org-export-backend-options backend))
+ org-export-options-alist))
plist)
- (mapc (lambda (e)
- (when (string-match (concat "\\(\\`\\|[ \t]\\)"
- (car e)
- ":\\(([^)\n]+)\\|[^ \t\n\r;,.]*\\)")
- options)
- (setq plist (plist-put plist
- (cdr e)
- (car (read-from-string
- (match-string 2 options)))))))
- alist)
+ (dolist (option all)
+ (let ((property (car option))
+ (item (nth 2 option)))
+ (when (and item
+ (not (plist-member plist property))
+ (string-match (concat "\\(\\`\\|[ \t]\\)"
+ (regexp-quote item)
+ ":\\(([^)\n]+)\\|[^ \t\n\r;,.]*\\)")
+ options))
+ (setq plist (plist-put plist
+ property
+ (car (read-from-string
+ (match-string 2 options))))))))
plist))
(defun org-export--get-subtree-options (&optional backend)
@@ -1468,29 +1498,30 @@ for export. Return options as a plist."
(let ((seen '("TITLE")))
(mapc
(lambda (option)
- (let ((property (nth 1 option)))
- (when (and property (not (member property seen)))
- (let* ((subtree-prop (concat "EXPORT_" property))
+ (let ((property (car option))
+ (keyword (nth 1 option)))
+ (when (and keyword (not (member keyword seen)))
+ (let* ((subtree-prop (concat "EXPORT_" keyword))
;; Export properties are not case-sensitive.
(value (let ((case-fold-search t))
(org-entry-get (point) subtree-prop))))
- (push property seen)
- (when value
+ (push keyword seen)
+ (when (and value (not (plist-member plist property)))
(setq plist
(plist-put
plist
- (car option)
+ property
(cond
;; Parse VALUE if required.
- ((member property org-element-document-properties)
+ ((member keyword org-element-document-properties)
(org-element-parse-secondary-string
value (org-element-restriction 'keyword)))
;; If BEHAVIOUR is `split' expected value is
;; a list of strings, not a string.
((eq (nth 4 option) 'split) (org-split-string value))
(t value)))))))))
- ;; Also look for both general keywords and back-end specific
- ;; options if BACKEND is provided.
+ ;; Look for both general keywords and back-end specific
+ ;; options, with priority given to the latter.
(append (and backend (org-export-backend-options backend))
org-export-options-alist)))
;; Return value.
@@ -1520,7 +1551,7 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(val (org-element-property :value element))
(prop
(cond
- ((equal key "SETUP_FILE")
+ ((equal key "SETUPFILE")
(let ((file
(expand-file-name
(org-remove-double-quotes (org-trim val)))))
@@ -1540,49 +1571,52 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(plist-get plist :filetags))))))))
(setq plist (org-combine-plists plist prop)))))))
;; 2. Standard options, as in `org-export-options-alist'.
- (let* ((all (append org-export-options-alist
- ;; Also look for back-end specific options if
- ;; BACKEND is defined.
- (and backend (org-export-backend-options backend))))
- ;; Build ALIST between keyword name and property name.
- (alist
- (delq nil (mapcar
- (lambda (e) (when (nth 1 e) (cons (nth 1 e) (car e))))
- all)))
- ;; Build regexp matching all keywords associated to export
- ;; options. Note: the search is case insensitive.
- (opt-re (format "^[ \t]*#\\+%s:"
- (regexp-opt
- (delq nil (mapcar (lambda (e) (nth 1 e)) all))))))
- (goto-char (point-min))
- (while (re-search-forward opt-re nil t)
- (let ((element (org-element-at-point)))
- (when (eq (org-element-type element) 'keyword)
- (let* ((key (org-element-property :key element))
- (val (org-element-property :value element))
- (prop (cdr (assoc key alist)))
- (behaviour (nth 4 (assq prop all))))
- (setq plist
- (plist-put
- plist prop
- ;; Handle value depending on specified BEHAVIOUR.
- (case behaviour
- (space
- (if (not (plist-get plist prop)) (org-trim val)
- (concat (plist-get plist prop) " " (org-trim val))))
- (newline
- (org-trim
- (concat (plist-get plist prop) "\n" (org-trim val))))
- (split
- `(,@(plist-get plist prop) ,@(org-split-string val)))
- ('t val)
- (otherwise (if (not (plist-member plist prop)) val
- (plist-get plist prop))))))))))
+ (let* ((all (append
+ ;; Priority is given to back-end specific options.
+ (and backend (org-export-backend-options backend))
+ org-export-options-alist)))
+ (dolist (option all)
+ (let ((prop (car option)))
+ (when (and (nth 1 option) (not (plist-member plist prop)))
+ (goto-char (point-min))
+ (let ((opt-re (format "^[ \t]*#\\+%s:" (nth 1 option)))
+ (behaviour (nth 4 option)))
+ (while (re-search-forward opt-re nil t)
+ (let ((element (org-element-at-point)))
+ (when (eq (org-element-type element) 'keyword)
+ (let((key (org-element-property :key element))
+ (val (org-element-property :value element)))
+ (setq plist
+ (plist-put
+ plist (car option)
+ ;; Handle value depending on specified
+ ;; BEHAVIOUR.
+ (case behaviour
+ (space
+ (if (not (plist-get plist prop)) (org-trim val)
+ (concat (plist-get plist prop)
+ " "
+ (org-trim val))))
+ (newline
+ (org-trim (concat (plist-get plist prop)
+ "\n"
+ (org-trim val))))
+ (split `(,@(plist-get plist prop)
+ ,@(org-split-string val)))
+ ('t val)
+ (otherwise
+ (if (not (plist-member plist prop)) val
+ (plist-get plist prop))))))))))))))
;; Parse keywords specified in
;; `org-element-document-properties'.
(mapc
(lambda (key)
- (let* ((prop (cdr (assoc key alist)))
+ ;; Find the property associated to the keyword.
+ (let* ((prop (catch 'found
+ (mapc (lambda (option)
+ (when (equal (nth 1 option) key)
+ (throw 'found (car option))))
+ all)))
(value (and prop (plist-get plist prop))))
(when (stringp value)
(setq plist
@@ -1611,59 +1645,49 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
Optional argument BACKEND, if non-nil, is a symbol specifying
which back-end specific export options should also be read in the
process."
- (let ((all (append org-export-options-alist
- (and backend (org-export-backend-options backend))))
- ;; Output value.
+ (let ((all
+ ;; Priority is given to back-end specific options.
+ (append (and backend (org-export-backend-options backend))
+ org-export-options-alist))
plist)
(mapc
(lambda (cell)
- (setq plist
- (plist-put
- plist
- (car cell)
- ;; Eval default value provided. If keyword is a member
- ;; of `org-element-document-properties', parse it as
- ;; a secondary string before storing it.
- (let ((value (eval (nth 3 cell))))
- (if (not (stringp value)) value
- (let ((keyword (nth 1 cell)))
- (if (not (member keyword org-element-document-properties))
- value
- (org-element-parse-secondary-string
- value (org-element-restriction 'keyword)))))))))
+ (let ((prop (car cell)))
+ (unless (plist-member plist prop)
+ (setq plist
+ (plist-put
+ plist
+ prop
+ ;; Eval default value provided. If keyword is a member
+ ;; of `org-element-document-properties', parse it as
+ ;; a secondary string before storing it.
+ (let ((value (eval (nth 3 cell))))
+ (if (not (stringp value)) value
+ (let ((keyword (nth 1 cell)))
+ (if (not (member keyword org-element-document-properties))
+ value
+ (org-element-parse-secondary-string
+ value (org-element-restriction 'keyword)))))))))))
all)
;; Return value.
plist))
-(defvar org-export--allow-BIND-local nil)
-(defun org-export--confirm-letbind ()
- "Can we use #+BIND values during export?
-By default this will ask for confirmation by the user, to divert
-possible security risks."
- (cond
- ((not org-export-allow-BIND) nil)
- ((eq org-export-allow-BIND t) t)
- ((local-variable-p 'org-export--allow-BIND-local)
- org-export--allow-BIND-local)
- (t (org-set-local 'org-export--allow-BIND-local
- (yes-or-no-p "Allow BIND values in this buffer? ")))))
-
(defun org-export--install-letbind-maybe ()
"Install the values from #+BIND lines as local variables.
Variables must be installed before in-buffer options are
retrieved."
- (let ((case-fold-search t) letbind pair)
- (org-with-wide-buffer
- (goto-char (point-min))
- (while (re-search-forward "^[ \t]*#\\+BIND:" nil t)
- (let* ((element (org-element-at-point))
- (value (org-element-property :value element)))
- (when (and (eq (org-element-type element) 'keyword)
- (not (equal value ""))
- (org-export--confirm-letbind))
- (push (read (format "(%s)" value)) letbind)))))
- (dolist (pair (nreverse letbind))
- (org-set-local (car pair) (nth 1 pair)))))
+ (when org-export-allow-bind-keywords
+ (let ((case-fold-search t) letbind)
+ (org-with-wide-buffer
+ (goto-char (point-min))
+ (while (re-search-forward "^[ \t]*#\\+BIND:" nil t)
+ (let* ((element (org-element-at-point))
+ (value (org-element-property :value element)))
+ (when (and (eq (org-element-type element) 'keyword)
+ (not (equal value "")))
+ (push (read (format "(%s)" value)) letbind)))))
+ (dolist (pair (nreverse letbind))
+ (org-set-local (car pair) (nth 1 pair))))))
;;;; Tree Properties
@@ -1706,8 +1730,6 @@ Following tree properties are set or updated:
`:ignore-list' List of elements that should be ignored during
export.
-`:target-list' List of all targets in the parse tree.
-
Return updated plist."
;; Install the parse tree in the communication channel, in order to
;; use `org-export-get-genealogy' and al.
@@ -1732,24 +1754,16 @@ Return updated plist."
;; This way, definitions in `footnote-definition-alist' are bound to
;; match those in the parse tree.
(let ((defs (plist-get info :footnote-definition-alist)))
- (org-element-map
- data 'footnote-definition
- (lambda (fn)
- (push (cons (org-element-property :label fn)
- `(org-data nil ,@(org-element-contents fn)))
- defs)))
+ (org-element-map data 'footnote-definition
+ (lambda (fn)
+ (push (cons (org-element-property :label fn)
+ `(org-data nil ,@(org-element-contents fn)))
+ defs)))
(setq info (plist-put info :footnote-definition-alist defs)))
;; Properties order doesn't matter: get the rest of the tree
;; properties.
(nconc
- `(:target-list
- ,(org-element-map
- data '(keyword target)
- (lambda (blob)
- (when (or (eq (org-element-type blob) 'target)
- (string= (org-element-property :key blob) "TARGET"))
- blob)) info)
- :headline-numbering ,(org-export--collect-headline-numbering data info)
+ `(:headline-numbering ,(org-export--collect-headline-numbering data info)
:exported-data ,(make-hash-table :test 'eq :size 4001))
info))
@@ -1780,20 +1794,18 @@ options.
Return an alist whose key is an headline and value is its
associated numbering \(in the shape of a list of numbers\)."
(let ((numbering (make-vector org-export-max-depth 0)))
- (org-element-map
- data
- 'headline
- (lambda (headline)
- (let ((relative-level
- (1- (org-export-get-relative-level headline options))))
- (cons
- headline
- (loop for n across numbering
- for idx from 0 to org-export-max-depth
- when (< idx relative-level) collect n
- when (= idx relative-level) collect (aset numbering idx (1+ n))
- when (> idx relative-level) do (aset numbering idx 0)))))
- options)))
+ (org-element-map data 'headline
+ (lambda (headline)
+ (let ((relative-level
+ (1- (org-export-get-relative-level headline options))))
+ (cons
+ headline
+ (loop for n across numbering
+ for idx from 0 to org-export-max-depth
+ when (< idx relative-level) collect n
+ when (= idx relative-level) collect (aset numbering idx (1+ n))
+ when (> idx relative-level) do (aset numbering idx 0)))))
+ options)))
(defun org-export--populate-ignore-list (data options)
"Return list of elements and objects to ignore during export.
@@ -1865,10 +1877,17 @@ tag."
(case (org-element-type blob)
(clock (not (plist-get options :with-clocks)))
(drawer
- (or (not (plist-get options :with-drawers))
- (and (consp (plist-get options :with-drawers))
- (not (member (org-element-property :drawer-name blob)
- (plist-get options :with-drawers))))))
+ (let ((with-drawers-p (plist-get options :with-drawers)))
+ (or (not with-drawers-p)
+ (and (consp with-drawers-p)
+ ;; If `:with-drawers' value starts with `not', ignore
+ ;; every drawer whose name belong to that list.
+ ;; Otherwise, ignore drawers whose name isn't in that
+ ;; list.
+ (let ((name (org-element-property :drawer-name blob)))
+ (if (eq (car with-drawers-p) 'not)
+ (member-ignore-case name (cdr with-drawers-p))
+ (not (member-ignore-case name with-drawers-p))))))))
(headline
(let ((with-tasks (plist-get options :with-tasks))
(todo (org-element-property :todo-keyword blob))
@@ -1893,6 +1912,7 @@ tag."
(not (eq todo-type with-tasks)))
(and (consp with-tasks) (not (member todo with-tasks))))))))
(inlinetask (not (plist-get options :with-inlinetasks)))
+ ((latex-environment latex-fragment) (not (plist-get options :with-latex)))
(planning (not (plist-get options :with-plannings)))
(statistics-cookie (not (plist-get options :with-statistics-cookies)))
(table-cell
@@ -2084,9 +2104,9 @@ recursively convert DATA using BACKEND translation table."
data (org-export-backend-translate-table backend) info))
(defun org-export--interpret-p (blob info)
- "Non-nil if element or object BLOB should be interpreted as Org syntax.
-Check is done according to export options INFO, stored as
-a plist."
+ "Non-nil if element or object BLOB should be interpreted during export.
+If nil, BLOB will appear as raw Org syntax. Check is done
+according to export options INFO, stored as a plist."
(case (org-element-type blob)
;; ... entities...
(entity (plist-get info :with-entities))
@@ -2098,6 +2118,10 @@ a plist."
;; ... footnotes...
((footnote-definition footnote-reference)
(plist-get info :with-footnotes))
+ ;; ... LaTeX environments and fragments...
+ ((latex-environment latex-fragment)
+ (let ((with-latex-p (plist-get info :with-latex)))
+ (and with-latex-p (not (eq with-latex-p 'verbatim)))))
;; ... sub/superscripts...
((subscript superscript)
(let ((sub/super-p (plist-get info :with-sub-superscript)))
@@ -2615,8 +2639,10 @@ Return the updated communication channel."
;;; Core functions
;;
;; This is the room for the main function, `org-export-as', along with
-;; its derivatives, `org-export-to-buffer' and `org-export-to-file'.
-;; They differ only by the way they output the resulting code.
+;; its derivatives, `org-export-to-buffer', `org-export-to-file' and
+;; `org-export-string-as'. They differ either by the way they output
+;; the resulting code (for the first two) or by the input type (for
+;; the latter).
;;
;; `org-export-output-file-name' is an auxiliary function meant to be
;; used with `org-export-to-file'. With a given extension, it tries
@@ -2637,6 +2663,7 @@ Return the updated communication channel."
;; why file inclusion should be done before any structure can be
;; associated to the file, that is before parsing.
+;;;###autoload
(defun org-export-as
(backend &optional subtreep visible-only body-only ext-plist)
"Transcode current Org buffer into BACKEND code.
@@ -2654,7 +2681,7 @@ When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
When optional argument BODY-ONLY is non-nil, only return body
-code, without preamble nor postamble.
+code, without surrounding template.
Optional argument EXT-PLIST, when provided, is a property list
with external parameters overriding Org default settings, but
@@ -2726,31 +2753,28 @@ Return code as a string."
(setq tree
(org-export-filter-apply-functions
(plist-get info :filter-parse-tree)
- (org-element-parse-buffer nil visible-only) info)))
- ;; Now tree is complete, compute its properties and add them
- ;; to communication channel.
- (setq info
- (org-combine-plists
- info (org-export-collect-tree-properties tree info)))
- ;; Eventually transcode TREE. Wrap the resulting string into
- ;; a template, if required. Finally call final-output filter.
- (let* ((body (org-element-normalize-string
+ (org-element-parse-buffer nil visible-only) info))
+ ;; Now tree is complete, compute its properties and add them
+ ;; to communication channel.
+ (setq info
+ (org-combine-plists
+ info (org-export-collect-tree-properties tree info)))
+ ;; Eventually transcode TREE. Wrap the resulting string into
+ ;; a template, if needed. Finally call final-output filter.
+ (let ((body (org-element-normalize-string
(or (org-export-data tree info) "")))
(template (cdr (assq 'template
- (plist-get info :translate-alist))))
- ;; Remove all text properties since they cannot be
- ;; retrieved from an external process.
- (output (org-no-properties
- (org-export-filter-apply-functions
- (plist-get info :filter-final-output)
- (if (or (not (functionp template)) body-only) body
- (funcall template body info))
- info))))
- ;; Maybe add final OUTPUT to kill ring, then return it.
- (when (and org-export-copy-to-kill-ring (org-string-nw-p output))
- (org-kill-new output))
- output)))))
+ (plist-get info :translate-alist)))))
+ ;; Remove all text properties since they cannot be
+ ;; retrieved from an external process, and return result.
+ (org-no-properties
+ (org-export-filter-apply-functions
+ (plist-get info :filter-final-output)
+ (if (or (not (functionp template)) body-only) body
+ (funcall template body info))
+ info))))))))
+;;;###autoload
(defun org-export-to-buffer
(backend buffer &optional subtreep visible-only body-only ext-plist)
"Call `org-export-as' with output to a specified buffer.
@@ -2764,15 +2788,21 @@ Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
EXT-PLIST are similar to those used in `org-export-as', which
see.
-Return buffer."
+If `org-export-copy-to-kill-ring' is non-nil, add buffer contents
+to kill ring. Return buffer."
(let ((out (org-export-as backend subtreep visible-only body-only ext-plist))
(buffer (get-buffer-create buffer)))
(with-current-buffer buffer
(erase-buffer)
(insert out)
(goto-char (point-min)))
+ ;; Maybe add buffer contents to kill ring.
+ (when (and org-export-copy-to-kill-ring (org-string-nw-p out))
+ (org-kill-new out))
+ ;; Return buffer.
buffer))
+;;;###autoload
(defun org-export-to-file
(backend file &optional subtreep visible-only body-only ext-plist)
"Call `org-export-as' with output to a specified file.
@@ -2784,7 +2814,8 @@ Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
EXT-PLIST are similar to those used in `org-export-as', which
see.
-Return output file's name."
+If `org-export-copy-to-kill-ring' is non-nil, add file contents
+to kill ring. Return output file's name."
;; Checks for FILE permissions. `write-file' would do the same, but
;; we'd rather avoid needless transcoding of parse tree.
(unless (file-writable-p file) (error "Output file not writable"))
@@ -2793,10 +2824,30 @@ Return output file's name."
(with-temp-buffer
(insert out)
(let ((coding-system-for-write org-export-coding-system))
- (write-file file))))
+ (write-file file)))
+ ;; Maybe add file contents to kill ring.
+ (when (and org-export-copy-to-kill-ring (org-string-nw-p out))
+ (org-kill-new out)))
;; Return full path.
file)
+;;;###autoload
+(defun org-export-string-as (string backend &optional body-only ext-plist)
+ "Transcode STRING into BACKEND code.
+
+When optional argument BODY-ONLY is non-nil, only return body
+code, without preamble nor postamble.
+
+Optional argument EXT-PLIST, when provided, is a property list
+with external parameters overriding Org default settings, but
+still inferior to file-local settings.
+
+Return code as a string."
+ (with-temp-buffer
+ (insert string)
+ (org-mode)
+ (org-export-as backend nil nil body-only ext-plist)))
+
(defun org-export-output-file-name (extension &optional subtreep pub-dir)
"Return output file's name according to buffer specifications.
@@ -3086,9 +3137,7 @@ file should have."
(org-element-normalize-string (buffer-string))))
(defun org-export-execute-babel-code ()
- "Execute every Babel code in the visible part of current buffer.
-This function will return an error if the current buffer is
-visiting a file."
+ "Execute every Babel code in the visible part of current buffer."
;; Get a pristine copy of current buffer so Babel references can be
;; properly resolved.
(let ((reference (org-export-copy-buffer)))
@@ -3213,22 +3262,21 @@ footnotes. Unreferenced definitions are ignored."
(function
(lambda (data)
;; Collect footnote number, label and definition in DATA.
- (org-element-map
- data 'footnote-reference
- (lambda (fn)
- (when (org-export-footnote-first-reference-p fn info)
- (let ((def (org-export-get-footnote-definition fn info)))
- (push
- (list (org-export-get-footnote-number fn info)
- (org-element-property :label fn)
- def)
- num-alist)
- ;; Also search in definition for nested footnotes.
- (when (eq (org-element-property :type fn) 'standard)
- (funcall collect-fn def)))))
- ;; Don't enter footnote definitions since it will happen
- ;; when their first reference is found.
- info nil 'footnote-definition)))))
+ (org-element-map data 'footnote-reference
+ (lambda (fn)
+ (when (org-export-footnote-first-reference-p fn info)
+ (let ((def (org-export-get-footnote-definition fn info)))
+ (push
+ (list (org-export-get-footnote-number fn info)
+ (org-element-property :label fn)
+ def)
+ num-alist)
+ ;; Also search in definition for nested footnotes.
+ (when (eq (org-element-property :type fn) 'standard)
+ (funcall collect-fn def)))))
+ ;; Don't enter footnote definitions since it will happen
+ ;; when their first reference is found.
+ info nil 'footnote-definition)))))
(funcall collect-fn (plist-get info :parse-tree))
(reverse num-alist)))
@@ -3246,24 +3294,23 @@ INFO is the plist used as a communication channel."
(search-refs
(function
(lambda (data)
- (org-element-map
- data 'footnote-reference
- (lambda (fn)
- (cond
- ((string= (org-element-property :label fn) label)
- (throw 'exit fn))
- ;; If FN isn't inlined, be sure to traverse its
- ;; definition before resuming search. See
- ;; comments in `org-export-get-footnote-number'
- ;; for more information.
- ((eq (org-element-property :type fn) 'standard)
- (funcall search-refs
- (org-export-get-footnote-definition fn info)))))
- ;; Don't enter footnote definitions since it will
- ;; happen when their first reference is found.
- info 'first-match 'footnote-definition)))))
+ (org-element-map data 'footnote-reference
+ (lambda (fn)
+ (cond
+ ((string= (org-element-property :label fn) label)
+ (throw 'exit fn))
+ ;; If FN isn't inlined, be sure to traverse its
+ ;; definition before resuming search. See
+ ;; comments in `org-export-get-footnote-number'
+ ;; for more information.
+ ((eq (org-element-property :type fn) 'standard)
+ (funcall search-refs
+ (org-export-get-footnote-definition fn info)))))
+ ;; Don't enter footnote definitions since it will
+ ;; happen when their first reference is found.
+ info 'first-match 'footnote-definition)))))
(eq (catch 'exit (funcall search-refs (plist-get info :parse-tree)))
- footnote-reference)))))
+ footnote-reference)))))
(defun org-export-get-footnote-definition (footnote-reference info)
"Return definition of FOOTNOTE-REFERENCE as parsed data.
@@ -3288,38 +3335,38 @@ INFO is the plist used as a communication channel."
(lambda (data)
;; Search footnote references through DATA, filling
;; SEEN-REFS along the way.
- (org-element-map
- data 'footnote-reference
- (lambda (fn)
- (let ((fn-lbl (org-element-property :label fn)))
- (cond
- ;; Anonymous footnote match: return number.
- ((and (not fn-lbl) (eq fn footnote))
- (throw 'exit (1+ (length seen-refs))))
- ;; Labels match: return number.
- ((and label (string= label fn-lbl))
- (throw 'exit (1+ (length seen-refs))))
- ;; Anonymous footnote: it's always a new one. Also,
- ;; be sure to return nil from the `cond' so
- ;; `first-match' doesn't get us out of the loop.
- ((not fn-lbl) (push 'inline seen-refs) nil)
- ;; Label not seen so far: add it so SEEN-REFS.
- ;;
- ;; Also search for subsequent references in
- ;; footnote definition so numbering follows reading
- ;; logic. Note that we don't have to care about
- ;; inline definitions, since `org-element-map'
- ;; already traverses them at the right time.
- ;;
- ;; Once again, return nil to stay in the loop.
- ((not (member fn-lbl seen-refs))
- (push fn-lbl seen-refs)
- (funcall search-ref
- (org-export-get-footnote-definition fn info))
- nil))))
- ;; Don't enter footnote definitions since it will happen
- ;; when their first reference is found.
- info 'first-match 'footnote-definition)))))
+ (org-element-map data 'footnote-reference
+ (lambda (fn)
+ (let ((fn-lbl (org-element-property :label fn)))
+ (cond
+ ;; Anonymous footnote match: return number.
+ ((and (not fn-lbl) (eq fn footnote))
+ (throw 'exit (1+ (length seen-refs))))
+ ;; Labels match: return number.
+ ((and label (string= label fn-lbl))
+ (throw 'exit (1+ (length seen-refs))))
+ ;; Anonymous footnote: it's always a new one.
+ ;; Also, be sure to return nil from the `cond' so
+ ;; `first-match' doesn't get us out of the loop.
+ ((not fn-lbl) (push 'inline seen-refs) nil)
+ ;; Label not seen so far: add it so SEEN-REFS.
+ ;;
+ ;; Also search for subsequent references in
+ ;; footnote definition so numbering follows
+ ;; reading logic. Note that we don't have to care
+ ;; about inline definitions, since
+ ;; `org-element-map' already traverses them at the
+ ;; right time.
+ ;;
+ ;; Once again, return nil to stay in the loop.
+ ((not (member fn-lbl seen-refs))
+ (push fn-lbl seen-refs)
+ (funcall search-ref
+ (org-export-get-footnote-definition fn info))
+ nil))))
+ ;; Don't enter footnote definitions since it will
+ ;; happen when their first reference is found.
+ info 'first-match 'footnote-definition)))))
(catch 'exit (funcall search-ref (plist-get info :parse-tree)))))
@@ -3463,12 +3510,11 @@ fail, the fall-back value is \"???\"."
(and category (not (equal "???" category))
(throw 'found category)))
(setq parent (org-element-property :parent parent))))))
- (org-element-map
- (plist-get info :parse-tree) 'keyword
- (lambda (kwd)
- (when (equal (org-element-property :key kwd) "CATEGORY")
- (org-element-property :value kwd)))
- info 'first-match)
+ (org-element-map (plist-get info :parse-tree) 'keyword
+ (lambda (kwd)
+ (when (equal (org-element-property :key kwd) "CATEGORY")
+ (org-element-property :value kwd)))
+ info 'first-match)
(let ((file (plist-get info :input-file)))
(and file (file-name-sans-extension (file-name-nondirectory file))))
"???"))
@@ -3557,26 +3603,25 @@ INFO is a plist used as a communication channel.
Return associated line number in source code, or REF itself,
depending on src-block or example element's switches."
- (org-element-map
- (plist-get info :parse-tree) '(example-block src-block)
- (lambda (el)
- (with-temp-buffer
- (insert (org-trim (org-element-property :value el)))
- (let* ((label-fmt (regexp-quote
- (or (org-element-property :label-fmt el)
- org-coderef-label-format)))
- (ref-re
- (format "^.*?\\S-.*?\\([ \t]*\\(%s\\)\\)[ \t]*$"
- (replace-regexp-in-string "%s" ref label-fmt nil t))))
- ;; Element containing REF is found. Resolve it to either
- ;; a label or a line number, as needed.
- (when (re-search-backward ref-re nil t)
- (cond
- ((org-element-property :use-labels el) ref)
- ((eq (org-element-property :number-lines el) 'continued)
- (+ (org-export-get-loc el info) (line-number-at-pos)))
- (t (line-number-at-pos)))))))
- info 'first-match))
+ (org-element-map (plist-get info :parse-tree) '(example-block src-block)
+ (lambda (el)
+ (with-temp-buffer
+ (insert (org-trim (org-element-property :value el)))
+ (let* ((label-fmt (regexp-quote
+ (or (org-element-property :label-fmt el)
+ org-coderef-label-format)))
+ (ref-re
+ (format "^.*?\\S-.*?\\([ \t]*\\(%s\\)\\)[ \t]*$"
+ (replace-regexp-in-string "%s" ref label-fmt nil t))))
+ ;; Element containing REF is found. Resolve it to either
+ ;; a label or a line number, as needed.
+ (when (re-search-backward ref-re nil t)
+ (cond
+ ((org-element-property :use-labels el) ref)
+ ((eq (org-element-property :number-lines el) 'continued)
+ (+ (org-export-get-loc el info) (line-number-at-pos)))
+ (t (line-number-at-pos)))))))
+ info 'first-match))
(defun org-export-resolve-fuzzy-link (link info)
"Return LINK destination.
@@ -3606,17 +3651,21 @@ Assume LINK type is \"fuzzy\"."
;; he was looking for an headline (path starts with a *
;; character).
((and (not match-title-p)
- (loop for target in (plist-get info :target-list)
- when (string= (org-element-property :value target) path)
- return target)))
+ (org-element-map (plist-get info :parse-tree) '(keyword target)
+ (lambda (blob)
+ (and (or (eq (org-element-type blob) 'target)
+ (equal (org-element-property :key blob) "TARGET"))
+ (equal (org-element-property :value blob) path)
+ blob))
+ info t)))
;; Then try to find an element with a matching "#+NAME: path"
;; affiliated keyword.
((and (not match-title-p)
- (org-element-map
- (plist-get info :parse-tree) org-element-all-elements
- (lambda (el)
- (when (string= (org-element-property :name el) path) el))
- info 'first-match)))
+ (org-element-map (plist-get info :parse-tree)
+ org-element-all-elements
+ (lambda (el)
+ (when (string= (org-element-property :name el) path) el))
+ info 'first-match)))
;; Last case: link either points to an headline or to
;; nothingness. Try to find the source, with priority given to
;; headlines with the closest common ancestor. If such candidate
@@ -3624,19 +3673,18 @@ Assume LINK type is \"fuzzy\"."
(t
(let ((find-headline
(function
- ;; Return first headline whose `:raw-value' property
- ;; is NAME in parse tree DATA, or nil.
+ ;; Return first headline whose `:raw-value' property is
+ ;; NAME in parse tree DATA, or nil.
(lambda (name data)
- (org-element-map
- data 'headline
- (lambda (headline)
- (when (string=
- (org-element-property :raw-value headline)
- name)
- headline))
- info 'first-match)))))
- ;; Search among headlines sharing an ancestor with link,
- ;; from closest to farthest.
+ (org-element-map data 'headline
+ (lambda (headline)
+ (when (string=
+ (org-element-property :raw-value headline)
+ name)
+ headline))
+ info 'first-match)))))
+ ;; Search among headlines sharing an ancestor with link, from
+ ;; closest to farthest.
(or (catch 'exit
(mapc
(lambda (parent)
@@ -3644,7 +3692,7 @@ Assume LINK type is \"fuzzy\"."
(let ((foundp (funcall find-headline path parent)))
(when foundp (throw 'exit foundp)))))
(org-export-get-genealogy link)) nil)
- ;; No match with a common ancestor: try the full parse-tree.
+ ;; No match with a common ancestor: try full parse-tree.
(funcall find-headline
(if match-title-p (substring path 1) path)
(plist-get info :parse-tree))))))))
@@ -3659,13 +3707,12 @@ tree, a file name or nil. Assume LINK type is either \"id\" or
\"custom-id\"."
(let ((id (org-element-property :path link)))
;; First check if id is within the current parse tree.
- (or (org-element-map
- (plist-get info :parse-tree) 'headline
- (lambda (headline)
- (when (or (string= (org-element-property :id headline) id)
- (string= (org-element-property :custom-id headline) id))
- headline))
- info 'first-match)
+ (or (org-element-map (plist-get info :parse-tree) 'headline
+ (lambda (headline)
+ (when (or (string= (org-element-property :id headline) id)
+ (string= (org-element-property :custom-id headline) id))
+ headline))
+ info 'first-match)
;; Otherwise, look for external files.
(cdr (assoc id (plist-get info :id-alist))))))
@@ -3677,11 +3724,10 @@ INFO is a plist used as a communication channel.
Return value can be a radio-target object or nil. Assume LINK
has type \"radio\"."
(let ((path (org-element-property :path link)))
- (org-element-map
- (plist-get info :parse-tree) 'radio-target
- (lambda (radio)
- (when (equal (org-element-property :value radio) path) radio))
- info 'first-match)))
+ (org-element-map (plist-get info :parse-tree) 'radio-target
+ (lambda (radio)
+ (when (equal (org-element-property :value radio) path) radio))
+ info 'first-match)))
;;;; For References
@@ -3741,14 +3787,14 @@ objects of the same type."
(otherwise
(let ((counter 0))
;; Increment counter until ELEMENT is found again.
- (org-element-map
- (plist-get info :parse-tree) (or types (org-element-type element))
- (lambda (el)
- (cond
- ((eq element el) (1+ counter))
- ((not predicate) (incf counter) nil)
- ((funcall predicate el info) (incf counter) nil)))
- info 'first-match))))))
+ (org-element-map (plist-get info :parse-tree)
+ (or types (org-element-type element))
+ (lambda (el)
+ (cond
+ ((eq element el) (1+ counter))
+ ((not predicate) (incf counter) nil)
+ ((funcall predicate el info) (incf counter) nil)))
+ info 'first-match))))))
;;;; For Src-Blocks
@@ -3780,25 +3826,24 @@ INFO is the plist used as a communication channel.
ELEMENT is excluded from count."
(let ((loc 0))
- (org-element-map
- (plist-get info :parse-tree)
- `(src-block example-block ,(org-element-type element))
- (lambda (el)
- (cond
- ;; ELEMENT is reached: Quit the loop.
- ((eq el element))
- ;; Only count lines from src-block and example-block elements
- ;; with a "+n" or "-n" switch. A "-n" switch resets counter.
- ((not (memq (org-element-type el) '(src-block example-block))) nil)
- ((let ((linums (org-element-property :number-lines el)))
- (when linums
- ;; Accumulate locs or reset them.
- (let ((lines (org-count-lines
- (org-trim (org-element-property :value el)))))
- (setq loc (if (eq linums 'new) lines (+ loc lines))))))
- ;; Return nil to stay in the loop.
- nil)))
- info 'first-match)
+ (org-element-map (plist-get info :parse-tree)
+ `(src-block example-block ,(org-element-type element))
+ (lambda (el)
+ (cond
+ ;; ELEMENT is reached: Quit the loop.
+ ((eq el element))
+ ;; Only count lines from src-block and example-block elements
+ ;; with a "+n" or "-n" switch. A "-n" switch resets counter.
+ ((not (memq (org-element-type el) '(src-block example-block))) nil)
+ ((let ((linums (org-element-property :number-lines el)))
+ (when linums
+ ;; Accumulate locs or reset them.
+ (let ((lines (org-count-lines
+ (org-trim (org-element-property :value el)))))
+ (setq loc (if (eq linums 'new) lines (+ loc lines))))))
+ ;; Return nil to stay in the loop.
+ nil)))
+ info 'first-match)
;; Return value.
loc))
@@ -3980,16 +4025,15 @@ INFO is a plist used as a communication channel.
A table has an header when it contains at least two row groups."
(let ((rowgroup 1) row-flag)
- (org-element-map
- table 'table-row
- (lambda (row)
- (cond
- ((> rowgroup 1) t)
- ((and row-flag (eq (org-element-property :type row) 'rule))
- (incf rowgroup) (setq row-flag nil))
- ((and (not row-flag) (eq (org-element-property :type row) 'standard))
- (setq row-flag t) nil)))
- info)))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (cond
+ ((> rowgroup 1) t)
+ ((and row-flag (eq (org-element-property :type row) 'rule))
+ (incf rowgroup) (setq row-flag nil))
+ ((and (not row-flag) (eq (org-element-property :type row) 'standard))
+ (setq row-flag t) nil)))
+ info)))
(defun org-export-table-row-is-special-p (table-row info)
"Non-nil if TABLE-ROW is considered special.
@@ -4236,10 +4280,9 @@ INFO is a plist used as a communication channel."
;; A cell starts a column group either when it is at the beginning
;; of a row (or after the special column, if any) or when it has
;; a left border.
- (or (eq (org-element-map
- (org-export-get-parent table-cell)
- 'table-cell 'identity info 'first-match)
- table-cell)
+ (or (eq (org-element-map (org-export-get-parent table-cell) 'table-cell
+ 'identity info 'first-match)
+ table-cell)
(memq 'left (org-export-table-cell-borders table-cell info))))
(defun org-export-table-cell-ends-colgroup-p (table-cell info)
@@ -4296,12 +4339,11 @@ ROWS (resp. COLUMNS) is the number of exportable
rows (resp. columns)."
(let (first-row (columns 0) (rows 0))
;; Set number of rows, and extract first one.
- (org-element-map
- table 'table-row
- (lambda (row)
- (when (eq (org-element-property :type row) 'standard)
- (incf rows)
- (unless first-row (setq first-row row)))) info)
+ (org-element-map table 'table-row
+ (lambda (row)
+ (when (eq (org-element-property :type row) 'standard)
+ (incf rows)
+ (unless first-row (setq first-row row)))) info)
;; Set number of columns.
(org-element-map first-row 'table-cell (lambda (cell) (incf columns)) info)
;; Return value.
@@ -4325,20 +4367,18 @@ function returns nil for other cells."
(cons
;; Row number.
(let ((row-count 0))
- (org-element-map
- table 'table-row
- (lambda (row)
- (cond ((eq (org-element-property :type row) 'rule) nil)
- ((eq row table-row) row-count)
- (t (incf row-count) nil)))
- info 'first-match))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (cond ((eq (org-element-property :type row) 'rule) nil)
+ ((eq row table-row) row-count)
+ (t (incf row-count) nil)))
+ info 'first-match))
;; Column number.
(let ((col-count 0))
- (org-element-map
- table-row 'table-cell
- (lambda (cell)
- (if (eq cell table-cell) col-count (incf col-count) nil))
- info 'first-match))))))
+ (org-element-map table-row 'table-cell
+ (lambda (cell)
+ (if (eq cell table-cell) col-count (incf col-count) nil))
+ info 'first-match))))))
(defun org-export-get-table-cell-at (address table info)
"Return regular table-cell object at ADDRESS in TABLE.
@@ -4351,20 +4391,19 @@ If no table-cell, among exportable cells, is found at ADDRESS,
return nil."
(let ((column-pos (cdr address)) (column-count 0))
(org-element-map
- ;; Row at (car address) or nil.
- (let ((row-pos (car address)) (row-count 0))
- (org-element-map
- table 'table-row
- (lambda (row)
- (cond ((eq (org-element-property :type row) 'rule) nil)
- ((= row-count row-pos) row)
- (t (incf row-count) nil)))
- info 'first-match))
- 'table-cell
- (lambda (cell)
- (if (= column-count column-pos) cell
- (incf column-count) nil))
- info 'first-match)))
+ ;; Row at (car address) or nil.
+ (let ((row-pos (car address)) (row-count 0))
+ (org-element-map table 'table-row
+ (lambda (row)
+ (cond ((eq (org-element-property :type row) 'rule) nil)
+ ((= row-count row-pos) row)
+ (t (incf row-count) nil)))
+ info 'first-match))
+ 'table-cell
+ (lambda (cell)
+ (if (= column-count column-pos) cell
+ (incf column-count) nil))
+ info 'first-match)))
;;;; For Tables Of Contents
@@ -4390,14 +4429,12 @@ information.
Return a list of all exportable headlines as parsed elements."
(unless (wholenump n) (setq n (plist-get info :headline-levels)))
- (org-element-map
- (plist-get info :parse-tree)
- 'headline
- (lambda (headline)
- ;; Strip contents from HEADLINE.
- (let ((relative-level (org-export-get-relative-level headline info)))
- (unless (> relative-level n) headline)))
- info))
+ (org-element-map (plist-get info :parse-tree) 'headline
+ (lambda (headline)
+ ;; Strip contents from HEADLINE.
+ (let ((relative-level (org-export-get-relative-level headline info)))
+ (unless (> relative-level n) headline)))
+ info))
(defun org-export-collect-elements (type info &optional predicate)
"Collect referenceable elements of a determined type.
@@ -4412,13 +4449,12 @@ one argument, an element of type TYPE. It returns a non-nil
value when that element should be collected.
Return a list of all elements found, in order of appearance."
- (org-element-map
- (plist-get info :parse-tree) type
- (lambda (element)
- (and (org-element-property :caption element)
- (or (not predicate) (funcall predicate element))
- element))
- info))
+ (org-element-map (plist-get info :parse-tree) type
+ (lambda (element)
+ (and (org-element-property :caption element)
+ (or (not predicate) (funcall predicate element))
+ element))
+ info))
(defun org-export-collect-tables (info)
"Build a list of tables.
@@ -4948,9 +4984,9 @@ to `:default' encoding. If it fails, return S."
;; then be retrieved by calling `org-export-stack'.
;;
;; Export Stack is viewed through a dedicated major mode
-;;`org-export-stack-mode' and tools: `org-export--stack-refresh',
-;;`org-export--stack-delete', `org-export--stack-view' and
-;;`org-export--stack-clear'.
+;;`org-export-stack-mode' and tools: `org-export-stack-refresh',
+;;`org-export-stack-delete', `org-export-stack-view' and
+;;`org-export-stack-clear'.
;;
;; For back-ends, `org-export-add-to-stack' add a new source to stack.
;; It should used whenever `org-export-async-start' is called.
@@ -5050,7 +5086,7 @@ Entries already pointing to SOURCE and unavailable entries are
removed beforehand. Return the new stack."
(setq org-export-stack-contents
(cons (list source backend (or process (current-time)))
- (org-export--stack-remove source))))
+ (org-export-stack-remove source))))
(defun org-export-stack ()
"Menu for asynchronous export results and running processes."
@@ -5058,7 +5094,7 @@ removed beforehand. Return the new stack."
(let ((buffer (get-buffer-create "*Org Export Stack*")))
(set-buffer buffer)
(when (zerop (buffer-size)) (org-export-stack-mode))
- (org-export--stack-refresh)
+ (org-export-stack-refresh)
(pop-to-buffer buffer))
(message "Type \"q\" to quit, \"?\" for help"))
@@ -5075,12 +5111,12 @@ removed beforehand. Return the new stack."
;; view is outdated.
(error "Source unavailable; type `g' to update buffer"))))))
-(defun org-export--stack-clear ()
+(defun org-export-stack-clear ()
"Remove all entries from export stack."
(interactive)
(setq org-export-stack-contents nil))
-(defun org-export--stack-refresh (&rest dummy)
+(defun org-export-stack-refresh (&rest dummy)
"Refresh the asynchronous export stack.
DUMMY is ignored. Unavailable sources are removed from the list.
Return the new stack."
@@ -5119,7 +5155,7 @@ Return the new stack."
(file-exists-p source)))))
org-export-stack-contents)) "\n")))))))
-(defun org-export--stack-remove (&optional source)
+(defun org-export-stack-remove (&optional source)
"Remove export results at point from stack.
If optional argument SOURCE is non-nil, remove it instead."
(interactive)
@@ -5128,7 +5164,7 @@ If optional argument SOURCE is non-nil, remove it instead."
(org-remove-if (lambda (el) (equal (car el) source))
org-export-stack-contents))))
-(defun org-export--stack-view (&optional in-emacs)
+(defun org-export-stack-view (&optional in-emacs)
"View export results at point in stack.
With an optional prefix argument IN-EMACS, force viewing files
within Emacs."
@@ -5149,10 +5185,10 @@ within Emacs."
(define-key km "\C-p" 'previous-line)
(define-key km "\C-?" 'previous-line)
(define-key km [up] 'previous-line)
- (define-key km "C" 'org-export--stack-clear)
- (define-key km "v" 'org-export--stack-view)
- (define-key km (kbd "RET") 'org-export--stack-view)
- (define-key km "d" 'org-export--stack-remove)
+ (define-key km "C" 'org-export-stack-clear)
+ (define-key km "v" 'org-export-stack-view)
+ (define-key km (kbd "RET") 'org-export-stack-view)
+ (define-key km "d" 'org-export-stack-remove)
km)
"Keymap for Org Export Stack.")
@@ -5162,8 +5198,8 @@ within Emacs."
Type \\[org-export-stack] to visualize the asynchronous export
stack.
-In an Org Export Stack buffer, use \\<org-export-stack-mode-map>\\[org-export--stack-view] to view export output
-on current line, \\[org-export--stack-remove] to remove it from the stack and \\[org-export--stack-clear] to clear
+In an Org Export Stack buffer, use \\<org-export-stack-mode-map>\\[org-export-stack-view] to view export output
+on current line, \\[org-export-stack-remove] to remove it from the stack and \\[org-export-stack-clear] to clear
stack completely.
Removal entries in an Org Export Stack buffer doesn't affect
@@ -5178,9 +5214,9 @@ files or buffers, only view in the stack.
header-line-format
'(:eval
(format " %-12s | %6s | %s" "Back-End" "Age" "Source")))
- (add-hook 'post-command-hook 'org-export--stack-refresh nil t)
+ (add-hook 'post-command-hook 'org-export-stack-refresh nil t)
(set (make-local-variable 'revert-buffer-function)
- 'org-export--stack-refresh))
+ 'org-export-stack-refresh))
@@ -5201,12 +5237,11 @@ both share the same set of bindings, only the former displays the
valid keys associations. Set `org-export-dispatch-use-expert-ui'
to switch to one or the other.
-When called with C-u prefix ARG, repeat the last export action,
-with the same set of options used back then, on the current
-buffer.
+When ARG is \\[universal-argument], repeat the last export action, with the same set
+of options used back then, on the current buffer.
-When called with a double universal argument, display the
-asynchronous export stack directly."
+When ARG is \\[universal-argument] \\[universal-argument], display the asynchronous export stack
+directly."
(interactive "P")
(let* ((input
(cond ((equal arg '(16)) '(stack))
@@ -5228,17 +5263,17 @@ asynchronous export stack directly."
;; First handle special hard-coded actions.
(stack (org-export-stack))
(publish-current-file
- (org-e-publish-current-file (memq 'force optns) (memq 'async optns)))
+ (org-publish-current-file (memq 'force optns) (memq 'async optns)))
(publish-current-project
- (org-e-publish-current-project (memq 'force optns) (memq 'async optns)))
+ (org-publish-current-project (memq 'force optns) (memq 'async optns)))
(publish-choose-project
- (org-e-publish (assoc (org-icompleting-read
- "Publish project: "
- org-e-publish-project-alist nil t)
- org-e-publish-project-alist)
- (memq 'force optns)
- (memq 'async optns)))
- (publish-all (org-e-publish-all (memq 'force optns) (memq 'async optns)))
+ (org-publish (assoc (org-icompleting-read
+ "Publish project: "
+ org-publish-project-alist nil t)
+ org-publish-project-alist)
+ (memq 'force optns)
+ (memq 'async optns)))
+ (publish-all (org-publish-all (memq 'force optns) (memq 'async optns)))
(otherwise (funcall action
;; Return a symbol instead of a list to ease
;; asynchronous export macro use.
@@ -5282,19 +5317,29 @@ back to standard interface."
;; Prepare menu entries by extracting them from
;; `org-export-registered-backends', and sorting them by
;; access key and by ordinal, if any.
- (backends (sort
- (sort
- (delq nil
- (mapcar (lambda (b)
- (org-export-backend-menu (car b)))
- org-export-registered-backends))
- (lambda (a b)
- (let ((key-a (nth 1 a))
- (key-b (nth 1 b)))
- (cond ((and (numberp key-a) (numberp key-b))
- (< key-a key-b))
- ((numberp key-b) t)))))
- (lambda (a b) (< (car a) (car b)))))
+ (backends
+ (sort
+ (sort
+ (delq nil
+ (mapcar
+ (lambda (b)
+ (let ((name (car b)))
+ (catch 'ignored
+ ;; Ignore any back-end belonging to
+ ;; `org-export-invisible-backends' or derived
+ ;; from one of them.
+ (dolist (ignored org-export-invisible-backends)
+ (when (org-export-derived-backend-p name ignored)
+ (throw 'ignored nil)))
+ (org-export-backend-menu name))))
+ org-export-registered-backends))
+ (lambda (a b)
+ (let ((key-a (nth 1 a))
+ (key-b (nth 1 b)))
+ (cond ((and (numberp key-a) (numberp key-b))
+ (< key-a key-b))
+ ((numberp key-b) t)))))
+ (lambda (a b) (< (car a) (car b)))))
;; Compute a list of allowed keys based on the first key
;; pressed, if any. Some keys (?^B, ?^V, ?^S, ?^F, ?^A
;; and ?q) are always available.
@@ -5383,7 +5428,7 @@ back to standard interface."
(expert-prompt
(when expertp
(format
- "Export command (Options: %s%s%s%s%s) [%s]: "
+ "Export command (C-%s%s%s%s%s) [%s]: "
(if (memq 'body options) (funcall fontify-key "b" t) "b")
(if (memq 'visible options) (funcall fontify-key "v" t) "v")
(if (memq 'subtree options) (funcall fontify-key "s" t) "s")
@@ -5476,5 +5521,10 @@ options as CDR."
(t (org-export-dispatch-ui options key expertp)))))
-(provide 'org-export)
-;;; org-export.el ends here
+(provide 'ox)
+
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
+
+;;; ox.el ends here
diff --git a/mk/org-fixup.el b/mk/org-fixup.el
index 7b59efb..aa7ff09 100644
--- a/mk/org-fixup.el
+++ b/mk/org-fixup.el
@@ -70,7 +70,8 @@ work correctly if this file is not up-to-date."
(with-temp-buffer
(set-visited-file-name "org-loaddefs.el")
(insert ";;; org-loaddefs.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
- (let ((files (directory-files default-directory nil "^\\(org\\|ob\\)\\(-.*\\)?\\.el$")))
+ (let ((files (directory-files default-directory
+ nil "^\\(org\\|ob\\|ox\\)\\(-.*\\)?\\.el$")))
(mapc (lambda (f) (generate-file-autoloads f)) files))
(insert "\f\n(provide 'org-loaddefs)\n")
(insert "\f\n;; Local Variables:\n;; version-control: never\n")
diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-ox.el
index d732bcc..b27ded0 100644
--- a/testing/lisp/test-org-export.el
+++ b/testing/lisp/test-ox.el
@@ -1,4 +1,4 @@
-;;; test-org-export.el --- Tests for org-export.el
+;;; test-ox.el --- Tests for ox.el
;; Copyright (C) 2012, 2013 Nicolas Goaziou
@@ -21,7 +21,7 @@
;;; Code:
-(unless (featurep 'org-export)
+(unless (featurep 'ox)
(signal 'missing-test-dependency "org-export"))
(defmacro org-test-with-backend (backend &rest body)
@@ -73,38 +73,22 @@ already filled in `info'."
(ert-deftest test-org-export/bind-keyword ()
"Test reading #+BIND: keywords."
- ;; Test with `org-export-all-BIND' set to t.
+ ;; Test with `org-export-allow-bind-keywords' set to t.
(should
(org-test-with-temp-text "#+BIND: variable value"
- (let ((org-export-allow-BIND t))
+ (let ((org-export-allow-bind-keywords t))
(org-export--install-letbind-maybe)
(eq variable 'value))))
- ;; Test with `org-export-all-BIND' set to nil.
+ ;; Test with `org-export-allow-bind-keywords' set to nil.
(should-not
(org-test-with-temp-text "#+BIND: variable value"
- (let ((org-export-allow-BIND nil))
- (org-export--install-letbind-maybe)
- (boundp 'variable))))
- ;; Test with `org-export-all-BIND' set to 'confirm and
- ;; `org-export--allow-BIND-local' to t .
- (should
- (org-test-with-temp-text "#+BIND: variable value"
- (let ((org-export-allow-BIND 'confirm))
- (org-set-local 'org-export--allow-BIND-local t)
- (org-export--install-letbind-maybe)
- (eq variable 'value))))
- ;; Test with `org-export-all-BIND' set to 'confirm and
- ;; `org-export--allow-BIND-local' to nil.
- (should-not
- (org-test-with-temp-text "#+BIND: variable value"
- (let ((org-export-allow-BIND 'confirm))
- (org-set-local 'org-export--allow-BIND-local nil)
+ (let ((org-export-allow-bind-keywords nil))
(org-export--install-letbind-maybe)
(boundp 'variable))))
;; BIND keywords are case-insensitive.
(should
(org-test-with-temp-text "#+bind: variable value"
- (let ((org-export-allow-BIND t))
+ (let ((org-export-allow-bind-keywords t))
(org-export--install-letbind-maybe)
(eq variable 'value)))))
@@ -302,6 +286,15 @@ Paragraph"
(string-match
"\\`\\* Head1[ \t]+:archive:\n\\'"
(org-export-as 'test nil nil nil '(:with-archived-trees t)))))))
+ ;; Clocks.
+ (let ((org-clock-string "CLOCK:"))
+ (org-test-with-temp-text "CLOCK: [2012-04-29 sun. 10:45]"
+ (org-test-with-backend test
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-clocks t))
+ "CLOCK: [2012-04-29 sun. 10:45]\n"))
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-clocks nil)) "")))))
;; Drawers.
(let ((org-drawers '("TEST")))
(org-test-with-temp-text ":TEST:\ncontents\n:END:"
@@ -316,39 +309,12 @@ Paragraph"
(should
(equal (org-export-as 'test nil nil nil '(:with-drawers ("FOO")))
":FOO:\nkeep\n:END:\n")))))
- ;; Timestamps.
- (org-test-with-temp-text "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>"
- (org-test-with-backend test
- (should
- (equal (org-export-as 'test nil nil nil '(:with-timestamps t))
- "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>\n"))
- (should
- (equal (org-export-as 'test nil nil nil '(:with-timestamps nil)) ""))
- (should
- (equal (org-export-as 'test nil nil nil '(:with-timestamps active))
- "<2012-04-29 sun. 10:45>\n"))
- (should
- (equal (org-export-as 'test nil nil nil '(:with-timestamps inactive))
- "[2012-04-29 sun. 10:45]\n"))))
- ;; Clocks.
- (let ((org-clock-string "CLOCK:"))
- (org-test-with-temp-text "CLOCK: [2012-04-29 sun. 10:45]"
- (org-test-with-backend test
- (should
- (equal (org-export-as 'test nil nil nil '(:with-clocks t))
- "CLOCK: [2012-04-29 sun. 10:45]\n"))
- (should
- (equal (org-export-as 'test nil nil nil '(:with-clocks nil)) "")))))
- ;; Plannings.
- (let ((org-closed-string "CLOSED:"))
- (org-test-with-temp-text "CLOSED: [2012-04-29 sun. 10:45]"
+ (let ((org-drawers '("FOO" "BAR")))
+ (org-test-with-temp-text ":FOO:\nkeep\n:END:\n:BAR:\nremove\n:END:"
(org-test-with-backend test
(should
- (equal (org-export-as 'test nil nil nil '(:with-plannings t))
- "CLOSED: [2012-04-29 sun. 10:45]\n"))
- (should
- (equal (org-export-as 'test nil nil nil '(:with-plannings nil))
- "")))))
+ (equal (org-export-as 'test nil nil nil '(:with-drawers (not "BAR")))
+ ":FOO:\nkeep\n:END:\n")))))
;; Inlinetasks.
(when (featurep 'org-inlinetask)
(should
@@ -366,13 +332,37 @@ Paragraph"
(org-test-with-backend test
(org-export-as 'test nil nil nil '(:with-inlinetasks nil)))))
"")))
+ ;; Plannings.
+ (let ((org-closed-string "CLOSED:"))
+ (org-test-with-temp-text "CLOSED: [2012-04-29 sun. 10:45]"
+ (org-test-with-backend test
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-plannings t))
+ "CLOSED: [2012-04-29 sun. 10:45]\n"))
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-plannings nil))
+ "")))))
;; Statistics cookies.
(should
(equal ""
(org-test-with-temp-text "[0/0]"
(org-test-with-backend test
(org-export-as
- 'test nil nil nil '(:with-statistics-cookies nil)))))))
+ 'test nil nil nil '(:with-statistics-cookies nil))))))
+ ;; Timestamps.
+ (org-test-with-temp-text "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>"
+ (org-test-with-backend test
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-timestamps t))
+ "[2012-04-29 sun. 10:45]<2012-04-29 sun. 10:45>\n"))
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-timestamps nil)) ""))
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-timestamps active))
+ "<2012-04-29 sun. 10:45>\n"))
+ (should
+ (equal (org-export-as 'test nil nil nil '(:with-timestamps inactive))
+ "[2012-04-29 sun. 10:45]\n")))))
(ert-deftest test-org-export/comment-tree ()
"Test if export process ignores commented trees."
@@ -669,7 +659,18 @@ body\n")))
(org-export-define-backend parent ((:headline . parent)))
(org-export-define-derived-backend test parent
:translate-alist ((:headline . test)))
- (org-export-backend-translate-table 'test)))))
+ (org-export-backend-translate-table 'test))))
+ ;; Options defined in the new back have priority over those defined
+ ;; in parent.
+ (should
+ (eq 'test
+ (let (org-export-registered-backends)
+ (org-export-define-backend parent
+ ((:headline . parent))
+ :options-alist ((:a nil nil 'parent)))
+ (org-export-define-derived-backend test parent
+ :options-alist ((:a nil nil 'test)))
+ (plist-get (org-export--get-global-options 'test) :a)))))
(ert-deftest test-org-export/derived-backend-p ()
"Test `org-export-derived-backend-p' specifications."
@@ -2213,5 +2214,5 @@ Another text. (ref:text)
(org-element-map tree 'code 'identity info t) info 2))))))
-(provide 'test-org-export)
+(provide 'test-ox)
;;; test-org-export.el end here