├── LICENCE
├── README.org
└── ox-pandoc.el
/LICENCE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
--------------------------------------------------------------------------------
/README.org:
--------------------------------------------------------------------------------
1 | #+TITLE: ox-pandoc: an exporter for Org Mode using pandoc
2 |
3 | =ox-pandoc= is an
4 | [[https://orgmode.org/manual/Exporting.html#Exporting][exporter]] for
5 | [[https://orgmode.org/][Org mode]] which converts Org-mode files to a
6 | wide variety of other formats using the [[https://pandoc.org/][pandoc]]
7 | tool. Pandoc can produce PDFs, HTML, presentations, markdown files,
8 | office documents and e-pub publications as well as a number of other
9 | more specialised formats.
10 |
11 | # Github's Org support doesn't seem to be able to do ToCs
12 | # So use https://github.com/snosov1/toc-org
13 | * Contents :TOC:QUOTE:
14 | #+BEGIN_QUOTE
15 | - [[#installation][Installation]]
16 | - [[#requirements][Requirements]]
17 | - [[#installing-pandoc][Installing Pandoc]]
18 | - [[#installation-1][Installation]]
19 | - [[#usage][Usage]]
20 | - [[#using-orgs-export-dispatch-menu][Using Org's export-dispatch menu]]
21 | - [[#running-the-commands-directly][Running the Commands directly]]
22 | - [[#document-options][Document options]]
23 | - [[#passing-options-to-pandoc][Passing options to pandoc]]
24 | - [[#org-mode-export-settings][Org-Mode export settings]]
25 | - [[#customisation][Customisation]]
26 | - [[#setting-default-pandoc-options][Setting default pandoc options]]
27 | - [[#hooks][Hooks]]
28 | - [[#delayed-loading-of-ox-pandoc][Delayed loading of ox-pandoc]]
29 | - [[#temporary-files][Temporary Files]]
30 | - [[#feature-support][Feature Support]]
31 | - [[#source-code-blocks][Source Code Blocks]]
32 | - [[#citations-and-bibliographies-experimental][Citations and Bibliographies (Experimental)]]
33 | - [[#supported-formats][Supported Formats]]
34 | - [[#labelling-and-numbering-of-figures-tables-etc][Labelling and numbering of figures, tables etc.]]
35 | - [[#deprecated-and-removed-features][Deprecated and Removed Features]]
36 | - [[#obsolete-in-file-options][Obsolete In-File Options]]
37 | - [[#numbering-of-figures-tables-and-equations][Numbering of figures, tables and equations]]
38 | - [[#history-and-people][History and People]]
39 | - [[#license][License]]
40 | #+END_QUOTE
41 |
42 | * Installation
43 | ** Requirements
44 | You need Emacs 24.4, org-mode 8.2, and Pandoc 2.0 (or later versions). A
45 | recent version of Pandoc is recommended.
46 |
47 | Note that the support for [[*Citations and Bibliographies (Experimental)][citations]] in newest versions of org-mode (9.5+)
48 | require a similarly recent version of Pandoc (2.17+).
49 |
50 | ** Installing Pandoc
51 | Installing Pandoc directly from
52 | [[https://pandoc.org/installing.html][the official website]] is
53 | recommended. The versions of Pandoc provided by package managers and
54 | distributions is often quite out-of-date and may be missing features or
55 | formats added to it.
56 |
57 | By default, =ox-pandoc= will check on starting up whether there is a
58 | suitable pandoc executable available. When none is found, or the version
59 | is too old, a warning will be emitted. This warning can be suppressed
60 | by setting customisation option =org-pandoc-check-version= to =nil=.
61 |
62 | ** Installation
63 | You can install this tool with [[https://www.melpa.org][MELPA]]. For example,
64 |
65 | #+BEGIN_SRC emacs-lisp
66 | (setq package-archives
67 | '(("gnu" . "http://elpa.gnu.org/packages/")
68 | ("melpa" . "http://melpa.milkbox.net/packages/")))
69 | #+END_SRC
70 |
71 | : M-x package-install ⏎
72 | : ox-pandoc ⏎
73 |
74 | * Usage
75 | ** Using Org's export-dispatch menu
76 | As always in Org, =C-c C-e= brings up the export dispatch menu for
77 | the current org-mode file. =ox-pandoc= lives under the =p= key. By
78 | default, options are offered to convert the org-file to a number of
79 | commonly used and generic formats, such as LaTeX, PDF, HTML, markdown
80 | and word-processor files.
81 |
82 | Pandoc and =ox-pandoc= support a very large number of [[*Supported Formats][output formats]].
83 | To avoid cluttering Org's export menu, most formats are not shown by
84 | default. For example, most application-specific formats, markdown
85 | dialects and slides are not included. You can customize the
86 | =org-pandoc-menu-entry= variable (and probably restart Emacs) to
87 | change the menu entries to include those you commonly use. A full
88 | list of exporting commands and suggested shortcuts can be found in
89 | =ox-pandoc.el=.
90 |
91 | ** Running the Commands directly
92 |
93 | The exporters can be called directly via =M-x=. For example, to convert
94 | org-mode file to 'html5' format, you may run the following commands:
95 |
96 | - =org-pandoc-export-as-html5= :: Exports to the HTML5 text as a buffer.
97 | - =org-pandoc-export-to-html5= :: Exports to the HTML5 text file.
98 | - =org-pandoc-export-to-html5-and-open= :: Exports and open HTML5 file.
99 |
100 | All of the formats supported by =ox-pandoc= have corresponding commands
101 | named in this way. =org-pandoc-export-as-[FORMAT]= exports to a buffer
102 | and =org-pandoc-export-to-[FORMAT]= exports to a file. Note that some
103 | formats (e.g. PDF) can only be exported to a file, not to a buffer.
104 |
105 | The opening of exported files in the =XXX-and-open= variants is handled
106 | by =org-open-file=. Which applications are used for different file types
107 | can be customised in Org Mode by the =org-file-apps= variable.
108 |
109 | * Document options
110 | ** Passing options to pandoc
111 | The =pandoc= command supports a
112 | [[https://pandoc.org/MANUAL.html#options][large number of options]]
113 | which can be used to control how the document is processed and how the
114 | output should appear. In =ox-pandoc= these options can be specified for
115 | individual documents or [[#setting-default-pandoc-options][set as
116 | defaults for specific formats]].
117 |
118 | The following document-specific options can be specified. Value =nil=
119 | overrides preceding option setting. Value =t= means only specify
120 | option, but not its value. Options are delimited by space.
121 | =#+PANDOC_OPTIONS:= can be specified multiple times. If you want to
122 | specify the option value which include space character, the /entire/
123 | option-value pair must be quoted (see example below).
124 |
125 | - =PANDOC_OPTIONS:= :: Add command line options to the Pandoc process.
126 | - =PANDOC_METADATA:= :: Metadata for Pandoc.
127 | - =PANDOC_EXTENSIONS:= :: Extensions for specific Pandoc output.
128 | - =PANDOC_VARIABLES:= :: Variables for Pandoc.
129 | - =EPUB_RIGHTS:= :: copyright info to be embedded to EPUB metadata.
130 | - =EPUB_CHAPTER_LEVEL:= :: same as 'epub-chapter-level' pandoc-option.
131 | - =EPUB_STYLESHEET:= :: same as 'epub-stylesheet' pandoc-option.
132 | - =EPUB_COVER:= :: same as 'epub-cover-image' pandoc-option.
133 | - =EPUB_FONT:= :: same as 'epub-embed-font' pandoc-option. Only one
134 | font can be specified in each line. Multiple fonts
135 | can be specified by repeatedly use this option.
136 | - =EPUB_META:= :: put contents into a temporary file and specify
137 | that file to 'epub-metadata' option.
138 | - =EPUB_CSS:= :: put contents into a temporary file and specify
139 | that file to 'epub-stylesheet' option.
140 | - =BIBLIOGRAPHY:= :: same as 'bibliography' pandoc-option. Only one
141 | bibliography can be specified in each line. Multiple
142 | bibliographies can be specified by repeatedly use this option.
143 |
144 | Following is an example:
145 |
146 | : #+PANDOC_OPTIONS: standalone:t pdf-engine:pdflatex
147 | : ## When option value includes whitespace, entire name:value pair must be quoted.
148 | : #+PANDOC_OPTIONS: "epub-cover-image:/home/a/test file.png" standalone:nil
149 | : #+PANDOC_OPTIONS: number-sections:nil
150 | : #+PANDOC_OPTIONS: template:mytemplate.tex
151 | : #+BIBLIOGRAPHY: sample.bib
152 | : # Specifying Multiple values to single options by using colon-sparated lists.
153 | : #+PANDOC_OPTIONS: filter:pandoc-zotxt:pandoc-citeproc
154 | : #+PANDOC_OPTIONS: csl:IEEE.csl
155 | : #+PANDOC_EXTENSIONS: markdown-typography latex+auto_identifiers
156 | : #+PANDOC_VARIABLES: documentclass:IEEEtran
157 | : #+PANDOC_VARIABLES: classoption:10pt,conference
158 | : #+PANDOC_METADATA: page-progression-direction:ltr
159 | : #+latex_header: \author{\IEEEauthorblockN{John Smith}
160 | : #+latex_header: \IEEEauthorblockA{FooBar Institute\\
161 | : #+latex_header: Email: john.smith@foo.bar}
162 |
163 | ** Org-Mode export settings
164 | Org Mode defines a considerable number of [[https://orgmode.org/manual/Export-Settings.html][Export settings]]. These control which parts of the org document are exported and how this is done. For example, they can be used to set whether a table of contents is created and whether title and author should be inserted into the output document.
165 |
166 | Pandoc should understand and follow these directives. *HOWEVER* pandoc only operates on the file it is given and does not know about settings from Emacs such as customisations. If, for example, you wish not to have a Table of Contents, there must be a line =#+OPTIONS: toc:nil= in the file itself; any global setting of =org-export-with-toc= will not be respected.
167 |
168 | Note that Org Mode will by default try to deduce the author's full name (using =user-full-name=) when exporting, even if it is not given in the org document. To suppress this, add =#+OPTIONS: author: nil= in the document's header.
169 |
170 | * Customisation
171 | ** Setting default pandoc options
172 |
173 | You can specify the default options passed to pandoc and used on its
174 | command-line for each document format.
175 |
176 | - =org-pandoc-options= :: General Pandoc options.
177 | - =org-pandoc-options-for-FORMAT= :: Format-specific options.
178 | - =org-pandoc-epub-rights= :: EPUB Copyright Statement.
179 |
180 | Options should be specified by an alist. List of valid options are
181 | defined in =org-pandoc-valid-options=. Only long-name options can be
182 | used. For example, =metadata= must be given as the option name, even
183 | though Pandoc accepts a short-form version of the argument ("-M").
184 | Multiple values can be specified to options defined in
185 | =org-pandoc-colon-separated-options=. They should be defined in
186 | colon-separated list.
187 |
188 | Values of options defined in =org-pandoc-file-options= will be
189 | expanded to full path if they begin with =~= (tilde) character.
190 |
191 | You can also specify output format extension with
192 | =org-pandoc-format-extensions= variable.
193 |
194 | For example:
195 |
196 | #+BEGIN_SRC emacs-lisp
197 | ;; default options for all output formats
198 | (setq org-pandoc-options '((standalone . t)))
199 | ;; cancel above settings only for 'docx' format
200 | (setq org-pandoc-options-for-docx '((standalone . nil)))
201 | ;; special settings for beamer-pdf and latex-pdf exporters
202 | (setq org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))
203 | (setq org-pandoc-options-for-latex-pdf '((pdf-engine . "pdflatex")))
204 | ;; special extensions for markdown_github output
205 | (setq org-pandoc-format-extensions '(markdown_github+pipe_tables+raw_html))
206 | #+END_SRC
207 |
208 | ** Hooks
209 | Hooks are also provided to be called when =pandoc= has completed processing.
210 |
211 | - =org-pandoc-after-processing-FORMAT-hook= :: Hook called after processing =FORMAT=.
212 |
213 | These hooks are only available for text-file =FORMAT=.
214 | =after-processing= options can not be specified to =epub=, =docx= or
215 | =pdf= formats.
216 |
217 | For preprocessing hooks, use =org-export-before-processing-hook=.
218 |
219 | ** Delayed loading of ox-pandoc
220 | If you want delayed loading of `ox-pandoc' when
221 | =org-pandoc-menu-entry= is customized, please consider the following
222 | settings in your init file.
223 |
224 | #+BEGIN_SRC emacs-lisp
225 | (with-eval-after-load 'ox
226 | (require 'ox-pandoc))
227 | #+END_SRC
228 |
229 | ** Temporary Files
230 | =ox-pandoc= works by first using Org-mode's own conversion functions to
231 | export a temporary version of the org file /in org format/ and then
232 | calling =pandoc= with the appropriate switches on this file. This
233 | process creates temporary files in the working directory called
234 | "XXXX.tmpZZZZ.org" and "XXXX.tmpZZZZ.css" (if necessary). (ZZZZ is a
235 | random string)
236 |
237 | Under normal operation the temporary files are deleted automatically
238 | when `pandoc` has finished processing them. If you use =recentf=, you
239 | may find these files clutter your recent files list. =M-x
240 | recentf-cleanup= should remove them.
241 |
242 | * Feature Support
243 | ** Source Code Blocks
244 | =ox-pandoc= supports the export of code blocks, including code blocks
245 | for specific output formats (e.g. LaTeX, HTML). Code wrapped in
246 | =#+BEGIN_EXPORT [format]= will be passed to pandoc as-is. Pandoc knows how
247 | to handle these blocks correctly and will include them in the final
248 | output if they match the target format. The same applies for short
249 | format-specific snippets using Org's =@@format:= syntax.
250 |
251 | Blocks and snippets intended only for the pandoc backend can be
252 | specified using =#+BEGIN_EXPORT pandoc= and =@@pandoc:=. The inner
253 | content of these blocks and snippets will be passed to pandoc. This may
254 | be useful for adding extra information for output formats only supported
255 | by pandoc, not by Org's own native converters.
256 |
257 | =ox-pandoc= also supports the evaluation of embedded code blocks wrapped
258 | with =BEGIN_SRC [language]=. The various options described by the
259 | [[https://orgmode.org/manual/Working-with-Source-Code.html#Working-with-Source-Code][Org-mode
260 | manual]] for working with source code should be supported: source code,
261 | results, both or neither can included in the final document and outputs
262 | can be specified for particular output formats (e.g. HTML).
263 |
264 | *IMPORTANT*: if you wish to include evaluated =SRC= blocks and their
265 | results in documents to be processed by pandoc, each block should be
266 | given a unique name. For example.
267 |
268 | #+BEGIN_EXAMPLE
269 | #+NAME: my--block
270 | #+BEGIN_SRC emacs-lisp :exports both :results value
271 | (+ 4 7)
272 | #+END_SRC
273 | #+END_EXAMPLE
274 |
275 | ** Citations and Bibliographies (Experimental)
276 | Citations can be inserted into Org documents and then, when the document
277 | is exported and linked to a bibliography file, the citations are
278 | formatted correctly (e.g. in footnotes, numbered or author-year style)
279 | and a formatted bibliography added to the output document. Pandoc has
280 | long had a [[https://pandoc.org/org.html#citations][number of options
281 | for processing citations]] in org documents. With version 9.5
282 | (September 2021) Org Mode added [[https://orgmode.org/manual/Citation-handling.html][official syntax and support for citations]].
283 |
284 | =ox-pandoc= aims fully to support citation handling and export in Org Mode 9.5+ and =pandoc=. This is complicated by the many potential formats and by there being overlapping but not 100% compatible tools involved. Citation support should be seen as *experimental* and I encourage you to report unexpected results, please including sample documents.
285 |
286 | In all cases, you can indicate what bibliography file is the source for citations in a document with a header =#+BIBLIOGRAPHY: my-references.bib=. Bibliographies can potentially be in =.bib=, =.yaml= or =.json= format. A =#+CITE_EXPORT:= header indicates how citations in the document are processed before being handed to pandoc. Which [[https://orgmode.org/manual/Citation-export-processors.html][exporter]] to choose depends on what final document format is targetted:
287 |
288 | *** Exporting citations to LaTeX / PDF
289 | If the document is going to be transformed to TeX and then compiled by a LaTeX processor to make (for example) a PDF, you should probably choose either the =biblatex= or =natbib= processor. Additional arguments to the header can specify the citation and bibliography format wanted from =biblatex= or =natbib= - see the [[https://orgmode.org/manual/Citation-export-processors.html][Org Manual]].
290 |
291 | In this case, =cite:= commands are replaced with the appropriate LaTeX commands. Pandoc should ignore these and pass them through to the LaTeX compiler.
292 |
293 | *** Exporting citations to HTML, ODT, DocX etc
294 | For other formats, the best approach at the moment is to use the =csl= Org-Mode cite processor; this requires that the =citeproc-el= Emacs package be installed. A =.csl= (Citation Style Language) file can be specified to determine how citations and bibligraphy are to be formatted.
295 |
296 | In this case, citations and bibliography are resolved and formatted before they are passed to Pandoc, which should simply pass on the formatting to the final output document.
297 |
298 | *** Alternative: using Pandoc citation syntax
299 | An alternative to the above (also relevant for Org 9.4 and earlier) is to ensure that citations in text are transformed to [[https://pandoc.org/org.html#citations][one of the formats that Pandoc recognises in org documents]]. You should then set =#+PANDOC_OPTIONS: citeproc:t= in the document header.
300 |
301 | In this case, citations are instead processed by =pandoc= using CSL. This may be a good solution if you are using one of the alternative citation systems for Org, such as =org-ref=. A goal in =ox-pandoc= is to offer an alternative citation export processor that outputs Pandoc-specific citation syntax, but this is still in planning.
302 |
303 | ** Supported Formats
304 |
305 | You can convert an Org-mode file to various formats with simple
306 | commands. The following table shows the supported formats:
307 |
308 | | format | extension | buffer | file |
309 | |-------------------+-----------+--------+------|
310 | | asciidoc | txt | yes | yes |
311 | | beamer | tex | yes | yes |
312 | | beamer-pdf | pdf | no | yes |
313 | | commonmark | md | yes | yes |
314 | | context | tex | yes | yes |
315 | | docbook | xml | yes | yes |
316 | | docx | | no | yes |
317 | | dzslides | html | yes | yes |
318 | | epub2 | epub | no | yes |
319 | | epub3 | epub | no | yes |
320 | | fb2 | fb2 | yes | yes |
321 | | gfm | md | yes | yes |
322 | | html4 | html | yes | yes |
323 | | html5 | html | yes | yes |
324 | | icml | | yes | yes |
325 | | jira | md | yes | yes |
326 | | json | | yes | yes |
327 | | latex | tex | yes | yes |
328 | | latex-pdf | pdf | no | yes |
329 | | man | | yes | yes |
330 | | markdown | md | yes | yes |
331 | | markdown_github | md | yes | yes |
332 | | markdown_mmd | md | yes | yes |
333 | | markdown_phpextra | md | yes | yes |
334 | | markdown_strict | md | yes | yes |
335 | | mediawiki | | yes | yes |
336 | | native | hs | yes | yes |
337 | | odt | | no | yes |
338 | | opendocument | xml | yes | yes |
339 | | opml | | yes | yes |
340 | | org | | yes | yes |
341 | | plain | txt | yes | yes |
342 | | pptx | | no | yes |
343 | | revealjs | html | yes | yes |
344 | | rst | | yes | yes |
345 | | rtf | | yes | yes |
346 | | s5 | html | yes | yes |
347 | | slideous | html | yes | yes |
348 | | slidy | html | yes | yes |
349 | | texinfo | texi | yes | yes |
350 | | textile | | yes | yes |
351 | | typst | typst | yes | yes |
352 | | typst-pdf | pdf | no | yes |
353 |
354 | ** Labelling and numbering of figures, tables etc.
355 | Pandoc provides features for the automated numbering and referencing of
356 | figures, tables, equations and listings through the use of add-on
357 | filters such as [[https://github.com/tomduck/pandoc-xnos][pandoc-xnos]] and [[https://github.com/lierdakil/pandoc-crossref][pandoc-crossref]]. These filters can be
358 | installed and then enabled with =ox-pandoc= in the usual way, such as
359 | through a document header like:
360 | #+begin_src org
361 | #+pandoc_options: filter:pandoc-fignos
362 | #+end_src
363 | These pandoc filters rely on labelling of individual figures in your org
364 | document with a =#+label:= attribute. This attribute is deprecated in
365 | current Org Mode, but can still be used with ox-pandoc to tag figures
366 | etc. that should be automatically numbered and included in lists:
367 | #+begin_src org
368 | #+caption: A caption for the image
369 | #+name: fig:myimage_name
370 | #+label: fig:myimage_label
371 | [[file:myimage.png]]
372 | #+end_src
373 |
374 | * Deprecated and Removed Features
375 | ** Obsolete In-File Options
376 | The following options were supported in previous version of =ox-pandoc=.
377 | They are no longer supported.
378 |
379 | - =EPUB_METADATA:= :: obsolete. Use =epub-metadata= in
380 | =PANDOC_OPTIONS:= instead.
381 | - =EPUB_STYLESHEET:= :: obsolete. Use =epub-stylesheet= in
382 | =PANDOC_OPTIONS:= instead.
383 |
384 | ** Numbering of figures, tables and equations
385 | =ox-pandoc= was originally developed for =pandoc= version 1. Subsequent
386 | versions of pandoc (2.0 in 2017, 3.0 in 2023) and Org mode have improved
387 | support for automatic numbering of figures, tables and equations.
388 |
389 | The non-customisable and non-optional numbering of figures, tables and
390 | the like has been removed from =ox-pandoc=. This is to avoid conflicts
391 | with automatic labelling and numbering of these document elements in
392 | =pandoc= and optional filters.
393 |
394 | This is an incompatible change that alters output from existing
395 | documents. If you require the old behaviour you may pin your =ox-pandoc=
396 | version to one that included numbering of figures. The last tagged
397 | version of =ox-pandoc= with numbering is *v2.0*, from January 2023. No
398 | fixes or features will be ported to this version.
399 |
400 | * History and People
401 | This package was inspired by [[https://github.com/robtillotson/org-pandoc][org-pandoc]], but was entirely re-written by [[http://github.com/kawabata][kawabata]] who is the original author of =ox-pandoc=. The code was released as a emacs package via MELPA.
402 |
403 | In 2021, the package was updated to address small feature requests, apply patches and fix a number of bugs, most of which had arisen through changes in =pandoc= itself. The package is currently maintained by [[http://github.com/a-fent][a-fent]].
404 |
405 | * License
406 |
407 | GPLv2.
408 |
409 |
--------------------------------------------------------------------------------
/ox-pandoc.el:
--------------------------------------------------------------------------------
1 | ;;; ox-pandoc.el --- An Org-mode exporter using pandoc -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2014-2017 KAWABATA, Taichi
4 | ;; Copyright (C) 2021-2023 FENTON, Alex
5 |
6 | ;; Filename: ox-pandoc.el
7 | ;; Description: Another org exporter for Pandoc
8 | ;; Author: KAWABATA, Taichi
9 | ;; FENTON, Alex
10 | ;; Maintainer: FENTON, Alex
11 | ;; Created: 2014-07-20
12 | ;; Version: 2.0
13 | ;; Package-Requires: ((org "8.2") (emacs "24.4") (dash "2.8") (ht "2.0"))
14 | ;; Keywords: tools
15 | ;; URL: https://github.com/a-fent/ox-pandoc
16 |
17 | ;; This program is free software; you can redistribute it and/or modify
18 | ;; it under the terms of the GNU General Public License as published by
19 | ;; the Free Software Foundation, either version 3 of the License, or
20 | ;; (at your option) any later version.
21 |
22 | ;; This program is distributed in the hope that it will be useful,
23 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | ;; GNU General Public License for more details.
26 |
27 | ;; You should have received a copy of the GNU General Public License
28 | ;; along with this program. If not, see .
29 |
30 | ;;; Commentary:
31 |
32 | ;; This is another exporter for org-mode that translates Org-mode file
33 | ;; to various other formats via Pandoc. You need org-mode version 8.2
34 | ;; or later, and Pandoc 2.0 or later, to use this package. For
35 | ;; details, please refer https://github.com/a-fent/ox-pandoc.
36 |
37 | ;;; Code:
38 | (require 'ox-org)
39 | (require 'dash)
40 | (require 'ht)
41 | (require 'cl-lib)
42 | (require 'ox-html) ; from `org', needed for `org-html-standalone-image-p'
43 |
44 | (defgroup org-pandoc nil
45 | "Options specific to Pandoc export back-end."
46 | :tag "Org Pandoc"
47 | :group 'org-export)
48 |
49 | (defconst org-pandoc-valid-options
50 | '( abbreviations ascii atx-headers base-header-level bash-completion
51 | biblatex bibliography citation-abbreviations citeproc columns csl css
52 | data-dir default-image-extension defaults dpi dump-args email-obfuscation eol
53 | epub-chapter-level epub-cover-image epub-embed-font epub-metadata
54 | epub-subdirectory extract-media fail-if-warnings file-scope filter
55 | highlight-style html-q-tags id-prefix ignore-args include-after-body
56 | include-before-body include-in-header incremental
57 | indented-code-classes katex list-extensions list-highlight-languages
58 | list-highlight-styles listings log lua-filter mathjax mathml
59 | metadata metadata-file natbib no-highlight number-offset number-sections
60 | pdf-engine-opt pdf-engine preserve-tabs print-default-data-file
61 | print-default-template quiet reference-doc reference-links
62 | reference-location resource-path section-divs self-contained
63 | shift-heading-level-by slide-level standalone strip-comments
64 | syntax-definition tab-stop table-of-contents template title-prefix
65 | toc top-level-division toc-depth trace track-changes variable
66 | verbose version webtex wrap))
67 |
68 | (defconst org-pandoc-colon-separated-options
69 | '(abbreviations css include-in-header include-before-body
70 | include-after-body pdf-engine-opt epub-embed-font bibliography
71 | filter lua-filter))
72 |
73 | (defconst org-pandoc-file-options
74 | '(abbreviations bibliography citation-abbreviations csl defaults
75 | epub-cover-image epub-embed-font epub-metadata include-after-body
76 | include-before-body include-in-header log lue-filter
77 | print-default-data-file reference-doc syntax-definition))
78 |
79 | (defconst org-pandoc-extensions
80 | '((asciidoc . txt) (beamer . tex)
81 | (commonmark . md) (context . tex)
82 | (docbook4 . dbk) (docbook5 . dbk) (dokuwiki . doku)
83 | (dzslides . html) (epub2 . epub) (epub3 . epub) (gfm . md)
84 | (haddock . hs) (html4 . html) (html5 . html) (jira . md) (latex . tex)
85 | (markdown . md)
86 | (markdown_mmd . md) (markdown_phpextra . md)
87 | (markdown_strict . md) (native . hs)
88 | (opendocument . xml) (plain . txt) (revealjs . html) (s5 . html)
89 | (slideous . html) (slidy . html) (texinfo . texi)
90 | (zimwiki . zim) (typst . typ)))
91 |
92 | (defconst org-pandoc-option-type
93 | `(choice (const t) (const nil)
94 | (alist :key-type (choice ,@(--map `(const ,it) org-pandoc-valid-options))
95 | :value-type (choice (const t) (const nil) string))))
96 |
97 | ;; For exporting with ox-pandoc, the "LABEL" attribute is preserved and
98 | ;; not, as in other exporters, normalised to "NAME"
99 | (defconst org-pandoc-element-keyword-translation-alist
100 | (--remove (equal "LABEL" (car it) ) org-element-keyword-translation-alist))
101 |
102 | (defcustom org-pandoc-with-cite-processors t
103 | "Non-nil means use built-in Org citation exporter.
104 | The default is different from `org-org-with-cite-processors' to
105 | maintain backwards compatibility."
106 | :group 'org-pandoc
107 | :type 'boolean)
108 |
109 | (defcustom org-pandoc-options '((standalone . t)) ;; (mathjax . t) (parse-raw . t)
110 | "Pandoc options."
111 | :group 'org-pandoc
112 | :type org-pandoc-option-type)
113 |
114 | (defcustom org-pandoc-format-extensions nil
115 | "List of Pandoc format extensions for specific output format.
116 | For example, if you want to specify markdown to have footnotes extension,
117 | set as `(markdown_strict+footnotes)'."
118 | :group 'org-pandoc
119 | :type '(repeat symbol))
120 |
121 | (defcustom org-pandoc-command "pandoc"
122 | "Pandoc command."
123 | :group 'org-pandoc
124 | :type 'string)
125 |
126 | (defcustom org-pandoc-check-version t
127 | "Whether to check for a pandoc executable and its version on loading.
128 | If true, will warn if no pandoc can be found, or if it is an older
129 | version. If nil, no checks are performed and no warnings generated."
130 | :group 'org-pandoc
131 | :type 'boolean)
132 |
133 | (defcustom org-pandoc-menu-entry
134 | '(
135 | ;;(?0 "to jats." org-pandoc-export-to-jats)
136 | ;;(?0 "to jats and open." org-pandoc-export-to-jats-and-open)
137 | ;;(? "as jats." org-pandoc-export-as-jats)
138 | ;;(?1 "to epub2 and open." org-pandoc-export-to-epub2-and-open)
139 | ;;(?! "to epub2." org-pandoc-export-to-epub2)
140 | ;;(?2 "to tei." org-pandoc-export-to-tei)
141 | ;;(?2 "to tei and open." org-pandoc-export-to-tei-and-open)
142 | ;;(?" "as tei." org-pandoc-export-as-tei)
143 | ;;(?3 "to markdown_mmd." org-pandoc-export-to-markdown_mmd)
144 | ;;(?3 "to markdown_mmd and open." org-pandoc-export-to-markdown_mmd-and-open)
145 | ;;(?# "as markdown_mmd." org-pandoc-export-as-markdown_mmd)
146 | ;;(?4 "to html5." org-pandoc-export-to-html5)
147 | (?4 "to html5 and open." org-pandoc-export-to-html5-and-open)
148 | (?$ "as html5." org-pandoc-export-as-html5)
149 | (?5 "to html5-pdf and open." org-pandoc-export-to-html5-pdf-and-open)
150 | (?% "to html5-pdf." org-pandoc-export-to-html5-pdf)
151 | ;;(?6 "to markdown_phpextra." org-pandoc-export-to-markdown_phpextra)
152 | ;;(?6 "to markdown_phpextra and open." org-pandoc-export-to-markdown_phpextra-and-open)
153 | ;;(?& "as markdown_phpextra." org-pandoc-export-as-markdown_phpextra)
154 | ;;(?7 "to markdown_strict." org-pandoc-export-to-markdown_strict)
155 | ;;(?7 "to markdown_strict and open." org-pandoc-export-to-markdown_strict-and-open)
156 | ;;(?' "as markdown_strict." org-pandoc-export-as-markdown_strict)
157 | ;;(?8 "to opendocument." org-pandoc-export-to-opendocument)
158 | ;;(?8 "to opendocument and open." org-pandoc-export-to-opendocument-and-open)
159 | ;;(?( "as opendocument." org-pandoc-export-as-opendocument)
160 | ;;(?9 "to opml." org-pandoc-export-to-opml)
161 | ;;(?9 "to opml and open." org-pandoc-export-to-opml-and-open)
162 | ;;(?) "as opml." org-pandoc-export-as-opml)
163 | ;;(?: "to rst." org-pandoc-export-to-rst)
164 | ;;(?: "to rst and open." org-pandoc-export-to-rst-and-open)
165 | ;;(?* "as rst." org-pandoc-export-as-rst)
166 | ;;(?< "to slideous." org-pandoc-export-to-slideous)
167 | ;; (?\[ "to jira." org-pandoc-export-to-jira)
168 | ;; (?\[ "as jira." org-pandoc-export-as-jira)
169 | ;; (?< "to slideous and open." org-pandoc-export-to-slideous-and-open)
170 | ;; (?, "as slideous." org-pandoc-export-as-slideous)
171 | (?= "to ms-pdf and open." org-pandoc-export-to-ms-pdf-and-open)
172 | (?- "to ms-pdf." org-pandoc-export-to-ms-pdf)
173 | ;;(?> "to textile." org-pandoc-export-to-textile)
174 | ;;(?> "to textile and open." org-pandoc-export-to-textile-and-open)
175 | ;;(?. "as textile." org-pandoc-export-as-textile)
176 | ;;(?a "to asciidoc." org-pandoc-export-to-asciidoc)
177 | ;;(?a "to asciidoc and open." org-pandoc-export-to-asciidoc-and-open)
178 | ;;(?A "as asciidoc." org-pandoc-export-as-asciidoc)
179 | (?b "to beamer-pdf and open." org-pandoc-export-to-beamer-pdf-and-open)
180 | (?B "to beamer-pdf." org-pandoc-export-to-beamer-pdf)
181 | ;; (?c "to context-pdf and open." org-pandoc-export-to-context-pdf-and-open)
182 | ;; (?C "to context-pdf." org-pandoc-export-to-context-pdf)
183 | ;;(?d "to docbook5." org-pandoc-export-to-docbook5)
184 | (?d "to docbook5 and open." org-pandoc-export-to-docbook5-and-open)
185 | (?D "as docbook5." org-pandoc-export-as-docbook5)
186 | ;; (?e "to epub3 and open." org-pandoc-export-to-epub3-and-open)
187 | ;; (?E "to epub3." org-pandoc-export-to-epub3)
188 | ;;(?f "to fb2." org-pandoc-export-to-fb2)
189 | ;;(?f "to fb2 and open." org-pandoc-export-to-fb2-and-open)
190 | ;;(?F "as fb2." org-pandoc-export-as-fb2)
191 | ;;(?g "to gfm." org-pandoc-export-to-gfm)
192 | (?g "to gfm and open." org-pandoc-export-to-gfm-and-open)
193 | (?G "as gfm." org-pandoc-export-as-gfm)
194 | ;;(?h "to html4." org-pandoc-export-to-html4)
195 | (?h "to html4 and open." org-pandoc-export-to-html4-and-open)
196 | (?H "as html4." org-pandoc-export-as-html4)
197 | ;;(?i "to icml." org-pandoc-export-to-icml)
198 | ;; (?i "to icml and open." org-pandoc-export-to-icml-and-open)
199 | ;; (?I "as icml." org-pandoc-export-as-icml)
200 | ;;(?j "to json." org-pandoc-export-to-json)
201 | (?j "to json and open." org-pandoc-export-to-json-and-open)
202 | (?J "as json." org-pandoc-export-as-json)
203 | ;;(?k "to markdown." org-pandoc-export-to-markdown)
204 | ;;(?k "to markdown and open." org-pandoc-export-to-markdown-and-open)
205 | ;;(?K "as markdown." org-pandoc-export-as-markdown)
206 | (?l "to latex-pdf and open." org-pandoc-export-to-latex-pdf-and-open)
207 | (?L "to latex-pdf." org-pandoc-export-to-latex-pdf)
208 | ;;(?m "to man." org-pandoc-export-to-man)
209 | (?m "to man and open." org-pandoc-export-to-man-and-open)
210 | (?M "as man." org-pandoc-export-as-man)
211 | ;;(?n "to native." org-pandoc-export-to-native)
212 | (?n "to native and open." org-pandoc-export-to-native-and-open)
213 | (?N "as native." org-pandoc-export-as-native)
214 | (?o "to odt and open." org-pandoc-export-to-odt-and-open)
215 | (?O "to odt." org-pandoc-export-to-odt)
216 | (?p "to pptx and open." org-pandoc-export-to-pptx-and-open)
217 | (?P "to pptx." org-pandoc-export-to-pptx)
218 | ;;(?q "to commonmark." org-pandoc-export-to-commonmark)
219 | ;;(?q "to commonmark and open." org-pandoc-export-to-commonmark-and-open)
220 | ;;(?Q "as commonmark." org-pandoc-export-as-commonmark)
221 | ;;(?r "to rtf." org-pandoc-export-to-rtf)
222 | (?r "to rtf and open." org-pandoc-export-to-rtf-and-open)
223 | (?R "as rtf." org-pandoc-export-as-rtf)
224 | ;;(?s "to s5." org-pandoc-export-to-s5)
225 | ;;(?s "to s5 and open." org-pandoc-export-to-s5-and-open)
226 | ;;(?S "as s5." org-pandoc-export-as-s5)
227 | ;;(?t "to texinfo." org-pandoc-export-to-texinfo)
228 | ;;(?t "to texinfo and open." org-pandoc-export-to-texinfo-and-open)
229 | ;;(?T "as texinfo." org-pandoc-export-as-texinfo)
230 | ;; (?, "to typst." org-pandoc-export-to-typst)
231 | ;; (?, "to typst and open." org-pandoc-export-to-typst-and-open)
232 | ;; (?, "as typst." org-pandoc-export-as-typst)
233 | ;; (?< "to typst-pdf." org-pandoc-export-to-typst-pdf)
234 | ;; (?< "to typst-pdf and open." org-pandoc-export-to-typst-pdf-and-open)
235 | ;;(?u "to dokuwiki." org-pandoc-export-to-dokuwiki)
236 | ;; (?u "to dokuwiki and open." org-pandoc-export-to-dokuwiki-and-open)
237 | ;; (?U "as dokuwiki." org-pandoc-export-as-dokuwiki)
238 | ;;(?v "to revealjs." org-pandoc-export-to-revealjs)
239 | ;; (?v "to revealjs and open." org-pandoc-export-to-revealjs-and-open)
240 | ;; (?V "as revealjs." org-pandoc-export-as-revealjs)
241 | ;;(?w "to mediawiki." org-pandoc-export-to-mediawiki)
242 | ;; (?w "to mediawiki and open." org-pandoc-export-to-mediawiki-and-open)
243 | ;; (?W "as mediawiki." org-pandoc-export-as-mediawiki)
244 | (?x "to docx and open." org-pandoc-export-to-docx-and-open)
245 | (?X "to docx." org-pandoc-export-to-docx)
246 | ;;(?y "to slidy." org-pandoc-export-to-slidy)
247 | ;; (?y "to slidy and open." org-pandoc-export-to-slidy-and-open)
248 | ;; (?Y "as slidy." org-pandoc-export-as-slidy)
249 | ;;(?z "to dzslides." org-pandoc-export-to-dzslides)
250 | ;; (?z "to dzslides and open." org-pandoc-export-to-dzslides-and-open)
251 | ;; (?Z "as dzslides." org-pandoc-export-as-dzslides)
252 | ;;(?{ "to muse." org-pandoc-export-to-muse)
253 | ;;(?{ "to muse and open." org-pandoc-export-to-muse-and-open)
254 | ;;(?[ "as muse." org-pandoc-export-as-muse)
255 | ;;(?} "to zimwiki." org-pandoc-export-to-zimwiki)
256 | ;;(?} "to zimwiki and open." org-pandoc-export-to-zimwiki-and-open)
257 | ;;(?] "as zimwiki." org-pandoc-export-as-zimwiki)
258 | ;;(?~ "to haddock." org-pandoc-export-to-haddock)
259 | ;;(?~ "to haddock and open." org-pandoc-export-to-haddock-and-open)
260 | ;;(?^ "as haddock." org-pandoc-export-as-haddock)
261 | )
262 | "Pandoc menu-entry."
263 | :group 'org-pandoc
264 | :type 'list)
265 |
266 | (org-export-define-derived-backend 'pandoc 'org
267 | :translate-alist '((entity . org-pandoc-entity)
268 | (export-block . org-pandoc-export-block)
269 | (export-snippet . org-pandoc-export-snippet)
270 | (latex-environment . org-pandoc-latex-environ)
271 | (link . org-pandoc-link)
272 | (paragraph . org-pandoc-paragraph)
273 | (src-block . org-pandoc-src-block)
274 | (table . org-pandoc-table)
275 | (template . org-pandoc-template))
276 | ;; :export-block "PANDOC"
277 | :menu-entry
278 | `(?p "export via pandoc"
279 | ,org-pandoc-menu-entry)
280 | :options-alist
281 | '((:pandoc-options "PANDOC_OPTIONS" nil nil space)
282 | (:pandoc-extensions "PANDOC_EXTENSIONS" nil nil space)
283 | (:pandoc-metadata "PANDOC_METADATA" nil nil space)
284 | (:pandoc-variables "PANDOC_VARIABLES" nil nil space)
285 | (:epub-chapter-level "EPUB_CHAPTER_LEVEL" nil nil t)
286 | (:epub-cover-image "EPUB_COVER" nil nil t)
287 | (:epub-stylesheet "EPUB_STYLESHEET" nil nil t)
288 | (:epub-embed-font "EPUB_EMBED_FONT" nil nil newline)
289 | (:epub-meta "EPUB_META" nil nil newline)
290 | (:epub-css "EPUB_CSS" nil nil newline)
291 | (:epub-rights "EPUB_RIGHTS" nil nil newline)
292 | (:bibliography "BIBLIOGRAPHY")
293 | (:with-cite-processors nil nil org-pandoc-with-cite-processors)))
294 |
295 | (defcustom org-pandoc-epub-rights
296 | (concat "Copyright " (format-time-string "%Y")
297 | (if user-full-name (concat " " user-full-name))
298 | (if user-mail-address (concat " <" user-mail-address ">")))
299 | "Pandoc option for EPUB copyrihgt statement."
300 | :group 'org-pandoc
301 | :type 'string)
302 |
303 | ;;; each backend processor
304 |
305 | (defcustom org-pandoc-options-for-asciidoc nil
306 | "Pandoc options for asciidoc."
307 | :group 'org-pandoc
308 | :type org-pandoc-option-type)
309 |
310 | (defcustom org-pandoc-after-processing-asciidoc-hook nil
311 | "Hook called after processing asciidoc."
312 | :group 'org-pandoc
313 | :type 'hook)
314 |
315 | ;;;###autoload
316 | (defun org-pandoc-export-to-asciidoc (&optional a s v b e)
317 | "Export to asciidoc."
318 | (interactive) (org-pandoc-export 'asciidoc a s v b e))
319 |
320 | ;;;###autoload
321 | (defun org-pandoc-export-to-asciidoc-and-open (&optional a s v b e)
322 | "Export to asciidoc and open."
323 | (interactive) (org-pandoc-export 'asciidoc a s v b e 0))
324 |
325 | ;;;###autoload
326 | (defun org-pandoc-export-as-asciidoc (&optional a s v b e)
327 | "Export as asciidoc."
328 | (interactive) (org-pandoc-export 'asciidoc a s v b e t))
329 |
330 | (defcustom org-pandoc-options-for-beamer nil
331 | "Pandoc options for beamer."
332 | :group 'org-pandoc
333 | :type org-pandoc-option-type)
334 |
335 | (defcustom org-pandoc-after-processing-beamer-hook nil
336 | "Hook called after processing beamer."
337 | :group 'org-pandoc
338 | :type 'hook)
339 |
340 | ;;;###autoload
341 | (defun org-pandoc-export-to-beamer (&optional a s v b e)
342 | "Export to beamer."
343 | (interactive) (org-pandoc-export 'beamer a s v b e))
344 |
345 | ;;;###autoload
346 | (defun org-pandoc-export-to-beamer-and-open (&optional a s v b e)
347 | "Export to beamer and open."
348 | (interactive) (org-pandoc-export 'beamer a s v b e 0))
349 |
350 | ;;;###autoload
351 | (defun org-pandoc-export-as-beamer (&optional a s v b e)
352 | "Export as beamer."
353 | (interactive) (org-pandoc-export 'beamer a s v b e t))
354 |
355 | (defcustom org-pandoc-options-for-beamer-pdf nil
356 | "Pandoc options for beamer-pdf."
357 | :group 'org-pandoc
358 | :type org-pandoc-option-type)
359 |
360 | ;;;###autoload
361 | (defun org-pandoc-export-to-beamer-pdf (&optional a s v b e)
362 | "Export to beamer-pdf."
363 | (interactive) (org-pandoc-export 'beamer-pdf a s v b e))
364 |
365 | ;;;###autoload
366 | (defun org-pandoc-export-to-beamer-pdf-and-open (&optional a s v b e)
367 | "Export to beamer-pdf and open."
368 | (interactive) (org-pandoc-export 'beamer-pdf a s v b e 0))
369 |
370 | (defcustom org-pandoc-options-for-commonmark nil
371 | "Pandoc options for commonmark."
372 | :group 'org-pandoc
373 | :type org-pandoc-option-type)
374 |
375 | (defcustom org-pandoc-after-processing-commonmark-hook nil
376 | "Hook called after processing commonmark."
377 | :group 'org-pandoc
378 | :type 'hook)
379 |
380 | ;;;###autoload
381 | (defun org-pandoc-export-to-commonmark (&optional a s v b e)
382 | "Export to commonmark."
383 | (interactive) (org-pandoc-export 'commonmark a s v b e))
384 |
385 | ;;;###autoload
386 | (defun org-pandoc-export-to-commonmark-and-open (&optional a s v b e)
387 | "Export to commonmark and open."
388 | (interactive) (org-pandoc-export 'commonmark a s v b e 0))
389 |
390 | ;;;###autoload
391 | (defun org-pandoc-export-as-commonmark (&optional a s v b e)
392 | "Export as commonmark."
393 | (interactive) (org-pandoc-export 'commonmark a s v b e t))
394 |
395 | (defcustom org-pandoc-options-for-context nil
396 | "Pandoc options for context."
397 | :group 'org-pandoc
398 | :type org-pandoc-option-type)
399 |
400 | (defcustom org-pandoc-after-processing-context-hook nil
401 | "Hook called after processing context."
402 | :group 'org-pandoc
403 | :type 'hook)
404 |
405 | ;;;###autoload
406 | (defun org-pandoc-export-to-context (&optional a s v b e)
407 | "Export to context."
408 | (interactive) (org-pandoc-export 'context a s v b e))
409 |
410 | ;;;###autoload
411 | (defun org-pandoc-export-to-context-and-open (&optional a s v b e)
412 | "Export to context and open."
413 | (interactive) (org-pandoc-export 'context a s v b e 0))
414 |
415 | ;;;###autoload
416 | (defun org-pandoc-export-as-context (&optional a s v b e)
417 | "Export as context."
418 | (interactive) (org-pandoc-export 'context a s v b e t))
419 |
420 | (defcustom org-pandoc-options-for-context-pdf nil
421 | "Pandoc options for context-pdf."
422 | :group 'org-pandoc
423 | :type org-pandoc-option-type)
424 |
425 | ;;;###autoload
426 | (defun org-pandoc-export-to-context-pdf (&optional a s v b e)
427 | "Export to context-pdf."
428 | (interactive) (org-pandoc-export 'context-pdf a s v b e))
429 |
430 | ;;;###autoload
431 | (defun org-pandoc-export-to-context-pdf-and-open (&optional a s v b e)
432 | "Export to context-pdf and open."
433 | (interactive) (org-pandoc-export 'context-pdf a s v b e 0))
434 |
435 | (defcustom org-pandoc-options-for-docbook4 nil
436 | "Pandoc options for docbook4."
437 | :group 'org-pandoc
438 | :type org-pandoc-option-type)
439 |
440 | (defcustom org-pandoc-after-processing-docbook4-hook nil
441 | "Hook called after processing docbook4."
442 | :group 'org-pandoc
443 | :type 'hook)
444 |
445 | ;;;###autoload
446 | (defun org-pandoc-export-to-docbook4 (&optional a s v b e)
447 | "Export to docbook4."
448 | (interactive) (org-pandoc-export 'docbook4 a s v b e))
449 |
450 | ;;;###autoload
451 | (defun org-pandoc-export-to-docbook4-and-open (&optional a s v b e)
452 | "Export to docbook4 and open."
453 | (interactive) (org-pandoc-export 'docbook4 a s v b e 0))
454 |
455 | ;;;###autoload
456 | (defun org-pandoc-export-as-docbook4 (&optional a s v b e)
457 | "Export as docbook4."
458 | (interactive) (org-pandoc-export 'docbook4 a s v b e t))
459 |
460 | (defcustom org-pandoc-options-for-docbook5 nil
461 | "Pandoc options for docbook5."
462 | :group 'org-pandoc
463 | :type org-pandoc-option-type)
464 |
465 | (defcustom org-pandoc-after-processing-docbook5-hook nil
466 | "Hook called after processing docbook5."
467 | :group 'org-pandoc
468 | :type 'hook)
469 |
470 | ;;;###autoload
471 | (defun org-pandoc-export-to-docbook5 (&optional a s v b e)
472 | "Export to docbook5."
473 | (interactive) (org-pandoc-export 'docbook5 a s v b e))
474 |
475 | ;;;###autoload
476 | (defun org-pandoc-export-to-docbook5-and-open (&optional a s v b e)
477 | "Export to docbook5 and open."
478 | (interactive) (org-pandoc-export 'docbook5 a s v b e 0))
479 |
480 | ;;;###autoload
481 | (defun org-pandoc-export-as-docbook5 (&optional a s v b e)
482 | "Export as docbook5."
483 | (interactive) (org-pandoc-export 'docbook5 a s v b e t))
484 |
485 | (defcustom org-pandoc-options-for-docx nil
486 | "Pandoc options for docx."
487 | :group 'org-pandoc
488 | :type org-pandoc-option-type)
489 |
490 | ;;;###autoload
491 | (defun org-pandoc-export-to-docx (&optional a s v b e)
492 | "Export to docx."
493 | (interactive) (org-pandoc-export 'docx a s v b e))
494 |
495 | ;;;###autoload
496 | (defun org-pandoc-export-to-docx-and-open (&optional a s v b e)
497 | "Export to docx and open."
498 | (interactive) (org-pandoc-export 'docx a s v b e 0))
499 |
500 | (defcustom org-pandoc-options-for-dokuwiki nil
501 | "Pandoc options for dokuwiki."
502 | :group 'org-pandoc
503 | :type org-pandoc-option-type)
504 |
505 | (defcustom org-pandoc-after-processing-dokuwiki-hook nil
506 | "Hook called after processing dokuwiki."
507 | :group 'org-pandoc
508 | :type 'hook)
509 |
510 | ;;;###autoload
511 | (defun org-pandoc-export-to-dokuwiki (&optional a s v b e)
512 | "Export to dokuwiki."
513 | (interactive) (org-pandoc-export 'dokuwiki a s v b e))
514 |
515 | ;;;###autoload
516 | (defun org-pandoc-export-to-dokuwiki-and-open (&optional a s v b e)
517 | "Export to dokuwiki and open."
518 | (interactive) (org-pandoc-export 'dokuwiki a s v b e 0))
519 |
520 | ;;;###autoload
521 | (defun org-pandoc-export-as-dokuwiki (&optional a s v b e)
522 | "Export as dokuwiki."
523 | (interactive) (org-pandoc-export 'dokuwiki a s v b e t))
524 |
525 | (defcustom org-pandoc-options-for-dzslides nil
526 | "Pandoc options for dzslides."
527 | :group 'org-pandoc
528 | :type org-pandoc-option-type)
529 |
530 | (defcustom org-pandoc-after-processing-dzslides-hook nil
531 | "Hook called after processing dzslides."
532 | :group 'org-pandoc
533 | :type 'hook)
534 |
535 | ;;;###autoload
536 | (defun org-pandoc-export-to-dzslides (&optional a s v b e)
537 | "Export to dzslides."
538 | (interactive) (org-pandoc-export 'dzslides a s v b e))
539 |
540 | ;;;###autoload
541 | (defun org-pandoc-export-to-dzslides-and-open (&optional a s v b e)
542 | "Export to dzslides and open."
543 | (interactive) (org-pandoc-export 'dzslides a s v b e 0))
544 |
545 | ;;;###autoload
546 | (defun org-pandoc-export-as-dzslides (&optional a s v b e)
547 | "Export as dzslides."
548 | (interactive) (org-pandoc-export 'dzslides a s v b e t))
549 |
550 | (defcustom org-pandoc-options-for-epub2 nil
551 | "Pandoc options for epub2."
552 | :group 'org-pandoc
553 | :type org-pandoc-option-type)
554 |
555 | ;;;###autoload
556 | (defun org-pandoc-export-to-epub2 (&optional a s v b e)
557 | "Export to epub2."
558 | (interactive) (org-pandoc-export 'epub2 a s v b e))
559 |
560 | ;;;###autoload
561 | (defun org-pandoc-export-to-epub2-and-open (&optional a s v b e)
562 | "Export to epub2 and open."
563 | (interactive) (org-pandoc-export 'epub2 a s v b e 0))
564 |
565 | (defcustom org-pandoc-options-for-epub3 nil
566 | "Pandoc options for epub3."
567 | :group 'org-pandoc
568 | :type org-pandoc-option-type)
569 |
570 | ;;;###autoload
571 | (defun org-pandoc-export-to-epub3 (&optional a s v b e)
572 | "Export to epub3."
573 | (interactive) (org-pandoc-export 'epub3 a s v b e))
574 |
575 | ;;;###autoload
576 | (defun org-pandoc-export-to-epub3-and-open (&optional a s v b e)
577 | "Export to epub3 and open."
578 | (interactive) (org-pandoc-export 'epub3 a s v b e 0))
579 |
580 | (defcustom org-pandoc-options-for-fb2 nil
581 | "Pandoc options for fb2."
582 | :group 'org-pandoc
583 | :type org-pandoc-option-type)
584 |
585 | (defcustom org-pandoc-after-processing-fb2-hook nil
586 | "Hook called after processing fb2."
587 | :group 'org-pandoc
588 | :type 'hook)
589 |
590 | ;;;###autoload
591 | (defun org-pandoc-export-to-fb2 (&optional a s v b e)
592 | "Export to fb2."
593 | (interactive) (org-pandoc-export 'fb2 a s v b e))
594 |
595 | ;;;###autoload
596 | (defun org-pandoc-export-to-fb2-and-open (&optional a s v b e)
597 | "Export to fb2 and open."
598 | (interactive) (org-pandoc-export 'fb2 a s v b e 0))
599 |
600 | ;;;###autoload
601 | (defun org-pandoc-export-as-fb2 (&optional a s v b e)
602 | "Export as fb2."
603 | (interactive) (org-pandoc-export 'fb2 a s v b e t))
604 |
605 | (defcustom org-pandoc-options-for-gfm nil
606 | "Pandoc options for gfm."
607 | :group 'org-pandoc
608 | :type org-pandoc-option-type)
609 |
610 | (defcustom org-pandoc-after-processing-gfm-hook nil
611 | "Hook called after processing gfm."
612 | :group 'org-pandoc
613 | :type 'hook)
614 |
615 | ;;;###autoload
616 | (defun org-pandoc-export-to-gfm (&optional a s v b e)
617 | "Export to gfm."
618 | (interactive) (org-pandoc-export 'gfm a s v b e))
619 |
620 | ;;;###autoload
621 | (defun org-pandoc-export-to-gfm-and-open (&optional a s v b e)
622 | "Export to gfm and open."
623 | (interactive) (org-pandoc-export 'gfm a s v b e 0))
624 |
625 | ;;;###autoload
626 | (defun org-pandoc-export-as-gfm (&optional a s v b e)
627 | "Export as gfm."
628 | (interactive) (org-pandoc-export 'gfm a s v b e t))
629 |
630 | (defcustom org-pandoc-options-for-haddock nil
631 | "Pandoc options for haddock."
632 | :group 'org-pandoc
633 | :type org-pandoc-option-type)
634 |
635 | (defcustom org-pandoc-after-processing-haddock-hook nil
636 | "Hook called after processing haddock."
637 | :group 'org-pandoc
638 | :type 'hook)
639 |
640 | ;;;###autoload
641 | (defun org-pandoc-export-to-haddock (&optional a s v b e)
642 | "Export to haddock."
643 | (interactive) (org-pandoc-export 'haddock a s v b e))
644 |
645 | ;;;###autoload
646 | (defun org-pandoc-export-to-haddock-and-open (&optional a s v b e)
647 | "Export to haddock and open."
648 | (interactive) (org-pandoc-export 'haddock a s v b e 0))
649 |
650 | ;;;###autoload
651 | (defun org-pandoc-export-as-haddock (&optional a s v b e)
652 | "Export as haddock."
653 | (interactive) (org-pandoc-export 'haddock a s v b e t))
654 |
655 | (defcustom org-pandoc-options-for-html4 nil
656 | "Pandoc options for html4."
657 | :group 'org-pandoc
658 | :type org-pandoc-option-type)
659 |
660 | (defcustom org-pandoc-after-processing-html4-hook nil
661 | "Hook called after processing html4."
662 | :group 'org-pandoc
663 | :type 'hook)
664 |
665 | ;;;###autoload
666 | (defun org-pandoc-export-to-html4 (&optional a s v b e)
667 | "Export to html4."
668 | (interactive) (org-pandoc-export 'html4 a s v b e))
669 |
670 | ;;;###autoload
671 | (defun org-pandoc-export-to-html4-and-open (&optional a s v b e)
672 | "Export to html4 and open."
673 | (interactive) (org-pandoc-export 'html4 a s v b e 0))
674 |
675 | ;;;###autoload
676 | (defun org-pandoc-export-as-html4 (&optional a s v b e)
677 | "Export as html4."
678 | (interactive) (org-pandoc-export 'html4 a s v b e t))
679 |
680 | (defcustom org-pandoc-options-for-html5 nil
681 | "Pandoc options for html5."
682 | :group 'org-pandoc
683 | :type org-pandoc-option-type)
684 |
685 | (defcustom org-pandoc-after-processing-html5-hook nil
686 | "Hook called after processing html5."
687 | :group 'org-pandoc
688 | :type 'hook)
689 |
690 | ;;;###autoload
691 | (defun org-pandoc-export-to-html5 (&optional a s v b e)
692 | "Export to html5."
693 | (interactive) (org-pandoc-export 'html5 a s v b e))
694 |
695 | ;;;###autoload
696 | (defun org-pandoc-export-to-html5-and-open (&optional a s v b e)
697 | "Export to html5 and open."
698 | (interactive) (org-pandoc-export 'html5 a s v b e 0))
699 |
700 | ;;;###autoload
701 | (defun org-pandoc-export-as-html5 (&optional a s v b e)
702 | "Export as html5."
703 | (interactive) (org-pandoc-export 'html5 a s v b e t))
704 |
705 | (defcustom org-pandoc-options-for-html5-pdf nil
706 | "Pandoc options for html5-pdf."
707 | :group 'org-pandoc
708 | :type org-pandoc-option-type)
709 |
710 | ;;;###autoload
711 | (defun org-pandoc-export-to-html5-pdf (&optional a s v b e)
712 | "Export to html5-pdf."
713 | (interactive) (org-pandoc-export 'html5-pdf a s v b e))
714 |
715 | ;;;###autoload
716 | (defun org-pandoc-export-to-html5-pdf-and-open (&optional a s v b e)
717 | "Export to html5-pdf and open."
718 | (interactive) (org-pandoc-export 'html5-pdf a s v b e 0))
719 |
720 | (defcustom org-pandoc-options-for-icml nil
721 | "Pandoc options for icml."
722 | :group 'org-pandoc
723 | :type org-pandoc-option-type)
724 |
725 | (defcustom org-pandoc-after-processing-icml-hook nil
726 | "Hook called after processing icml."
727 | :group 'org-pandoc
728 | :type 'hook)
729 |
730 | ;;;###autoload
731 | (defun org-pandoc-export-to-icml (&optional a s v b e)
732 | "Export to icml."
733 | (interactive) (org-pandoc-export 'icml a s v b e))
734 |
735 | ;;;###autoload
736 | (defun org-pandoc-export-to-icml-and-open (&optional a s v b e)
737 | "Export to icml and open."
738 | (interactive) (org-pandoc-export 'icml a s v b e 0))
739 |
740 | ;;;###autoload
741 | (defun org-pandoc-export-as-icml (&optional a s v b e)
742 | "Export as icml."
743 | (interactive) (org-pandoc-export 'icml a s v b e t))
744 |
745 | (defcustom org-pandoc-options-for-jats nil
746 | "Pandoc options for jats."
747 | :group 'org-pandoc
748 | :type org-pandoc-option-type)
749 |
750 | (defcustom org-pandoc-after-processing-jats-hook nil
751 | "Hook called after processing jats."
752 | :group 'org-pandoc
753 | :type 'hook)
754 |
755 | ;;;###autoload
756 | (defun org-pandoc-export-to-jats (&optional a s v b e)
757 | "Export to jats."
758 | (interactive) (org-pandoc-export 'jats a s v b e))
759 |
760 | ;;;###autoload
761 | (defun org-pandoc-export-to-jats-and-open (&optional a s v b e)
762 | "Export to jats and open."
763 | (interactive) (org-pandoc-export 'jats a s v b e 0))
764 |
765 | ;;;###autoload
766 | (defun org-pandoc-export-as-jats (&optional a s v b e)
767 | "Export as jats."
768 | (interactive) (org-pandoc-export 'jats a s v b e t))
769 |
770 | (defcustom org-pandoc-options-for-jira nil
771 | "Pandoc options for jira."
772 | :group 'org-pandoc
773 | :type org-pandoc-option-type)
774 |
775 | (defcustom org-pandoc-after-processing-jira-hook nil
776 | "Hook called after processing jira."
777 | :group 'org-pandoc
778 | :type 'hook)
779 |
780 | ;;;###autoload
781 | (defun org-pandoc-export-to-jira (&optional a s v b e)
782 | "Export to jira."
783 | (interactive) (org-pandoc-export 'jira a s v b e))
784 |
785 | ;;;###autoload
786 | (defun org-pandoc-export-as-jira (&optional a s v b e)
787 | "Export as jira."
788 | (interactive) (org-pandoc-export 'jira a s v b e t))
789 |
790 | (defcustom org-pandoc-options-for-json nil
791 | "Pandoc options for json."
792 | :group 'org-pandoc
793 | :type org-pandoc-option-type)
794 |
795 | (defcustom org-pandoc-after-processing-json-hook nil
796 | "Hook called after processing json."
797 | :group 'org-pandoc
798 | :type 'hook)
799 |
800 | ;;;###autoload
801 | (defun org-pandoc-export-to-json (&optional a s v b e)
802 | "Export to json."
803 | (interactive) (org-pandoc-export 'json a s v b e))
804 |
805 | ;;;###autoload
806 | (defun org-pandoc-export-to-json-and-open (&optional a s v b e)
807 | "Export to json and open."
808 | (interactive) (org-pandoc-export 'json a s v b e 0))
809 |
810 | ;;;###autoload
811 | (defun org-pandoc-export-as-json (&optional a s v b e)
812 | "Export as json."
813 | (interactive) (org-pandoc-export 'json a s v b e t))
814 |
815 | (defcustom org-pandoc-options-for-latex nil
816 | "Pandoc options for latex."
817 | :group 'org-pandoc
818 | :type org-pandoc-option-type)
819 |
820 | (defcustom org-pandoc-after-processing-latex-hook nil
821 | "Hook called after processing latex."
822 | :group 'org-pandoc
823 | :type 'hook)
824 |
825 | ;;;###autoload
826 | (defun org-pandoc-export-to-latex (&optional a s v b e)
827 | "Export to latex."
828 | (interactive) (org-pandoc-export 'latex a s v b e))
829 |
830 | ;;;###autoload
831 | (defun org-pandoc-export-to-latex-and-open (&optional a s v b e)
832 | "Export to latex and open."
833 | (interactive) (org-pandoc-export 'latex a s v b e 0))
834 |
835 | ;;;###autoload
836 | (defun org-pandoc-export-as-latex (&optional a s v b e)
837 | "Export as latex."
838 | (interactive) (org-pandoc-export 'latex a s v b e t))
839 |
840 | (defcustom org-pandoc-options-for-latex-pdf nil
841 | "Pandoc options for latex-pdf."
842 | :group 'org-pandoc
843 | :type org-pandoc-option-type)
844 |
845 | ;;;###autoload
846 | (defun org-pandoc-export-to-latex-pdf (&optional a s v b e)
847 | "Export to latex-pdf."
848 | (interactive) (org-pandoc-export 'latex-pdf a s v b e))
849 |
850 | ;;;###autoload
851 | (defun org-pandoc-export-to-latex-pdf-and-open (&optional a s v b e)
852 | "Export to latex-pdf and open."
853 | (interactive) (org-pandoc-export 'latex-pdf a s v b e 0))
854 |
855 | (defcustom org-pandoc-options-for-man nil
856 | "Pandoc options for man."
857 | :group 'org-pandoc
858 | :type org-pandoc-option-type)
859 |
860 | (defcustom org-pandoc-after-processing-man-hook nil
861 | "Hook called after processing man."
862 | :group 'org-pandoc
863 | :type 'hook)
864 |
865 | ;;;###autoload
866 | (defun org-pandoc-export-to-man (&optional a s v b e)
867 | "Export to man."
868 | (interactive) (org-pandoc-export 'man a s v b e))
869 |
870 | ;;;###autoload
871 | (defun org-pandoc-export-to-man-and-open (&optional a s v b e)
872 | "Export to man and open."
873 | (interactive) (org-pandoc-export 'man a s v b e 0))
874 |
875 | ;;;###autoload
876 | (defun org-pandoc-export-as-man (&optional a s v b e)
877 | "Export as man."
878 | (interactive) (org-pandoc-export 'man a s v b e t))
879 |
880 | (defcustom org-pandoc-options-for-markdown nil
881 | "Pandoc options for markdown."
882 | :group 'org-pandoc
883 | :type org-pandoc-option-type)
884 |
885 | (defcustom org-pandoc-after-processing-markdown-hook nil
886 | "Hook called after processing markdown."
887 | :group 'org-pandoc
888 | :type 'hook)
889 |
890 | ;;;###autoload
891 | (defun org-pandoc-export-to-markdown (&optional a s v b e)
892 | "Export to markdown."
893 | (interactive) (org-pandoc-export 'markdown a s v b e))
894 |
895 | ;;;###autoload
896 | (defun org-pandoc-export-to-markdown-and-open (&optional a s v b e)
897 | "Export to markdown and open."
898 | (interactive) (org-pandoc-export 'markdown a s v b e 0))
899 |
900 | ;;;###autoload
901 | (defun org-pandoc-export-as-markdown (&optional a s v b e)
902 | "Export as markdown."
903 | (interactive) (org-pandoc-export 'markdown a s v b e t))
904 |
905 | (defcustom org-pandoc-options-for-markdown_mmd nil
906 | "Pandoc options for markdown_mmd."
907 | :group 'org-pandoc
908 | :type org-pandoc-option-type)
909 |
910 | (defcustom org-pandoc-after-processing-markdown_mmd-hook nil
911 | "Hook called after processing markdown_mmd."
912 | :group 'org-pandoc
913 | :type 'hook)
914 |
915 | ;;;###autoload
916 | (defun org-pandoc-export-to-markdown_mmd (&optional a s v b e)
917 | "Export to markdown_mmd."
918 | (interactive) (org-pandoc-export 'markdown_mmd a s v b e))
919 |
920 | ;;;###autoload
921 | (defun org-pandoc-export-to-markdown_mmd-and-open (&optional a s v b e)
922 | "Export to markdown_mmd and open."
923 | (interactive) (org-pandoc-export 'markdown_mmd a s v b e 0))
924 |
925 | ;;;###autoload
926 | (defun org-pandoc-export-as-markdown_mmd (&optional a s v b e)
927 | "Export as markdown_mmd."
928 | (interactive) (org-pandoc-export 'markdown_mmd a s v b e t))
929 |
930 | (defcustom org-pandoc-options-for-markdown_phpextra nil
931 | "Pandoc options for markdown_phpextra."
932 | :group 'org-pandoc
933 | :type org-pandoc-option-type)
934 |
935 | (defcustom org-pandoc-after-processing-markdown_phpextra-hook nil
936 | "Hook called after processing markdown_phpextra."
937 | :group 'org-pandoc
938 | :type 'hook)
939 |
940 | ;;;###autoload
941 | (defun org-pandoc-export-to-markdown_phpextra (&optional a s v b e)
942 | "Export to markdown_phpextra."
943 | (interactive) (org-pandoc-export 'markdown_phpextra a s v b e))
944 |
945 | ;;;###autoload
946 | (defun org-pandoc-export-to-markdown_phpextra-and-open (&optional a s v b e)
947 | "Export to markdown_phpextra and open."
948 | (interactive) (org-pandoc-export 'markdown_phpextra a s v b e 0))
949 |
950 | ;;;###autoload
951 | (defun org-pandoc-export-as-markdown_phpextra (&optional a s v b e)
952 | "Export as markdown_phpextra."
953 | (interactive) (org-pandoc-export 'markdown_phpextra a s v b e t))
954 |
955 | (defcustom org-pandoc-options-for-markdown_strict nil
956 | "Pandoc options for markdown_strict."
957 | :group 'org-pandoc
958 | :type org-pandoc-option-type)
959 |
960 | (defcustom org-pandoc-after-processing-markdown_strict-hook nil
961 | "Hook called after processing markdown_strict."
962 | :group 'org-pandoc
963 | :type 'hook)
964 |
965 | ;;;###autoload
966 | (defun org-pandoc-export-to-markdown_strict (&optional a s v b e)
967 | "Export to markdown_strict."
968 | (interactive) (org-pandoc-export 'markdown_strict a s v b e))
969 |
970 | ;;;###autoload
971 | (defun org-pandoc-export-to-markdown_strict-and-open (&optional a s v b e)
972 | "Export to markdown_strict and open."
973 | (interactive) (org-pandoc-export 'markdown_strict a s v b e 0))
974 |
975 | ;;;###autoload
976 | (defun org-pandoc-export-as-markdown_strict (&optional a s v b e)
977 | "Export as markdown_strict."
978 | (interactive) (org-pandoc-export 'markdown_strict a s v b e t))
979 |
980 | (defcustom org-pandoc-options-for-mediawiki nil
981 | "Pandoc options for mediawiki."
982 | :group 'org-pandoc
983 | :type org-pandoc-option-type)
984 |
985 | (defcustom org-pandoc-after-processing-mediawiki-hook nil
986 | "Hook called after processing mediawiki."
987 | :group 'org-pandoc
988 | :type 'hook)
989 |
990 | ;;;###autoload
991 | (defun org-pandoc-export-to-mediawiki (&optional a s v b e)
992 | "Export to mediawiki."
993 | (interactive) (org-pandoc-export 'mediawiki a s v b e))
994 |
995 | ;;;###autoload
996 | (defun org-pandoc-export-to-mediawiki-and-open (&optional a s v b e)
997 | "Export to mediawiki and open."
998 | (interactive) (org-pandoc-export 'mediawiki a s v b e 0))
999 |
1000 | ;;;###autoload
1001 | (defun org-pandoc-export-as-mediawiki (&optional a s v b e)
1002 | "Export as mediawiki."
1003 | (interactive) (org-pandoc-export 'mediawiki a s v b e t))
1004 |
1005 | (defcustom org-pandoc-options-for-ms nil
1006 | "Pandoc options for ms."
1007 | :group 'org-pandoc
1008 | :type org-pandoc-option-type)
1009 |
1010 | (defcustom org-pandoc-after-processing-ms-hook nil
1011 | "Hook called after processing ms."
1012 | :group 'org-pandoc
1013 | :type 'hook)
1014 |
1015 | ;;;###autoload
1016 | (defun org-pandoc-export-to-ms (&optional a s v b e)
1017 | "Export to ms."
1018 | (interactive) (org-pandoc-export 'ms a s v b e))
1019 |
1020 | ;;;###autoload
1021 | (defun org-pandoc-export-to-ms-and-open (&optional a s v b e)
1022 | "Export to ms and open."
1023 | (interactive) (org-pandoc-export 'ms a s v b e 0))
1024 |
1025 | ;;;###autoload
1026 | (defun org-pandoc-export-as-ms (&optional a s v b e)
1027 | "Export as ms."
1028 | (interactive) (org-pandoc-export 'ms a s v b e t))
1029 |
1030 | (defcustom org-pandoc-options-for-ms-pdf nil
1031 | "Pandoc options for ms-pdf."
1032 | :group 'org-pandoc
1033 | :type org-pandoc-option-type)
1034 |
1035 | ;;;###autoload
1036 | (defun org-pandoc-export-to-ms-pdf (&optional a s v b e)
1037 | "Export to ms-pdf."
1038 | (interactive) (org-pandoc-export 'ms-pdf a s v b e))
1039 |
1040 | ;;;###autoload
1041 | (defun org-pandoc-export-to-ms-pdf-and-open (&optional a s v b e)
1042 | "Export to ms-pdf and open."
1043 | (interactive) (org-pandoc-export 'ms-pdf a s v b e 0))
1044 |
1045 | (defcustom org-pandoc-options-for-muse nil
1046 | "Pandoc options for muse."
1047 | :group 'org-pandoc
1048 | :type org-pandoc-option-type)
1049 |
1050 | (defcustom org-pandoc-after-processing-muse-hook nil
1051 | "Hook called after processing muse."
1052 | :group 'org-pandoc
1053 | :type 'hook)
1054 |
1055 | ;;;###autoload
1056 | (defun org-pandoc-export-to-muse (&optional a s v b e)
1057 | "Export to muse."
1058 | (interactive) (org-pandoc-export 'muse a s v b e))
1059 |
1060 | ;;;###autoload
1061 | (defun org-pandoc-export-to-muse-and-open (&optional a s v b e)
1062 | "Export to muse and open."
1063 | (interactive) (org-pandoc-export 'muse a s v b e 0))
1064 |
1065 | ;;;###autoload
1066 | (defun org-pandoc-export-as-muse (&optional a s v b e)
1067 | "Export as muse."
1068 | (interactive) (org-pandoc-export 'muse a s v b e t))
1069 |
1070 | (defcustom org-pandoc-options-for-native nil
1071 | "Pandoc options for native."
1072 | :group 'org-pandoc
1073 | :type org-pandoc-option-type)
1074 |
1075 | (defcustom org-pandoc-after-processing-native-hook nil
1076 | "Hook called after processing native."
1077 | :group 'org-pandoc
1078 | :type 'hook)
1079 |
1080 | ;;;###autoload
1081 | (defun org-pandoc-export-to-native (&optional a s v b e)
1082 | "Export to native."
1083 | (interactive) (org-pandoc-export 'native a s v b e))
1084 |
1085 | ;;;###autoload
1086 | (defun org-pandoc-export-to-native-and-open (&optional a s v b e)
1087 | "Export to native and open."
1088 | (interactive) (org-pandoc-export 'native a s v b e 0))
1089 |
1090 | ;;;###autoload
1091 | (defun org-pandoc-export-as-native (&optional a s v b e)
1092 | "Export as native."
1093 | (interactive) (org-pandoc-export 'native a s v b e t))
1094 |
1095 | (defcustom org-pandoc-options-for-odt nil
1096 | "Pandoc options for odt."
1097 | :group 'org-pandoc
1098 | :type org-pandoc-option-type)
1099 |
1100 | ;;;###autoload
1101 | (defun org-pandoc-export-to-odt (&optional a s v b e)
1102 | "Export to odt."
1103 | (interactive) (org-pandoc-export 'odt a s v b e))
1104 |
1105 | ;;;###autoload
1106 | (defun org-pandoc-export-to-odt-and-open (&optional a s v b e)
1107 | "Export to odt and open."
1108 | (interactive) (org-pandoc-export 'odt a s v b e 0))
1109 |
1110 | (defcustom org-pandoc-options-for-opendocument nil
1111 | "Pandoc options for opendocument."
1112 | :group 'org-pandoc
1113 | :type org-pandoc-option-type)
1114 |
1115 | (defcustom org-pandoc-after-processing-opendocument-hook nil
1116 | "Hook called after processing opendocument."
1117 | :group 'org-pandoc
1118 | :type 'hook)
1119 |
1120 | ;;;###autoload
1121 | (defun org-pandoc-export-to-opendocument (&optional a s v b e)
1122 | "Export to opendocument."
1123 | (interactive) (org-pandoc-export 'opendocument a s v b e))
1124 |
1125 | ;;;###autoload
1126 | (defun org-pandoc-export-to-opendocument-and-open (&optional a s v b e)
1127 | "Export to opendocument and open."
1128 | (interactive) (org-pandoc-export 'opendocument a s v b e 0))
1129 |
1130 | ;;;###autoload
1131 | (defun org-pandoc-export-as-opendocument (&optional a s v b e)
1132 | "Export as opendocument."
1133 | (interactive) (org-pandoc-export 'opendocument a s v b e t))
1134 |
1135 | (defcustom org-pandoc-options-for-opml nil
1136 | "Pandoc options for opml."
1137 | :group 'org-pandoc
1138 | :type org-pandoc-option-type)
1139 |
1140 | (defcustom org-pandoc-after-processing-opml-hook nil
1141 | "Hook called after processing opml."
1142 | :group 'org-pandoc
1143 | :type 'hook)
1144 |
1145 | ;;;###autoload
1146 | (defun org-pandoc-export-to-opml (&optional a s v b e)
1147 | "Export to opml."
1148 | (interactive) (org-pandoc-export 'opml a s v b e))
1149 |
1150 | ;;;###autoload
1151 | (defun org-pandoc-export-to-opml-and-open (&optional a s v b e)
1152 | "Export to opml and open."
1153 | (interactive) (org-pandoc-export 'opml a s v b e 0))
1154 |
1155 | ;;;###autoload
1156 | (defun org-pandoc-export-as-opml (&optional a s v b e)
1157 | "Export as opml."
1158 | (interactive) (org-pandoc-export 'opml a s v b e t))
1159 |
1160 | (defcustom org-pandoc-options-for-org nil
1161 | "Pandoc options for org."
1162 | :group 'org-pandoc
1163 | :type org-pandoc-option-type)
1164 |
1165 | (defcustom org-pandoc-after-processing-org-hook nil
1166 | "Hook called after processing org."
1167 | :group 'org-pandoc
1168 | :type 'hook)
1169 |
1170 | ;;;###autoload
1171 | (defun org-pandoc-export-to-org (&optional a s v b e)
1172 | "Export to org."
1173 | (interactive) (org-pandoc-export 'org a s v b e))
1174 |
1175 | ;;;###autoload
1176 | (defun org-pandoc-export-to-org-and-open (&optional a s v b e)
1177 | "Export to org and open."
1178 | (interactive) (org-pandoc-export 'org a s v b e 0))
1179 |
1180 | ;;;###autoload
1181 | (defun org-pandoc-export-as-org (&optional a s v b e)
1182 | "Export as org."
1183 | (interactive) (org-pandoc-export 'org a s v b e t))
1184 |
1185 | (defcustom org-pandoc-options-for-plain nil
1186 | "Pandoc options for plain."
1187 | :group 'org-pandoc
1188 | :type org-pandoc-option-type)
1189 |
1190 | (defcustom org-pandoc-after-processing-plain-hook nil
1191 | "Hook called after processing plain."
1192 | :group 'org-pandoc
1193 | :type 'hook)
1194 |
1195 | ;;;###autoload
1196 | (defun org-pandoc-export-to-plain (&optional a s v b e)
1197 | "Export to plain."
1198 | (interactive) (org-pandoc-export 'plain a s v b e))
1199 |
1200 | ;;;###autoload
1201 | (defun org-pandoc-export-to-plain-and-open (&optional a s v b e)
1202 | "Export to plain and open."
1203 | (interactive) (org-pandoc-export 'plain a s v b e 0))
1204 |
1205 | ;;;###autoload
1206 | (defun org-pandoc-export-as-plain (&optional a s v b e)
1207 | "Export as plain."
1208 | (interactive) (org-pandoc-export 'plain a s v b e t))
1209 |
1210 | (defcustom org-pandoc-options-for-pptx nil
1211 | "Pandoc options for pptx."
1212 | :group 'org-pandoc
1213 | :type org-pandoc-option-type)
1214 |
1215 | ;;;###autoload
1216 | (defun org-pandoc-export-to-pptx (&optional a s v b e)
1217 | "Export to pptx."
1218 | (interactive) (org-pandoc-export 'pptx a s v b e))
1219 |
1220 | ;;;###autoload
1221 | (defun org-pandoc-export-to-pptx-and-open (&optional a s v b e)
1222 | "Export to pptx and open."
1223 | (interactive) (org-pandoc-export 'pptx a s v b e 0))
1224 |
1225 | (defcustom org-pandoc-options-for-revealjs nil
1226 | "Pandoc options for revealjs."
1227 | :group 'org-pandoc
1228 | :type org-pandoc-option-type)
1229 |
1230 | (defcustom org-pandoc-after-processing-revealjs-hook nil
1231 | "Hook called after processing revealjs."
1232 | :group 'org-pandoc
1233 | :type 'hook)
1234 |
1235 | ;;;###autoload
1236 | (defun org-pandoc-export-to-revealjs (&optional a s v b e)
1237 | "Export to revealjs."
1238 | (interactive) (org-pandoc-export 'revealjs a s v b e))
1239 |
1240 | ;;;###autoload
1241 | (defun org-pandoc-export-to-revealjs-and-open (&optional a s v b e)
1242 | "Export to revealjs and open."
1243 | (interactive) (org-pandoc-export 'revealjs a s v b e 0))
1244 |
1245 | ;;;###autoload
1246 | (defun org-pandoc-export-as-revealjs (&optional a s v b e)
1247 | "Export as revealjs."
1248 | (interactive) (org-pandoc-export 'revealjs a s v b e t))
1249 |
1250 | (defcustom org-pandoc-options-for-rst nil
1251 | "Pandoc options for rst."
1252 | :group 'org-pandoc
1253 | :type org-pandoc-option-type)
1254 |
1255 | (defcustom org-pandoc-after-processing-rst-hook nil
1256 | "Hook called after processing rst."
1257 | :group 'org-pandoc
1258 | :type 'hook)
1259 |
1260 | ;;;###autoload
1261 | (defun org-pandoc-export-to-rst (&optional a s v b e)
1262 | "Export to rst."
1263 | (interactive) (org-pandoc-export 'rst a s v b e))
1264 |
1265 | ;;;###autoload
1266 | (defun org-pandoc-export-to-rst-and-open (&optional a s v b e)
1267 | "Export to rst and open."
1268 | (interactive) (org-pandoc-export 'rst a s v b e 0))
1269 |
1270 | ;;;###autoload
1271 | (defun org-pandoc-export-as-rst (&optional a s v b e)
1272 | "Export as rst."
1273 | (interactive) (org-pandoc-export 'rst a s v b e t))
1274 |
1275 | (defcustom org-pandoc-options-for-rtf nil
1276 | "Pandoc options for rtf."
1277 | :group 'org-pandoc
1278 | :type org-pandoc-option-type)
1279 |
1280 | (defcustom org-pandoc-after-processing-rtf-hook nil
1281 | "Hook called after processing rtf."
1282 | :group 'org-pandoc
1283 | :type 'hook)
1284 |
1285 | ;;;###autoload
1286 | (defun org-pandoc-export-to-rtf (&optional a s v b e)
1287 | "Export to rtf."
1288 | (interactive) (org-pandoc-export 'rtf a s v b e))
1289 |
1290 | ;;;###autoload
1291 | (defun org-pandoc-export-to-rtf-and-open (&optional a s v b e)
1292 | "Export to rtf and open."
1293 | (interactive) (org-pandoc-export 'rtf a s v b e 0))
1294 |
1295 | ;;;###autoload
1296 | (defun org-pandoc-export-as-rtf (&optional a s v b e)
1297 | "Export as rtf."
1298 | (interactive) (org-pandoc-export 'rtf a s v b e t))
1299 |
1300 | (defcustom org-pandoc-options-for-s5 nil
1301 | "Pandoc options for s5."
1302 | :group 'org-pandoc
1303 | :type org-pandoc-option-type)
1304 |
1305 | (defcustom org-pandoc-after-processing-s5-hook nil
1306 | "Hook called after processing s5."
1307 | :group 'org-pandoc
1308 | :type 'hook)
1309 |
1310 | ;;;###autoload
1311 | (defun org-pandoc-export-to-s5 (&optional a s v b e)
1312 | "Export to s5."
1313 | (interactive) (org-pandoc-export 's5 a s v b e))
1314 |
1315 | ;;;###autoload
1316 | (defun org-pandoc-export-to-s5-and-open (&optional a s v b e)
1317 | "Export to s5 and open."
1318 | (interactive) (org-pandoc-export 's5 a s v b e 0))
1319 |
1320 | ;;;###autoload
1321 | (defun org-pandoc-export-as-s5 (&optional a s v b e)
1322 | "Export as s5."
1323 | (interactive) (org-pandoc-export 's5 a s v b e t))
1324 |
1325 | (defcustom org-pandoc-options-for-slideous nil
1326 | "Pandoc options for slideous."
1327 | :group 'org-pandoc
1328 | :type org-pandoc-option-type)
1329 |
1330 | (defcustom org-pandoc-after-processing-slideous-hook nil
1331 | "Hook called after processing slideous."
1332 | :group 'org-pandoc
1333 | :type 'hook)
1334 |
1335 | ;;;###autoload
1336 | (defun org-pandoc-export-to-slideous (&optional a s v b e)
1337 | "Export to slideous."
1338 | (interactive) (org-pandoc-export 'slideous a s v b e))
1339 |
1340 | ;;;###autoload
1341 | (defun org-pandoc-export-to-slideous-and-open (&optional a s v b e)
1342 | "Export to slideous and open."
1343 | (interactive) (org-pandoc-export 'slideous a s v b e 0))
1344 |
1345 | ;;;###autoload
1346 | (defun org-pandoc-export-as-slideous (&optional a s v b e)
1347 | "Export as slideous."
1348 | (interactive) (org-pandoc-export 'slideous a s v b e t))
1349 |
1350 | (defcustom org-pandoc-options-for-slidy nil
1351 | "Pandoc options for slidy."
1352 | :group 'org-pandoc
1353 | :type org-pandoc-option-type)
1354 |
1355 | (defcustom org-pandoc-after-processing-slidy-hook nil
1356 | "Hook called after processing slidy."
1357 | :group 'org-pandoc
1358 | :type 'hook)
1359 |
1360 | ;;;###autoload
1361 | (defun org-pandoc-export-to-slidy (&optional a s v b e)
1362 | "Export to slidy."
1363 | (interactive) (org-pandoc-export 'slidy a s v b e))
1364 |
1365 | ;;;###autoload
1366 | (defun org-pandoc-export-to-slidy-and-open (&optional a s v b e)
1367 | "Export to slidy and open."
1368 | (interactive) (org-pandoc-export 'slidy a s v b e 0))
1369 |
1370 | ;;;###autoload
1371 | (defun org-pandoc-export-as-slidy (&optional a s v b e)
1372 | "Export as slidy."
1373 | (interactive) (org-pandoc-export 'slidy a s v b e t))
1374 |
1375 | (defcustom org-pandoc-options-for-tei nil
1376 | "Pandoc options for tei."
1377 | :group 'org-pandoc
1378 | :type org-pandoc-option-type)
1379 |
1380 | (defcustom org-pandoc-after-processing-tei-hook nil
1381 | "Hook called after processing tei."
1382 | :group 'org-pandoc
1383 | :type 'hook)
1384 |
1385 | ;;;###autoload
1386 | (defun org-pandoc-export-to-tei (&optional a s v b e)
1387 | "Export to tei."
1388 | (interactive) (org-pandoc-export 'tei a s v b e))
1389 |
1390 | ;;;###autoload
1391 | (defun org-pandoc-export-to-tei-and-open (&optional a s v b e)
1392 | "Export to tei and open."
1393 | (interactive) (org-pandoc-export 'tei a s v b e 0))
1394 |
1395 | ;;;###autoload
1396 | (defun org-pandoc-export-as-tei (&optional a s v b e)
1397 | "Export as tei."
1398 | (interactive) (org-pandoc-export 'tei a s v b e t))
1399 |
1400 | (defcustom org-pandoc-options-for-texinfo nil
1401 | "Pandoc options for texinfo."
1402 | :group 'org-pandoc
1403 | :type org-pandoc-option-type)
1404 |
1405 | (defcustom org-pandoc-after-processing-texinfo-hook nil
1406 | "Hook called after processing texinfo."
1407 | :group 'org-pandoc
1408 | :type 'hook)
1409 |
1410 | ;;;###autoload
1411 | (defun org-pandoc-export-to-texinfo (&optional a s v b e)
1412 | "Export to texinfo."
1413 | (interactive) (org-pandoc-export 'texinfo a s v b e))
1414 |
1415 | ;;;###autoload
1416 | (defun org-pandoc-export-to-texinfo-and-open (&optional a s v b e)
1417 | "Export to texinfo and open."
1418 | (interactive) (org-pandoc-export 'texinfo a s v b e 0))
1419 |
1420 | ;;;###autoload
1421 | (defun org-pandoc-export-as-texinfo (&optional a s v b e)
1422 | "Export as texinfo."
1423 | (interactive) (org-pandoc-export 'texinfo a s v b e t))
1424 |
1425 | (defcustom org-pandoc-options-for-textile nil
1426 | "Pandoc options for textile."
1427 | :group 'org-pandoc
1428 | :type org-pandoc-option-type)
1429 |
1430 | (defcustom org-pandoc-after-processing-textile-hook nil
1431 | "Hook called after processing textile."
1432 | :group 'org-pandoc
1433 | :type 'hook)
1434 |
1435 | ;;;###autoload
1436 | (defun org-pandoc-export-to-textile (&optional a s v b e)
1437 | "Export to textile."
1438 | (interactive) (org-pandoc-export 'textile a s v b e))
1439 |
1440 | ;;;###autoload
1441 | (defun org-pandoc-export-to-textile-and-open (&optional a s v b e)
1442 | "Export to textile and open."
1443 | (interactive) (org-pandoc-export 'textile a s v b e 0))
1444 |
1445 | ;;;###autoload
1446 | (defun org-pandoc-export-as-textile (&optional a s v b e)
1447 | "Export as textile."
1448 | (interactive) (org-pandoc-export 'textile a s v b e t))
1449 |
1450 | (defcustom org-pandoc-after-processing-typst-hook nil
1451 | "Hook called after processing typst."
1452 | :group 'org-pandoc
1453 | :type 'hook)
1454 |
1455 | (defcustom org-pandoc-options-for-typst nil
1456 | "Pandoc options for typst."
1457 | :group 'org-pandoc
1458 | :type org-pandoc-option-type)
1459 |
1460 | (defcustom org-pandoc-options-for-typst-pdf nil
1461 | "Pandoc options for typst-pdf."
1462 | :group 'org-pandoc
1463 | :type org-pandoc-option-type)
1464 |
1465 | ;;;###autoload
1466 | (defun org-pandoc-export-to-typst (&optional a s v b e)
1467 | "Export to typst."
1468 | (interactive) (org-pandoc-export 'typst a s v b e))
1469 |
1470 | ;;;###autoload
1471 | (defun org-pandoc-export-to-typst-and-open (&optional a s v b e)
1472 | "Export to typst and open."
1473 | (interactive) (org-pandoc-export 'typst a s v b e 0))
1474 |
1475 | ;;;###autoload
1476 | (defun org-pandoc-export-as-typst (&optional a s v b e)
1477 | "Export as typst."
1478 | (interactive) (org-pandoc-export 'typst a s v b e t))
1479 |
1480 | ;;;###autoload
1481 | (defun org-pandoc-export-to-typst-pdf (&optional a s v b e)
1482 | "Export to typst-pdf."
1483 | (interactive) (org-pandoc-export 'typst-pdf a s v b e))
1484 |
1485 | ;;;###autoload
1486 | (defun org-pandoc-export-to-typst-pdf-and-open (&optional a s v b e)
1487 | "Export to typst-pdf and open."
1488 | (interactive) (org-pandoc-export 'typst-pdf a s v b e 0))
1489 |
1490 | (defcustom org-pandoc-options-for-zimwiki nil
1491 | "Pandoc options for zimwiki."
1492 | :group 'org-pandoc
1493 | :type org-pandoc-option-type)
1494 |
1495 | (defcustom org-pandoc-after-processing-zimwiki-hook nil
1496 | "Hook called after processing zimwiki."
1497 | :group 'org-pandoc
1498 | :type 'hook)
1499 |
1500 | ;;;###autoload
1501 | (defun org-pandoc-export-to-zimwiki (&optional a s v b e)
1502 | "Export to zimwiki."
1503 | (interactive) (org-pandoc-export 'zimwiki a s v b e))
1504 |
1505 | ;;;###autoload
1506 | (defun org-pandoc-export-to-zimwiki-and-open (&optional a s v b e)
1507 | "Export to zimwiki and open."
1508 | (interactive) (org-pandoc-export 'zimwiki a s v b e 0))
1509 |
1510 | ;;;###autoload
1511 | (defun org-pandoc-export-as-zimwiki (&optional a s v b e)
1512 | "Export as zimwiki."
1513 | (interactive) (org-pandoc-export 'zimwiki a s v b e t))
1514 |
1515 |
1516 | ;;; ox-pandoc main routine
1517 |
1518 | (defvar org-pandoc-format nil)
1519 | (defvar org-pandoc-option-table nil)
1520 | (defvar org-pandoc-format-extensions-str nil)
1521 | (defvar org-pandoc-epub-meta nil)
1522 | (defvar org-pandoc-epub-css nil)
1523 |
1524 | (defun org-pandoc-export (format _a s v b e &optional buf-or-open)
1525 | "General interface for Pandoc Export.
1526 | If BUF-OR-OPEN is nil, output to file. 0, then open the file.
1527 | t means output to buffer.
1528 | FORMAT is an output format supported by Pandoc or FORMAT-pdf, to
1529 | further export to pdf, after converting to FORMAT."
1530 | (unless (derived-mode-p 'org-mode)
1531 | (error "This command must be run on an org-mode buffer"))
1532 | (unless (executable-find org-pandoc-command)
1533 | (error "Pandoc (version 1.12.4 or later) can not be found"))
1534 | (setq org-pandoc-format format)
1535 | (let ((org-element-keyword-translation-alist org-pandoc-element-keyword-translation-alist))
1536 | (org-export-to-file 'pandoc (org-export-output-file-name
1537 | (concat (make-temp-name ".tmp") ".org") s)
1538 | nil ;; Org mode's native async processing is explicitly disabled because we arrange pandoc running asynchronously all the time.
1539 | s v b e (lambda (f) (org-pandoc-run-to-buffer-or-file f format s buf-or-open)))))
1540 |
1541 | (defun org-pandoc--has-caption-p (element _info)
1542 | "Non-nil when ELEMENT has a caption affiliated keyword.
1543 | INFO is a plist used as a communication channel. This function
1544 | is meant to be used as a predicate for `org-export-get-ordinal'."
1545 | (org-element-property :caption element))
1546 |
1547 |
1548 | (defun org-pandoc--numbered-equation-p (element _info)
1549 | "Non-nil when ELEMENT is a numbered latex equation environment.
1550 | INFO is a plist used as a communication channel. This function
1551 | is meant to be used as a predicate for `org-export-get-ordinal'."
1552 | (let ((raw-value (org-element-property :value element))
1553 | (case-fold-search t))
1554 | (string-match-p
1555 | (rx "\\begin{"
1556 | (group-n 1 (or "align" "alignat" "eqnarray" "equation"
1557 | "flalign" "gather" "multline"))
1558 | "}" (*? anything)
1559 | "\\end{" (backref 1) "}" )
1560 | raw-value)))
1561 |
1562 | (defun org-pandoc-entity (entity _contents _info)
1563 | "Transcode an ENTITY object for export with pandoc.
1564 | Support org's default entities ('org-entities') and user-defined
1565 | ones ('org-entities-user'). If the final format which pandoc will
1566 | produce is a TeX-based format, use the LaTeX representation.For
1567 | all other formats, output the UTF-8 symbol and let pandoc
1568 | handle its representation in the final format.
1569 | CONTENTS are the definition itself. INFO is a plist holding
1570 | contextual information."
1571 | (if (member org-pandoc-format '(beamer beamer-pdf latex latex-pdf))
1572 | (org-element-property :latex entity)
1573 | (org-element-property :utf-8 entity)))
1574 |
1575 | (defun org-pandoc-latex-environ (latex-env contents info)
1576 | "Transcode a latex environment for export with pandoc.
1577 | Works around a bug in
1578 | pandoc (https://github.com/jgm/pandoc/issues/1764, present in at
1579 | least up-to and including pandoc 1.18) to surround an AMSMath
1580 | latex environment in BLOB with plain TeX equation block
1581 | delimiters, '$$ .. $$' in order for pandoc to properly recognise
1582 | the maths environment as a latex equation. Also adds surrounding
1583 | line-breaks so that pandoc treats the math environment as its own
1584 | paragraph. This avoids having text before or after the math
1585 | environment ending up on the same line as the equation.
1586 | Additionally, adds a fake equation number if the environment
1587 | should have one. CONTENTS is its contents, as a string or nil.
1588 | INFO is a plist holding contextual information."
1589 | (let ((raw-value (org-export-expand latex-env contents t))
1590 | (case-fold-search t)
1591 | (replacement-str "\n$$\\1$$")
1592 | (output nil))
1593 | ;; If we're exporting to a TeX-based format, there's no need for
1594 | ;; this hack
1595 | (if (member org-pandoc-format '(beamer beamer-pdf latex latex-pdf))
1596 | raw-value
1597 | ;; Otherwise, add '$$' elements before and after the block to get
1598 | ;; pandoc to process it.
1599 | ;;
1600 | ;; For numbered equation environments, we need to fake the
1601 | ;; equation numbering before sending it to pandoc. Fake equation
1602 | ;; numbers are typeset as "(%d)", offset from the main equation by
1603 | ;; a "\qquad" space, ala pandoc-crossref
1604 | ;; (https://github.com/lierdakil/pandoc-crossref)
1605 | (when (org-pandoc--numbered-equation-p latex-env info)
1606 | (setq replacement-str
1607 | (format "\n$$\\1$$")))
1608 |
1609 | ;; For equations with a named links target (`#+NAME:' block), add
1610 | ;; the target to the top of the equation
1611 | (let ((name (org-element-property :name latex-env)))
1612 | (when name
1613 | (setq replacement-str
1614 | (concat "\n<<" name ">>" replacement-str))))
1615 |
1616 | ;; Add '$$' elements before and after the block to get pandoc to
1617 | ;; process it.
1618 | (setq output
1619 | (replace-regexp-in-string
1620 | (rx (group-n 1 "\\begin{"
1621 | (group-n 2 (or "align" "alignat" "eqnarray"
1622 | "equation" "flalign" "gather"
1623 | "multline")
1624 | (zero-or-one "*" ))
1625 | "}" (*? anything)
1626 | "\\end{" (backref 2) "}" ))
1627 | replacement-str
1628 | raw-value))
1629 |
1630 | ;; If we've added the '$$' delimiters, then also set the
1631 | ;; :post-blank property to add a blank line after this current
1632 | ;; latex equation environment
1633 | (let ((post-blank (org-element-property :post-blank latex-env)))
1634 | (unless (or (>= post-blank 1) (string-equal raw-value output))
1635 | (org-element-put-property latex-env :post-blank 1)))
1636 |
1637 | ;; Return the latex equation with '$$' delimiters and possible
1638 | ;; (faked) equation numbering.
1639 | output)))
1640 |
1641 | (defun org-pandoc-link (link contents info)
1642 | "Transcode a LINK object.
1643 |
1644 | The registered formatter for the \\='pandoc backend is used. If
1645 | none exists, transcode using the registered formatter for the
1646 | \\='org export backend. For fuzzy (internal) links, resolve the
1647 | link destination in order to determine the appropriate reference
1648 | number of the target Table/Figure/Equation etc. CONTENTS is the
1649 | description of the link, as a string, or nil. INFO is a plist
1650 | holding contextual information."
1651 | (let ((type (org-element-property :type link)))
1652 | (cond
1653 | ;; Try exporting with a registered formatter for 'pandoc
1654 | ((org-export-custom-protocol-maybe link contents 'pandoc))
1655 | ;; Try exporting with a registered formatter for 'org
1656 | ((org-export-custom-protocol-maybe link contents 'org))
1657 |
1658 | ;; Otherwise, override fuzzy (internal) links that point to
1659 | ;; numbered items such as Tables, Figures, Sections, etc.
1660 | ((string= type "fuzzy")
1661 | (let* ((path (org-element-property :path link))
1662 | (destination (org-export-resolve-fuzzy-link link info))
1663 | (dest-type (when destination (org-element-type destination)))
1664 | (number nil))
1665 | ;; Different link targets require different predicates to the
1666 | ;; `org-export-get-ordinal' function in order to resolve to
1667 | ;; the correct number. NOTE: Should be the same predicate
1668 | ;; function as used to generate the number in the
1669 | ;; caption/label/listing etc.
1670 | (cond
1671 | ((eq dest-type 'paragraph) ; possible figure
1672 | (setq number (org-export-get-ordinal
1673 | destination info nil #'org-html-standalone-image-p)))
1674 |
1675 | ((eq dest-type 'latex-environment) ; Latex block, equation or similar
1676 | (setq number (org-export-get-ordinal
1677 | destination info nil #'org-pandoc--numbered-equation-p)))
1678 |
1679 | ((string-prefix-p "citeproc_bib_item" path) ; Rendered citation footnote number
1680 | ) ;; leave it alone, it should already be correct
1681 |
1682 | (t ; captioned items
1683 | (setq number (org-export-get-ordinal
1684 | destination info nil #'org-pandoc--has-caption-p))))
1685 |
1686 | ;; Numbered items have the number listed in the link
1687 | ;; description, , fall back on the text in `contents'
1688 | ;; if there's no resolvable destination
1689 | (cond
1690 | ;; Numbered items have the number listed in the link description
1691 | (number
1692 | (format "[[#%s][%s]]" path
1693 | (if (atom number) (number-to-string number)
1694 | (mapconcat #'number-to-string number "."))))
1695 |
1696 | ;; Unnumbered headlines have the heading name in the link
1697 | ;; description
1698 | ((eq dest-type 'headline)
1699 | (format "[[#%s][%s]]" path
1700 | (org-export-data
1701 | (org-element-property :title destination) info)))
1702 |
1703 | ;; No resolvable destination, fallback on the text in `contents'
1704 | ((eq destination nil)
1705 | (when (org-string-nw-p contents) contents))
1706 |
1707 | ;; Valid destination, but without a numbered caption/equation
1708 | ;; and not a heading, fallback to standard org-mode link format
1709 | (t
1710 | (org-element-link-interpreter link contents)))))
1711 |
1712 | ;; Otherwise, fallback to standard org-mode link format
1713 | ((org-element-link-interpreter link contents)))))
1714 |
1715 | (defun org-pandoc-table (table contents _info)
1716 | "Transcode a TABLE element from Org to Pandoc.
1717 | CONTENTS is the contents of the table. INFO is a plist holding
1718 | contextual information."
1719 | ;; Export the table
1720 | (org-export-expand table contents t))
1721 |
1722 | (defun org-pandoc-template (contents info)
1723 | "Template processor for CONTENTS and INFO.
1724 | Option table is created in this stage."
1725 | (setq org-pandoc-option-table (make-hash-table))
1726 | ;; default options
1727 | (org-pandoc-put-options org-pandoc-options)
1728 | (org-pandoc-put-options
1729 | (symbol-value (intern (format "org-pandoc-options-for-%s" org-pandoc-format))))
1730 | ;; file options
1731 | (-when-let (pandoc-options (plist-get info :pandoc-options))
1732 | (org-pandoc-put-options
1733 | (--map (let* ((_match (string-match "^\\([^:]+\\):\\(.+\\)$" it))
1734 | (name (intern (match-string 1 it)))
1735 | (value (match-string 2 it)))
1736 | (cons name value))
1737 | (split-string-and-unquote pandoc-options))))
1738 | (setq org-pandoc-format-extensions-str
1739 | (mapcar 'symbol-name org-pandoc-format-extensions))
1740 | (-when-let (pandoc-extensions (plist-get info :pandoc-extensions))
1741 | (dolist (extension (split-string pandoc-extensions))
1742 | (push extension org-pandoc-format-extensions-str)))
1743 | (setq org-pandoc-epub-css (plist-get info :epub-css))
1744 | (setq org-pandoc-epub-meta
1745 | (or (plist-get info :epub-meta)
1746 | (concat
1747 | (-when-let (epub-rights (or (plist-get info :epub-rights)
1748 | org-pandoc-epub-rights))
1749 | (concat "" (url-insert-entities-in-string
1750 | epub-rights) "\n"))
1751 | (-when-let (description (plist-get info :description))
1752 | (concat "" description "\n"))
1753 | (-when-let (keywords (plist-get info :keywords))
1754 | (concat "" keywords "\n")))))
1755 | (org-pandoc-put-options
1756 | (--mapcat (-when-let (val (plist-get info (cdr it)))
1757 | (list (cons (car it) (split-string-and-unquote val))))
1758 | '((metadata . :pandoc-metadata)
1759 | (variable . :pandoc-variables))))
1760 | (let ((org-pandoc-valid-options
1761 | '((epub-embed-font . :epub-embed-font)
1762 | (epub-chapter-level . :epub-chapter-level)
1763 | (epub-cover-image . :epub-cover-image)
1764 | (epub-stylesheet . :epub-stylesheet)
1765 | ;;(bibliography . :bibliography)
1766 | )))
1767 | ;; Bibliography option only for org < 9.5
1768 | (unless (featurep 'oc)
1769 | (setcar org-pandoc-valid-options '(bibliography . :bibliography) ))
1770 | (org-pandoc-put-options
1771 | (--mapcat (-when-let (val (plist-get info (cdr it)))
1772 | (list (cons (car it) (split-string val "\n"))))
1773 | org-pandoc-valid-options)))
1774 | ;; 'ox-pandoc' is derived from 'ox-org'. If 'ox-org' defines its own
1775 | ;; template, then this template function (org-pandoc-template) calls
1776 | ;; original ox-org template at the end.
1777 | (let ((org-template
1778 | (cdr (assoc 'template
1779 | (org-export-get-all-transcoders 'org)))))
1780 | (if org-template
1781 | (funcall org-template contents info)
1782 | contents)))
1783 |
1784 | (defun org-pandoc-paragraph (paragraph contents _info)
1785 | "Transcode a PARAGRAPH element from Org to Pandoc.
1786 | CONTENTS is the contents of the paragraph, as a string. INFO is
1787 | the plist used as a communication channel."
1788 | ;; Export the paragraph verbatim. Like `org-org-identity', but also
1789 | ;; preserves #+ATTR_* tags in the output.
1790 | (org-export-expand paragraph contents t))
1791 |
1792 | (defun org-pandoc-src-block (src-block contents _info)
1793 | "Transcode a SRC-BLOCK element from Org to Pandoc.
1794 | CONTENTS is the contents of the table. INFO is a plist holding
1795 | contextual information."
1796 | ;; Export the src-block
1797 | (org-export-expand src-block contents t))
1798 |
1799 | (defun org-pandoc-export-block (export-block contents info)
1800 | "Transcode a EXPORT-BLOCK element from Org to Pandoc.
1801 | This might be EXPORT_HTML or EXPORT_LATEX, and is simply
1802 | duplicated into the temporary org file that pandoc converts.
1803 | Special: if the block is BEGIN_EXPORT pandoc, pass the value to
1804 | pandoc. CONTENTS is the contents of the block. INFO is a plist
1805 | holding contextual information."
1806 | (if (string= (org-element-property :type export-block) "PANDOC")
1807 | (org-element-property :value export-block)
1808 | (org-pandoc-identity export-block contents info)))
1809 |
1810 | (defun org-pandoc-export-snippet (export-snippet contents info)
1811 | "Transcode a @@format:snippet@@ from Org to Pandoc.
1812 |
1813 | If it is an output format, such as latex or html, the snippet is
1814 | duplicated in full for pandoc to handle as Org's own exporters
1815 | would. If the snippet specifies `pandoc' as the format, the inner
1816 | content of the snippet is passed to pandoc. CONTENTS is the
1817 | contents of the block. INFO is a plist holding contextual
1818 | information."
1819 | (if (eq (org-export-snippet-backend export-snippet) 'pandoc)
1820 | (org-element-property :value export-snippet)
1821 | (org-pandoc-identity export-snippet contents info)))
1822 |
1823 | (defun org-pandoc-identity (blob contents _info)
1824 | "Transcode BLOB element or object back into Org syntax.
1825 | CONTENTS is its contents, as a string or nil. INFO is ignored.
1826 | Like `org-org-identity', but also preserves #+ATTR_* tags in the
1827 | output."
1828 | (org-export-expand blob contents t))
1829 |
1830 | (defun org-pandoc-put-options (options)
1831 | "Put alist OPTIONS to `org-pandoc-option-table'."
1832 | (dolist (option options)
1833 | (let* ((name (car option))
1834 | (value (cdr option))
1835 | (values
1836 | (cond ((not (memq name org-pandoc-valid-options))
1837 | (error "Org-Pandoc: Improper Option Name! %s" name))
1838 | ((equal "t" value) t)
1839 | ((equal "nil" value) nil)
1840 | ((listp value) value)
1841 | ((memq name org-pandoc-colon-separated-options)
1842 | (split-string value ":"))
1843 | (t (list value)))))
1844 | (if (memq name org-pandoc-file-options)
1845 | (setq values
1846 | (--map (if (file-exists-p it)
1847 | (if (= ?~ (string-to-char it)) (expand-file-name it) it)
1848 | (error "File (%s) can not be found" it)) values)))
1849 | (puthash name values org-pandoc-option-table))))
1850 |
1851 | (defun org-pandoc-run-to-buffer-or-file
1852 | (input-file format subtreep &optional buffer-or-open)
1853 | "Run pandoc to convert on org INPUT-FILE or buffer to FORMAT with SUBTREEP.
1854 |
1855 | If BUFFER-OR-OPEN is t then target is current buffer. If nil, target is file.
1856 | If 0, target is file and converted file will automatically be opend."
1857 | (let* ((pdf-p (string-match "-pdf$" (symbol-name format)))
1858 | (output-file
1859 | (unless (equal t buffer-or-open)
1860 | (org-export-output-file-name
1861 | (concat "."
1862 | (if pdf-p "pdf"
1863 | (symbol-name
1864 | (or (assoc-default format org-pandoc-extensions)
1865 | format))))
1866 | subtreep)))
1867 | (local-hook-symbol (intern (format "org-pandoc-after-processing-%s-hook"
1868 | format)))
1869 | css-temp-file meta-temp-file)
1870 | ;; convert format "XXX-pdf" to "XXX"
1871 | (when pdf-p (setq format (intern (substring (symbol-name format) 0 -4))))
1872 | ;; special treatment for epub2/epub3
1873 | (when (or (equal org-pandoc-format 'epub2)
1874 | (equal org-pandoc-format 'epub3))
1875 | (when org-pandoc-epub-css
1876 | (setq css-temp-file (make-temp-file "org-pandoc" nil ".css"))
1877 | (puthash 'epub-stylesheet
1878 | (append (gethash 'epub-stylesheet org-pandoc-option-table)
1879 | (list css-temp-file))
1880 | org-pandoc-option-table)
1881 | (with-temp-file css-temp-file
1882 | (insert org-pandoc-epub-css)))
1883 | (when org-pandoc-epub-meta
1884 | (setq meta-temp-file (make-temp-file "org-pandoc" nil ".xml"))
1885 | (org-pandoc-put-options `((epub-metadata ,meta-temp-file)))
1886 | (with-temp-file meta-temp-file
1887 | (insert org-pandoc-epub-meta))))
1888 | (let ((process
1889 | (org-pandoc-run input-file output-file format
1890 | 'org-pandoc-sentinel org-pandoc-option-table)))
1891 | (process-put process 'files (list input-file meta-temp-file css-temp-file))
1892 | (process-put process 'output-file output-file)
1893 | (process-put process 'local-hook-symbol local-hook-symbol)
1894 | (process-put process 'buffer-or-open buffer-or-open))))
1895 |
1896 | (defun org-pandoc-sentinel (process message)
1897 | "PROCESS sentinel with MESSAGE.
1898 | Called on completion of an asynchronous pandoc process."
1899 | (cl-case (process-status process)
1900 | (run)
1901 | (signal
1902 | ;; Warning. Temporary files not removed (for now.)
1903 | (display-warning 'ox-pandoc (format "Signal Received. %s" message)))
1904 | (exit
1905 | (dolist (file (process-get process 'files))
1906 | (if (and file (file-exists-p file)) (delete-file file))
1907 | )
1908 | (let ((exit-status (process-exit-status process))
1909 | (buffer (process-buffer process))
1910 | (output-file (process-get process 'output-file))
1911 | (local-hook-symbol (process-get process 'local-hook-symbol))
1912 | (buffer-or-open (process-get process 'buffer-or-open)))
1913 | (if (/= exit-status 0)
1914 | (message "Error occured. \n%s"
1915 | (with-current-buffer buffer (buffer-string)))
1916 | (if output-file
1917 | (progn
1918 | (kill-buffer buffer)
1919 | (message "Exported to %s." output-file)
1920 | (if (and (boundp local-hook-symbol)
1921 | (symbol-value local-hook-symbol))
1922 | (with-temp-file output-file
1923 | (insert-file-contents output-file)
1924 | (run-hooks local-hook-symbol)))
1925 | (when (equal 0 buffer-or-open)
1926 | (org-open-file output-file)))
1927 | ;; output to buffer
1928 | (pop-to-buffer buffer)
1929 | (goto-char (point-min))
1930 | (run-hooks local-hook-symbol)
1931 | (set-auto-mode)))))))
1932 |
1933 | (defun org-pandoc-run (input-file output-file format sentinel &optional options)
1934 | "Run pandoc command with INPUT-FILE (org), OUTPUT-FILE, FORMAT and OPTIONS.
1935 | If BUFFER-OR-FILE is buffer, then output to specified buffer. OPTIONS is
1936 | a hashtable. Pandoc runs asynchronously and SENTINEL is called
1937 | when the process completes."
1938 | (let* ((format (symbol-name format))
1939 | (output-format
1940 | (car (--filter (string-prefix-p format it)
1941 | org-pandoc-format-extensions-str)))
1942 | (args
1943 | `("-f" "org"
1944 | "-t" ,(or output-format format)
1945 | ,@(and output-file
1946 | (list "-o" (expand-file-name output-file)))
1947 | ,@(-mapcat (lambda (key)
1948 | (-when-let (vals (gethash key options))
1949 | (if (equal vals t) (setq vals (list t)))
1950 | (--map (concat "--" (symbol-name key)
1951 | (when (not (equal it t)) (format "=%s" it)))
1952 | vals)))
1953 | (ht-keys options))
1954 | ,(expand-file-name input-file))))
1955 | (message "Running pandoc with args: %s" args)
1956 | (let ((process
1957 | (apply 'start-process
1958 | `("pandoc" ,(generate-new-buffer "*Pandoc*")
1959 | ,org-pandoc-command ,@args))))
1960 | (set-process-sentinel process sentinel)
1961 | process)))
1962 |
1963 | (defun org-pandoc-startup-check ()
1964 | "Check the current pandoc version."
1965 | (interactive)
1966 | (catch 'check-suppressed
1967 | (unless org-pandoc-check-version
1968 | (throw 'check-suppressed nil))
1969 | (if (not (executable-find org-pandoc-command))
1970 | (display-warning 'ox-pandoc "Pandoc command is not installed.")
1971 | (let ((version (with-temp-buffer
1972 | (call-process org-pandoc-command nil t nil "-v")
1973 | (buffer-string))))
1974 | (if (not (string-match "^pandoc.*? \\([0-9]+\\)\\.\\([0-9]+\\)" version))
1975 | (display-warning 'ox-pandoc "Pandoc version number can not be retrieved.")
1976 | (let ((major (string-to-number (match-string 1 version)))
1977 | (_minor (string-to-number (match-string 2 version))))
1978 | (unless (or (< 1 major)
1979 | ;;(and (= 1 major)
1980 | ;; (< 12 minor))
1981 | )
1982 | (display-warning 'ox-pandoc "This Pandoc (1.x) may not support new pandoc features."))))))))
1983 |
1984 | (org-pandoc-startup-check)
1985 |
1986 | (provide 'ox-pandoc)
1987 |
1988 | ;;; ox-pandoc.el ends here
1989 |
1990 | ;; Local Variables:
1991 | ;; time-stamp-pattern: "10/Version:\\\\?[ \t]+1.%02y%02m%02d\\\\?\n"
1992 | ;; End:
1993 |
--------------------------------------------------------------------------------