1 #+TITLE: org-export-generic.el -- export org files to anything!
8 org-export-generic is basically a simple translation system that
9 knows how to parse most of an org buffer and then add
10 various formatting prefixes before and after each section type.
14 org-export-generic does its work by examining a property list stored
15 in =org-generic-alist=. The pre-defined list currently includes a
16 simple text exporter, a simple html exporter, a wikipedia exporter,
17 an exporter to IETF internet-draft format, and a "demo" exporter which
18 shows off all of the potential variables you can set.
20 You can also dynamically add property lists of your own using the
21 org-set-generic-type function:
23 #+begin_src emacs-lisp
28 :title-format "=== %s ===\n"
29 :body-header-section-numbers t
30 :body-header-section-number-format "%s) "
31 :body-section-header-prefix "\n"
32 :body-section-header-suffix "\n"
33 :body-line-format " %s\n"
38 *Note:* Upper case key-bindings are reserved for your use. Lower case
39 key bindings may conflict with future export-generic publications.
41 Then run org-export (ctrl-c ctrl-e) and select generic or run
42 org-export-generic. You'll then be prompted with a list of export types
43 to choose from, which will include your new type assigned to the key "R".
45 * Property List Definitions
47 The property list items that can be used to format the output are
48 defined in the table below.
50 Generally speaking, many parts are
51 often divided into sections such that every parsed org /thing/
52 frequently has 3 output specifiers too it. E.G., /thing/ might have
53 /thing-prefix/, /thing-suffix and /thing-format/. The first is a prefix
54 placed before the output contents, the second is a suffix and
55 /thing-format/ is a format string where a %s is expected to be in
56 it. There is a bit of redundancy with this triple combination but
57 it provides flexibility (and in a few places, it's actually needed
58 because the format string may be called multiple times and the
59 prefix and suffix only once).
61 *** Property List Value Types
63 Many of the property list values can be one of a different types.
64 In particular, all of the /prefix/ and /suffix/ tags can be one of
67 - A string (e.g., "<foo>")
68 - A character, which gets repeated by the length of he line to be
69 converted. This is most useful for headers where you wish to
70 place a line underneath the header text. EG:
76 : Property List Value Types
77 : =========================
81 - A list of the above two types. The list elements will be taken
82 based on the order of the header indent amount (ie, the number
83 of asterisks). The list can be a mix of types too:
85 : :header-prefix (?= ?- "<h3>" "<h4>")
87 *** The Full List of Value Types:
89 ***** Configuration Tags:
91 |--------------+---------|
93 |--------------+---------|
94 | :file-suffix | ".txt" |
96 |--------------+---------|
98 ***** Data Output Tags:
100 |--------------------------------+---------------------------------------------------------------|
102 |--------------------------------+---------------------------------------------------------------|
103 | :header-prefix | "<header>\n" |
104 | :header-suffix | "</header>\n" |
106 | :author-export | t |
109 | :drawers-export | t |
112 | :title-prefix | ?= |
113 | :title-format | "<h1>%s</h1>\n" |
114 | :title-suffix | ?= |
117 | :date-prefix | "<date>" |
118 | :date-format | "<br /><b>Date:</b> <i>%s</i><br />" |
119 | :date-suffix | "</date>\n\n" |
122 | :toc-header-prefix | "<tocname>\n" |
123 | :toc-header-format | "__%s__\n" |
124 | :toc-header-suffix | "</tocname>\n" |
126 | :toc-prefix | "<toc>\n" |
127 | :toc-suffix | "</toc>\n" |
129 | :toc-section-numbers | t |
130 | :toc-section-number-format | "\#(%s) " |
131 | :toc-format | "--%s--" |
132 | :toc-format-with-todo | "!!%s!!\n" |
133 | :toc-indent-char | ?\ |
134 | :toc-indent-depth | 4 |
136 | :toc-tags-export | t |
137 | :toc-tags-prefix | " <tags>" |
138 | :toc-tags-format | "*%s*" |
139 | :toc-tags-suffix | "</tags>\n" |
140 | :toc-tags-none-string | "\n" |
142 | :body-header-section-numbers | 3 ; t = all, nil = none |
144 | :body-section-header-prefix | ("<h1>" "<h2>" "<h3>" "<h4>" "<h5>" "<h6>") |
145 | :body-section-header-format | "%s" |
146 | :body-section-header-suffix | ("</h1>\n" "</h2>\n" "</h3>\n" "</h4>\n" "</h5>\n" "</h6>\n") |
148 | :timestamps-export | t |
149 | :priorities-export | t |
150 | :todo-keywords-export | t |
152 | :body-tags-export | t |
153 | :body-tags-prefix | " <tags>" |
154 | :body-tags-suffix | "</tags>\n" |
156 | :body-section-prefix | "<secprefix>\n" |
157 | :body-section-suffix | "</secsuffix>\n" |
160 | :body-line-export-preformated | t |
161 | :body-line-fixed-prefix | "<pre>\n" |
162 | :body-line-fixed-suffix | "\n</pre>\n" |
163 | :body-line-fixed-format | "%s\n" |
166 | :body-list-prefix | "<list>\n" |
167 | :body-list-suffix | "</list>\n" |
168 | :body-list-format | "<li>%s</li>\n" |
170 | :body-number-list-prefix | "<ol>\n" |
171 | :body-number-list-suffix | "</ol>\n" |
172 | :body-number-list-format | "<li>%s</li>\n" |
173 | :body-number-list-leave-number | t |
175 | :body-list-checkbox-todo | "<checkbox type=\"todo\">" |
176 | :body-list-checkbox-todo-end | "</checkbox (todo)>" |
177 | :body-list-checkbox-done | "<checkbox type=\"done\">" |
178 | :body-list-checkbox-done-end | "</checkbox (done)>" |
179 | :body-list-checkbox-half | "<checkbox type=\"half\">" |
180 | :body-list-checkbox-half-end | "</checkbox (half)>" |
182 | :body-line-format | "%s" |
183 | :body-line-wrap | 60 ; wrap at 60 chars |
185 | :body-text-prefix | "<p>\n" |
186 | :body-text-suffix | "</p>\n" |
187 |--------------------------------+---------------------------------------------------------------|
190 * Example Definitions
192 *** Generic HTML Exporter
194 Here's a starting template for making a very basic HTML export.
195 It's not nearly as sophisticated and complete as org-mode's
196 default HTML exporter, but it serves as a good example for how to
197 accomplish a basic export structure:
199 #+begin_src emacs-lisp
200 (org-set-generic-type
204 ;; simple html output
208 :header-prefix "<body>"
210 :title-format "<h1>%s</h1>\n\n"
213 :date-format "<br /><b>Date:</b> <i>%s</i><br />\n\n"
217 :body-header-section-numbers 3
219 :body-section-header-prefix ("<h1>" "<h2>" "<h3>"
220 "<h4>" "<h5>" "<h6>")
221 :body-section-header-format "%s"
222 :body-section-header-suffix ("</h1>\n" "</h2>\n" "</h3>\n"
223 "</h4>\n" "</h5>\n" "</h6>\n")
225 :body-section-prefix "<secprefix>\n"
226 :body-section-suffix "</secsuffix>\n"
227 ; :body-section-prefix ("<sec1>\n" "<sec2>\n" "<sec3>\n")
228 ; :body-section-suffix ("</sec1>\n" "</sec2>\n" "</sec3>\n")
230 :body-line-export-preformated t
231 :body-line-format "%s\n"
233 :body-text-prefix "<p>\n"
234 :body-text-suffix "</p>\n"
236 :body-bullet-list-prefix (?* ?+ ?-)
237 ; :body-bullet-list-suffix (?* ?+ ?-)