Move new export framework files into core
[org-mode.git] / lisp / ox-org.el
blob6b33bcfcaa7ac164095f6cff2db28bc5bf281b78
1 ;;; ox-org.el --- Org Back-End for Org Export Engine
3 ;; Copyright (C) 2013 Free Software Foundation, Inc.
5 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
6 ;; Keywords: org, wp
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Commentary:
23 ;; This library implements an Org back-end for Org exporter. Since
24 ;; its usage is mainly internal, it doesn't provide any interactive
25 ;; function.
27 ;;; Code:
28 (require 'ox)
30 (org-export-define-backend org
31 ((babel-call . org-org-identity)
32 (bold . org-org-identity)
33 (center-block . org-org-identity)
34 (clock . org-org-identity)
35 (code . org-org-identity)
36 (diary-sexp . org-org-identity)
37 (drawer . org-org-identity)
38 (dynamic-block . org-org-identity)
39 (entity . org-org-identity)
40 (example-block . org-org-identity)
41 (fixed-width . org-org-identity)
42 (footnote-definition . org-org-identity)
43 (footnote-reference . org-org-identity)
44 (headline . org-org-headline)
45 (horizontal-rule . org-org-identity)
46 (inline-babel-call . org-org-identity)
47 (inline-src-block . org-org-identity)
48 (inlinetask . org-org-identity)
49 (italic . org-org-identity)
50 (item . org-org-identity)
51 (keyword . org-org-keyword)
52 (latex-environment . org-org-identity)
53 (latex-fragment . org-org-identity)
54 (line-break . org-org-identity)
55 (link . org-org-identity)
56 (node-property . org-org-identity)
57 (paragraph . org-org-identity)
58 (plain-list . org-org-identity)
59 (planning . org-org-identity)
60 (property-drawer . org-org-identity)
61 (quote-block . org-org-identity)
62 (quote-section . org-org-identity)
63 (radio-target . org-org-identity)
64 (section . org-org-identity)
65 (special-block . org-org-identity)
66 (src-block . org-org-identity)
67 (statistics-cookie . org-org-identity)
68 (strike-through . org-org-identity)
69 (subscript . org-org-identity)
70 (superscript . org-org-identity)
71 (table . org-org-identity)
72 (table-cell . org-org-identity)
73 (table-row . org-org-identity)
74 (target . org-org-identity)
75 (timestamp . org-org-identity)
76 (underline . org-org-identity)
77 (verbatim . org-org-identity)
78 (verse-block . org-org-identity)))
80 (defun org-org-identity (blob contents info)
81 "Transcode BLOB element or object back into Org syntax."
82 (funcall
83 (intern (format "org-element-%s-interpreter" (org-element-type blob)))
84 blob contents))
86 (defun org-org-headline (headline contents info)
87 "Transcode HEADLINE element back into Org syntax."
88 (unless (plist-get info :with-todo-keywords)
89 (org-element-put-property headline :todo-keyword nil))
90 (unless (plist-get info :with-tags)
91 (org-element-put-property headline :tags nil))
92 (unless (plist-get info :with-priority)
93 (org-element-put-property headline :priority nil))
94 (org-element-headline-interpreter headline contents))
96 (defun org-org-keyword (keyword contents info)
97 "Transcode KEYWORD element back into Org syntax.
98 Ignore keywords targeted at other export back-ends."
99 (unless (member (org-element-property :key keyword)
100 (mapcar
101 (lambda (block-cons)
102 (and (eq (cdr block-cons) 'org-element-export-block-parser)
103 (car block-cons)))
104 org-element-block-name-alist))
105 (org-element-keyword-interpreter keyword nil)))
108 (provide 'ox-org)
110 ;; Local variables:
111 ;; generated-autoload-file: "org-loaddefs.el"
112 ;; End:
114 ;;; ox-org.el ends here