orgcamps.org: fix time
[Worg.git] / org-contrib / org-export-generic.org
blobe3edb722b0ae491245243acc0ce6a34512c94d57
1 #+TITLE:     org-export-generic.el -- export org files to anything!
2 #+OPTIONS:   ^:{} author:Wes Hardaker
3 #+STARTUP: odd
5 * Overview
7 org-export-generic is basically a simple translation system that
8 knows how to parse at least most of a .org buffer and then add
9 various formatting prefixes before and after each section type.
11 * Using It
13 org-export-generic does it's work by examining a property list stored
14 in =org-generic-alist=.  The pre-defined list currently includes a
15 simplex text exporter, a simple html exporter, a wikipedia exporter,
16 an exporter to IETF internet-draft format, and a "demo" exporter which
17 shows off all of the potential variables you can set.
19 You can also dynamically add propety lists of your own using the
20 org-set-generic-type function:
22 #+begin_src emacs-lisp
23    (org-set-generic-type
24     "really-basic-text" 
25     '(:file-suffix     ".txt"
26       :key-binding     ?R
27       :title-format "=== %s ===\n"
28       :body-header-section-numbers t
29       :body-header-section-number-format "%s) "
30       :body-section-header-prefix  "\n"
31       :body-section-header-suffix "\n"
32       :body-line-format "  %s\n"
33       :body-line-wrap   75
34       ))
35 #+end_src
37 *Note:* Upper case key-bindings are reserved for your use.  Lower case
38 key bindings may conflict with future export-generic publications.
40 Then run org-export (ctrl-c ctrl-e) and select generic or run
41 org-export-generic.  You'll then be prompted with a list of export types
42 to choose from which will include your new type assigned to the key "R".
44 * Property List Definitions
46   The property list items that can be used to format the output are
47   defined in the table below.
49   Generally speaking, many parts are
50   often divided into sections such that every parsed org /thing/
51   frequently has 3 output specifiers too it.  E.G., /thing/ might have
52   /thing-prefix/, /thing-suffix and /thing-format/.  The first is a prefix
53   placed before the output contents, the second is a suffix and 
54   /thing-format/ is a format string where a %s is expected to be in
55   it.  There is a bit of redundancy with this triple combination but
56   it provides flexibility (and in a few places, it's actually needed
57   because the format string may be called multiple times and the
58   prefix and suffix only once).
60 *** Property List Value Types
62     Many of the property list values can be one of a different types.
63     In particular, all of the /prefix/ and /suffix/ tags can be one of
64     the following types:
66     - A string (e.g., "<foo>")
67     - A character, which gets repeated by the length of he line to be
68       converted.  This is most useful for headers where you wish to
69       place a line underneath the header text.  EG:
71 :     :header-prefix             ?=
73       Will produce:
75 :     Property List Value Types
76 :     =========================
77      
78       For this section.
80     - A list of the above two types.  The list elements will be taken
81       based on the order of the header indent amount (ie, the number
82       of asterisks).  The list can be a mix of types too:
83     
84 :     :header-prefix             (?= ?- "<h3>" "<h4>")
86 *** The Full List of Value Types:
88 ***** Configuration Tags:
90       |--------------+---------|
91       | TAG          | EXAMPLE |
92       |--------------+---------|
93       | :file-suffix | ".txt"  |
94       | :key-binding | ?d      |
95       |--------------+---------|
97 ***** Data Output Tags:
99       |--------------------------------+---------------------------------------------------------------|
100       | TAG                            | EXAMPLE                                                       |
101       |--------------------------------+---------------------------------------------------------------|
102       | :header-prefix                 | "<header>\n"                                                  |
103       | :header-suffix                 | "</header>\n"                                                 |
104       |                                |                                                               |
105       | :author-export                 | t                                                             |
106       | :tags-export                   | t                                                             |
107       |                                |                                                               |
108       | :drawers-export                | t                                                             |
109       |                                |                                                               |
110       |                                |                                                               |
111       | :title-prefix                  | ?=                                                            |
112       | :title-format                  | "<h1>%s</h1>\n"                                               |
113       | :title-suffix                  | ?=                                                            |
114       |                                |                                                               |
115       | :date-export                   | t                                                             |
116       | :date-prefix                   | "<date>"                                                      |
117       | :date-format                   | "<br /><b>Date:</b> <i>%s</i><br />"                          |
118       | :date-suffix                   | "</date>\n\n"                                                 |
119       |                                |                                                               |
120       | :toc-export                    | t                                                             |
121       | :toc-header-prefix             | "<tocname>\n"                                                 |
122       | :toc-header-format             | "__%s__\n"                                                    |
123       | :toc-header-suffix             | "</tocname>\n"                                                |
124       |                                |                                                               |
125       | :toc-prefix                    | "<toc>\n"                                                     |
126       | :toc-suffix                    | "</toc>\n"                                                    |
127       |                                |                                                               |
128       | :toc-section-numbers           | t                                                             |
129       | :toc-section-number-format     | "\#(%s) "                                                     |
130       | :toc-format                    | "--%s--"                                                      |
131       | :toc-format-with-todo          | "!!%s!!\n"                                                    |
132       | :toc-indent-char               | ?\                                                            |
133       | :toc-indent-depth              | 4                                                             |
134       |                                |                                                               |
135       | :toc-tags-export               | t                                                             |
136       | :toc-tags-prefix               | "   <tags>"                                                   |
137       | :toc-tags-format               | "*%s*"                                                        |
138       | :toc-tags-suffix               | "</tags>\n"                                                   |
139       | :toc-tags-none-string          | "\n"                                                          |
140       |                                |                                                               |
141       | :body-header-section-numbers   | 3    ; t = all, nil = none                                    |
142       |                                |                                                               |
143       | :body-section-header-prefix    | ("<h1>" "<h2>" "<h3>" "<h4>" "<h5>" "<h6>")                   |
144       | :body-section-header-format    | "%s"                                                          |
145       | :body-section-header-suffix    | ("</h1>\n" "</h2>\n" "</h3>\n" "</h4>\n" "</h5>\n" "</h6>\n") |
146       |                                |                                                               |
147       | :timestamps-export             | t                                                             |
148       | :priorities-export             | t                                                             |
149       | :todo-keywords-export          | t                                                             |
150       |                                |                                                               |
151       | :body-tags-export              | t                                                             |
152       | :body-tags-prefix              | "  <tags>"                                                    |
153       | :body-tags-suffix              | "</tags>\n"                                                   |
154       |                                |                                                               |
155       | :body-section-prefix           | "<secprefix>\n"                                               |
156       | :body-section-suffix           | "</secsuffix>\n"                                              |
157       |                                |                                                               |
158       |                                |                                                               |
159       | :body-line-export-preformated  | t                                                             |
160       | :body-line-fixed-prefix        | "<pre>\n"                                                     |
161       | :body-line-fixed-suffix        | "\n</pre>\n"                                                  |
162       | :body-line-fixed-format        | "%s\n"                                                        |
163       |                                |                                                               |
164       |                                |                                                               |
165       | :body-list-prefix              | "<list>\n"                                                    |
166       | :body-list-suffix              | "</list>\n"                                                   |
167       | :body-list-format              | "<li>%s</li>\n"                                               |
168       |                                |                                                               |
169       | :body-number-list-prefix       | "<ol>\n"                                                      |
170       | :body-number-list-suffix       | "</ol>\n"                                                     |
171       | :body-number-list-format       | "<li>%s</li>\n"                                               |
172       | :body-number-list-leave-number | t                                                             |
173       |                                |                                                               |
174       | :body-list-checkbox-todo       | "<checkbox type=\"todo\">"                                    |
175       | :body-list-checkbox-todo-end   | "</checkbox (todo)>"                                          |
176       | :body-list-checkbox-done       | "<checkbox type=\"done\">"                                    |
177       | :body-list-checkbox-done-end   | "</checkbox (done)>"                                          |
178       | :body-list-checkbox-half       | "<checkbox type=\"half\">"                                    |
179       | :body-list-checkbox-half-end   | "</checkbox (half)>"                                          |
180       |                                |                                                               |
181       | :body-line-format              | "%s"                                                          |
182       | :body-line-wrap                | 60  ; wrap at 60 chars                                        |
183       |                                |                                                               |
184       | :body-text-prefix              | "<p>\n"                                                       |
185       | :body-text-suffix              | "</p>\n"                                                      |
186       |--------------------------------+---------------------------------------------------------------|