ox-html: Fix stack overflow in regexp matching
[org-mode.git] / lisp / ox-org.el
blobeaf38e6124577579f45f9a85e1b8e86f1de7970d
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 ;; GNU Emacs 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 ;; GNU Emacs 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 GNU Emacs. 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 (comment . (lambda (&rest args) ""))
37 (comment-block . (lambda (&rest args) ""))
38 (diary-sexp . org-org-identity)
39 (drawer . org-org-identity)
40 (dynamic-block . org-org-identity)
41 (entity . org-org-identity)
42 (example-block . org-org-identity)
43 (fixed-width . org-org-identity)
44 (footnote-definition . org-org-identity)
45 (footnote-reference . org-org-identity)
46 (headline . org-org-headline)
47 (horizontal-rule . org-org-identity)
48 (inline-babel-call . org-org-identity)
49 (inline-src-block . org-org-identity)
50 (inlinetask . org-org-identity)
51 (italic . org-org-identity)
52 (item . org-org-identity)
53 (keyword . org-org-keyword)
54 (latex-environment . org-org-identity)
55 (latex-fragment . org-org-identity)
56 (line-break . org-org-identity)
57 (link . org-org-identity)
58 (node-property . org-org-identity)
59 (paragraph . org-org-identity)
60 (plain-list . org-org-identity)
61 (planning . org-org-identity)
62 (property-drawer . org-org-identity)
63 (quote-block . org-org-identity)
64 (quote-section . org-org-identity)
65 (radio-target . org-org-identity)
66 (section . org-org-identity)
67 (special-block . org-org-identity)
68 (src-block . org-org-identity)
69 (statistics-cookie . org-org-identity)
70 (strike-through . org-org-identity)
71 (subscript . org-org-identity)
72 (superscript . org-org-identity)
73 (table . org-org-identity)
74 (table-cell . org-org-identity)
75 (table-row . org-org-identity)
76 (target . org-org-identity)
77 (timestamp . org-org-identity)
78 (underline . org-org-identity)
79 (verbatim . org-org-identity)
80 (verse-block . org-org-identity)))
82 (defun org-org-identity (blob contents info)
83 "Transcode BLOB element or object back into Org syntax."
84 (funcall
85 (intern (format "org-element-%s-interpreter" (org-element-type blob)))
86 blob contents))
88 (defun org-org-headline (headline contents info)
89 "Transcode HEADLINE element back into Org syntax."
90 (unless (plist-get info :with-todo-keywords)
91 (org-element-put-property headline :todo-keyword nil))
92 (unless (plist-get info :with-tags)
93 (org-element-put-property headline :tags nil))
94 (unless (plist-get info :with-priority)
95 (org-element-put-property headline :priority nil))
96 (org-element-headline-interpreter headline contents))
98 (defun org-org-keyword (keyword contents info)
99 "Transcode KEYWORD element back into Org syntax.
100 Ignore keywords targeted at other export back-ends."
101 (unless (member (org-element-property :key keyword)
102 (mapcar
103 (lambda (block-cons)
104 (and (eq (cdr block-cons) 'org-element-export-block-parser)
105 (car block-cons)))
106 org-element-block-name-alist))
107 (org-element-keyword-interpreter keyword nil)))
109 ;;;###autoload
110 (defun org-org-publish-to-org (plist filename pub-dir)
111 "Publish an org file to org.
113 FILENAME is the filename of the Org file to be published. PLIST
114 is the property list for the given project. PUB-DIR is the
115 publishing directory.
117 Return output file name."
118 (org-publish-org-to 'org filename ".org" plist pub-dir))
120 (provide 'ox-org)
122 ;; Local variables:
123 ;; generated-autoload-file: "org-loaddefs.el"
124 ;; End:
126 ;;; ox-org.el ends here