Git Product home page Git Product logo

ox-pandoc's Introduction

ox-pandoc

This is another exporter that translates Org-mode file to various other formats via Pandoc.

Description

You can convert Org-mode file to various formats with simple commands. Following table shows the supported fromats.

formatextensionbufferfile
asciidoctxtyesyes
beamertexyesyes
beamer-pdfpdfnoyes
commonmarkmdyesyes
contexttexyesyes
docbookxmlyesyes
docxnoyes
dzslideshtmlyesyes
epub2epubnoyes
epub3epubnoyes
fb2fb2yesyes
gfmmdyesyes
html4htmlyesyes
html5htmlyesyes
icmlyesyes
jsonyesyes
latextexyesyes
latex-pdfpdfnoyes
manyesyes
markdownmdyesyes
markdown_githubmdyesyes
markdown_mmdmdyesyes
markdown_phpextramdyesyes
markdown_strictmdyesyes
mediawikiyesyes
nativehsyesyes
odtnoyes
opendocumentxmlyesyes
opmlyesyes
orgyesyes
plaintxtyesyes
pptxnoyes
revealjshtmlyesyes
rstyesyes
rtfyesyes
s5htmlyesyes
slideoushtmlyesyes
slidyhtmlyesyes
texinfotexiyesyes
textileyesyes

Requirements

You need Emacs 24.2, org-mode 8.2, and Pandoc 2.0 (or later versions). Pandoc-Citeproc 0.3 (or later) may also be needed if you use bibliography features.

Note that Org-mode equipped with Emacs 24.3 is version 7.9 and can not be used with this tool. It is recommended to install Pandoc via Cabal, or the installer directly downloaded from official web sites, as other package managers (such as Anaconda) sometimes install old versions of Pandoc.

Installation

You can install this tool with MELPA. For example,

(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
        ("melpa" . "http://melpa.milkbox.net/packages/")))
M-x package-install ⏎
ox-pandoc ⏎

Usage

Running the Commands

For example, to convert org-mode file to ‘html5’ format, you may run the following commands.

org-pandoc-export-as-html5
Exports to the HTML5 text as a buffer.
org-pandoc-export-to-html5
Exports to the HTML5 text file.
org-pandoc-export-to-html5-and-open
Exports and open HTML5 file.

Similar commands are prepared for various formats.

Customizing User Option Variables

You can specify the default options for each document format and hooks.

org-pandoc-options
General Pandoc options.
org-pandoc-options-for-FORMAT
Format-specific options.
org-pandoc-after-processing-FORMAT-hook
Hook after processing FORMAT. This hook is only available to text-file FORMAT.
org-pandoc-epub-rights
EPUB Copyright Statement.

Options should be specified by an alist. List of valid options are defined in org-pandoc-valid-options. Only long-name options can be used. after-processing options can not be specified to epub, docx or pdf formats. For preprocessing hooks, use org-export-before-processing-hook.

Multiple values can be specified to options defined in org-pandoc-colon-separated-options. They should be defined in colon-separated list.

Values of options defined in org-pandoc-file-options will be expanded to full path if they begin with ~ (tilde) character.

You can also specify output format extension with org-pandoc-format-extensions variable.

For example:

;; default options for all output formats
(setq org-pandoc-options '((standalone . t)))
;; cancel above settings only for 'docx' format
(setq org-pandoc-options-for-docx '((standalone . nil)))
;; special settings for beamer-pdf and latex-pdf exporters
(setq org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))
(setq org-pandoc-options-for-latex-pdf '((pdf-engine . "pdflatex")))
;; special extensions for markdown_github output
(setq org-pandoc-format-extensions '(markdown_github+pipe_tables+raw_html))

Document-Specific Options

Following document-specific options can be specified. Value nil overrides preceding option setting. Value t means only specify option, but not its value. Options are delimited by space. #+PANDOC_OPTIONS: can be specified multiple times. If you want to specify the option value which include space character, quote entire option-value pair.

PANDOC_OPTIONS:
Add command line options to the Pandoc process.
PANDOC_METADATA:
Metadata for Pandoc.
PANDOC_EXTENSIONS:
Extensions for specific Pandoc output.
PANDOC_VARIABLES:
Variables for Pandoc.
EPUB_RIGHTS:
copyright info to be embedded to EPUB metadata.
EPUB_CHAPTER_LEVEL:
same as ‘epub-chapter-level’ pandoc-option.
EPUB_STYLESHEET:
same as ‘epub-stylesheet’ pandoc-option.
EPUB_COVER:
same as ‘epub-cover-image’ pandoc-option.
EPUB_FONT:
same as ‘epub-embed-font’ pandoc-option. Only one font can be specified in each line. Multiple fonts can be specified by repeatedly use this option.
EPUB_META:
put contents into a temporary file and specify that file to ‘epub-metadata’ option.
EPUB_CSS:
put contents into a temporary file and specify that file to ‘epub-stylesheet’ option.
BIBLIOGRAPHY:
same as ‘bibliography’ pandoc-option. Only one bibliography can be specified in each line. Multiple bibliographies can be specified by repeatedly use this option.

Following is an example:

# If you don't want author to be appeared, just leave it empty.
#+AUTHOR:
#+PANDOC_OPTIONS: standalone:t pdf-engine:pdflatex
## When option value includes whitespace, entire name:value pair must be quoted.
#+PANDOC_OPTIONS: "epub-cover-image:/home/a/test file.png" standalone:nil
#+PANDOC_OPTIONS: number-sections:nil
#+PANDOC_OPTIONS: template:mytemplate.tex
#+BIBLIOGRAPHY: sample.bib
# Specifying Multiple values to single options by using colon-sparated lists.
#+PANDOC_OPTIONS: filter:pandoc-zotxt:pandoc-citeproc
#+PANDOC_OPTIONS: csl:IEEE.csl
#+PANDOC_EXTENSIONS: markdown-typography latex+auto_identifiers
#+PANDOC_VARIABLES: documentclass:IEEEtran
#+PANDOC_VARIABLES: classoption:10pt,conference
#+PANDOC_METADATA: page-progression-direction:ltr
#+latex_header: \author{\IEEEauthorblockN{John Smith}
#+latex_header: \IEEEauthorblockA{FooBar Institute\\
#+latex_header: Email: [email protected]}

Customizing Shortcuts

As pandoc supports many number of formats, initial org-export-dispatch shortcut menu does not show full of its supported formats. You can customize org-pandoc-menu-entry variable (and probably restart Emacs) to change its default menu entries.

If you want delayed loading of `ox-pandoc’ when org-pandoc-menu-entry is customized, please consider the following settings in your init file.

(with-eval-after-load 'ox
  (require 'ox-pandoc))

VS.

org-pandoc

This file is inspired by org-pandoc, but entirely re-written. This tool prepares various export commands for all formats supported by pandoc.

Note

Temporary Files

This file creates and removes “XXXX.tmpZZZZ.org” and “XXXX.tmpZZZZ.css” (if necessary) temprary files in working directory. (ZZZZ is random string.)

Obsolete In-File Options

Following options are supported in previous version of ox-pandoc. They are no longer supported.

EPUB_METADATA:
obsolete. Use epub-metadata in PANDOC_OPTIONS: instead.
EPUB_STYLESHEET:
obsolete. Use epub-stylesheet in PANDOC_OPTIONS: instead.

Citation

Currently, Pandoc citation key is expressed as @key, rather than {\cite key} . You may need some text converter if you want to use Pandoc citation styles in org document.

License

GPLv2.

Author

ox-pandoc's People

Contributors

juergenhoetzel avatar kawabata avatar lurdan avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ox-pandoc's Issues

Definition of an abstract

What is the best way to define/write an abstract

#+PANDOC_METADATA: abstract:"This is my abstract"

The method above doesn't seem to work.

Need GPLv3+ compatible license.

This package is being removed from MELPA until it has a license compatible with GPLv3 and later. Sorry for the inconvenience. More information is below.

Assuming that you want to release under "the GPL v3 or any later version", the best way to do that would be to add this permission statement to the library header:

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also consider adding a LICENSE file containing the text of the GPL-3. You could add just that file without also adding the above persmission statement, but if you do that, then the "or (at your option) any later version" bit won't be known. So I recommend that you add both the actual license and the permission statement.

If you find the permission statement to be too noisy, then you could instead add one of these following lines to the header. If you do that, then it becomes more important to also add the LICENSE file - a judge might decide that such a line by itself is not sufficient. Still, adding just such a line is better than not specifing the license at all.

;; License: GNU General Public License version 3, or (at your option) any later version
;; License: GNU General Public License version 3, or any later version
;; License: GNU GPL version 3, or (at your option) any later version
;; License: GPL version 3, or (at your option) any later version
;; License: GPL version 3, or any later version
;; License: GPL v3, or (at your option) any later version
;; License: GPL v3, or any later version
;; License: GPL-3+

How to handle non-critical version mismatches?

If you install org-mode from the latest github commit (there was a recent bug that was pretty irritating in the package branch), ox-pandoc is confused:

Warning (emacs): Unable to activate package `ox-pandoc'.

Required package `org-8.2' is unavailable

How to work around this?

Symbol’s function definition is void: org-element-create

Environment:
GNU Emacs 25.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) of 2018-01-12
Org-mode version 9.1.13 (9.1.13-elpa @ /root/.emacs.d/elpa/org-20180730/)
pandoc 1.12.4.2

Stage:
IN org-file: M-x org-pandoc-export-to-markdown

ox-pandoc doesn't correctly render bibliographic references if used with pandoc-zotxt

Exporting a org-mode file to odt or html via ox-pandoc doesn't correctly render the bibliographic references inserted with pandoc-zotxt. In the org-mode file the filters are enabled by having "#+PANDOC_OPTIONS: filter:pandoc-zotxt" and "#+PANDOC_OPTIONS: filter:pandoc-citeproc" at the beginning of the file.

In the output file there are "(???)" in place of the references.

Exporting on the command line via pandoc works as expected with the command "pandoc -F pandoc-zotxt -F pandoc-citeproc my_fie.org -o my_file.odt"

Equations via preview fragments?

I need to generate a docx file from my org file, including all equations (not only the simple ones Word's equation editor can handle). I wonder if it is possible to somehow generate LaTeX fragments as PNGs using org's preview mechanism and insert them in the Word document?

Similarly, I would need to include TikZ-generated pictures, as well as some pdf-files.

The final publication will be through LaTeX, but I need a docx file for the language check.

The rest of the conversion (headers, text, etc.) works beautifully, thanks!

Symbol’s function definition is void: org-export-custom-protocol-maybe

I'm using org-mode version 9.0.5 from elpa and getting this error when trying to export via ox-pandoc:

Symbol’s function definition is void: org-export-custom-protocol-maybe

got past it by redefining org-pandoc-link to:

(defun org-pandoc-link (link contents _info)
  "Transcode LINK object using the registered formatter for the
'pandoc backend.  If none exists, transcode using the registered
formatter for the 'org export backend.  CONTENTS is the
description of the link, as a string, or nil.  INFO is ignored."
  (org-element-link-interpreter link contents))

basically removing the use of org-export-custom-protocol-maybe. No idea if that is the proper fix :)

Verbatim sections handle whitespace incorrectly in HTML.

Say I've created an Org file and set up my fill-column so a line wrap occurs like so.

=some monospace
text=

Org HTML export and command line Pandoc handle this correctly, typesetting the text normally in monospace. However, ox-pandoc wraps the line where it is wrapped in the source Org file.

Org Abstract Block Export

Is it possible to allow export of the abstract block, i.e.
#+BEGIN_ABSTRACT
as a pandoc_metadata 'abstract'? This would allow export of an abstract before the TOC in latex documents, which currently requires a long:
#+PANDOC_METADATA "abstract: very long line"

Internal links display as numbers even when set up with text.

* <<link-to-me>>Header 1
* Header 2
  See [[link-to-me][the header above]]

I would expect exporting result in the text "the header above" as a link. However, that text disappears and while a link appears that link is merely a number (happens in both PDF and HTML, haven't extensively tested the other export formats).

May be related to #32.

can't install on emacs in msys2

GNU Emacs 24.5.1 (x86_64-w64-mingw32) of 2015-09-02 on WARLOCK

try to install with "package-install ox-pandoc" cmd, get:

if: Package `emacs-24' is unavailable

Is there anything wrong with my emacs setup?

Src Block Output not captured in Org 9+?

This exporter is working flawlessly for me, with one exception: src block output isn't captured in the final output.

For instance, if I have this subtree in org:

* Export file + pandoc
:PROPERTIES:
:EXPORT_FILE_NAME: hoodleboo.md
:END:

This document -- which has several characters that... usually fail to typeset well -- should export nicely, I hope.

#+BEGIN_SRC sh :dir ~/ :exports both
ls -la | grep rc
#+END_SRC

#+RESULTS:
| lrwxr-xr-x | 1 | rossdonaldson | staff |   42 | Nov | 19 | 19:34 | .ackrc       | -> | /Users/rossdonaldson/.dotfiles/extra/ackrc  |
| -rw------- | 1 | rossdonaldson | staff |  127 | Oct | 17 | 14:16 | .arcrc       |    |                                           |
| lrwxr-xr-x | 1 | rossdonaldson | staff |   42 | Nov | 19 | 19:34 | .bashrc      | -> | /Users/rossdonaldson/.dotfiles/bash/bashrc  |
| drwxr-xr-x | 3 | rossdonaldson | staff |  102 | Oct | 18 | 09:04 | .erc         |    |                                           |
| -rw-r--r-- | 1 | rossdonaldson | staff |  187 | Dec | 20 | 16:18 | .floorc      |    |                                           |
| -rw-r--r-- | 1 | rossdonaldson | staff |  232 | Dec | 21 | 13:13 | .floorc.json |    |                                           |
| lrwxr-xr-x | 1 | rossdonaldson | staff |   43 | Nov | 19 | 19:34 | .inputrc     | -> | /Users/rossdonaldson/.dotfiles/bash/inputrc |
| -rw-r--r-- | 1 | rossdonaldson | staff | 4200 | Nov |  3 | 16:36 | .mbsyncrc    |    |                                           |

When I export to GFM, I get:

This document -- which has several characters that... usually fail to typeset well -- should export nicely, I hope.
ls -la | grep rc

And yet: in my *Messages*, I can see that src evaluation is happening:

org-babel-exp process sh at position 76418...
executing Sh code block...
Wrote /var/folders/6r/hqwhk3k96hvdw41vn_9r853c0000gn/T/babel-96382h2A/ob-input-96382gQv
Word wrapping enabled
Code block evaluation complete.

I've tried five or six different pandoc formats, all the with the same results; other, non-pandoc exporters don't seem to have this issue for me. Any suggestions?

Missing footnotes when exporting

Happy with ox-pandoc till I met this issue today.

Originally I wanted to export a .org file with footnotes to markdown, then I found no footnotes were exported. Did some tests and here're what I've observed:

  • Using pandoc command line directly to convert the same file produces correct results. Parameters used are the same as those in Emacs Messages when I run pandoc via ox-pandoc menu. Only difference is ox-pandoc seems to be using a tmp file instead of the original file as source.
  • Using org mode's built-in export can yield correct results too. Tested with pdf and html formats.
  • When exporting via ox-pandoc menu, footnotes are always missing, no matter what the target format is. I tried martdown and html.

Could this have anything to do with the tmp file?

ox-pandoc inserts file:

export via pandoc inserts "file:" whenever there is a link to a file. For example

file:images/tree.jpg

This creates problems in an import to pelican and results in broken links. If this phrase is left out, then there is no problem.

When I try pandoc from command line, it does not insert "file:". Would it be possible to remove this behavior from ox-pandoc.

org -> latex: LaTex blocks are not considered

Hello,

I am using this package, and it did such a good job so far, that I assumed the following issue belonged to pandoc (jgm/pandoc#2915):

it seems that org LaTex blocks are omitted from the input file when pandoc is called.
So for the org:

* Hello
#+BEGIN_LaTeX
hi I am LaTex
#+END_LaTeX

I get a LaTex file such as:

...
\begin{document}
\maketitle



\end{document}
...

That happens only for LaTex blocks, as far as I know.
It would be great if this was solved.
By the way, this issue is a regression (if this is an ox-pandoc bug): some time ago it worked.

Getting errors when running pandoc

I am getting this error when trying to export an org document through context.
I have the latest ConText and Pandoc installed along with ox-pandoc and org from elpa.

Debugger entered--Lisp error: (void-function org-link-types)
  org-link-types()
  org-element--set-regexps()
  require(org-element)
  eval-buffer(#<buffer  *load*-559097> nil "/home/userX/emacs.d-2/elpa/org-20170622/ox.el" nil t)  ; Reading at buffer position 2990
  load-with-code-conversion("/home/userX/emacs.d-2/elpa/org-20170622/ox.el" "/home/userX/emacs.d-2/elpa/org-20170622/ox.el" nil t)
  require(ox)
  eval-buffer(#<buffer  *load*-596536> nil "/home/userX/emacs.d-2/elpa/org-20170622/ox-org.el" nil t)  ; Reading at buffer position 924
  load-with-code-conversion("/home/userX/emacs.d-2/elpa/org-20170622/ox-org.el" "/home/userX/emacs.d-2/elpa/org-20170622/ox-org.el" nil t)
  require(ox-org)
  eval-buffer(#<buffer  *load*-88544> nil "/home/userX/emacs.d-2/elpa/ox-pandoc-20161125.35/ox-pandoc.el" nil t)  ; Reading at buffer position 789
  load-with-code-conversion("/home/userX/emacs.d-2/elpa/ox-pandoc-20161125.35/ox-pandoc.el" "/home/userX/emacs.d-2/elpa/ox-pandoc-20161125.35/ox-pandoc.el" t t)
  require(ox-pandoc nil t)
  (not (require (quote ox-pandoc) nil (quote t)))
  (if (not (require (quote ox-pandoc) nil (quote t))) (ignore (message (format "Cannot load %s" (quote ox-pandoc)))))
  (progn (use-package-ensure-elpa (quote ox-pandoc) (quote t) (quote nil) :ensure) (if (not (require (quote ox-pandoc) nil (quote t))) (ignore (message (format "Cannot load %s" (quote ox-pandoc))))))
  eval-buffer(#<buffer  *load*-511130> nil "/home/userX/emacs.d-2/myinit.el" nil t)  ; Reading at buffer position 81255
  load-with-code-conversion("/home/userX/emacs.d-2/myinit.el" "/home/userX/emacs.d-2/myinit.el" nil nil)
  load("/home/userX/emacs.d-2/myinit.el" nil nil t)
  load-file("/home/userX/emacs.d-2/myinit.el")
  org-babel-load-file("/home/userX/emacs.d-2/myinit.org")
  eval-buffer(#<buffer  *load*-448761> nil "/home/userX/emacs.d-2/init.el" nil t)  ; Reading at buffer position 86
  load-with-code-conversion("/home/userX/emacs.d-2/init.el" "/home/userX/emacs.d-2/init.el" nil nil)
  load("/home/userX/emacs.d-2/init.el")
  (let ((emacs-exec-path (expand-file-name invocation-name invocation-directory))) (cond ((string-match ".*old" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-old/") (setq package-user-dir "~/emacs.d-old/elpa"))) ((string-match ".*prelude" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-prelude/") (setq package-user-dir "~/emacs.d-prelude/elpa"))) ((string-match ".*new" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-new/") (setq package-user-dir "~/emacs.d-new/elpa"))) ((string-match ".*emacs-2" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-2/") (setq package-user-dir "~/emacs.d-2/elpa"))) ((string-match ".*emacs-3" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-3/") (setq package-user-dir "~/emacs.d-3/elpa"))) (t (progn (setq user-emacs-directory "~/.emacs.d/") (setq package-user-dir "~/.emacs.d/elpa") (message "We are using deault .emacs.d directory")))) (load (expand-file-name "init.el" user-emacs-directory)) (defvar dot-emacs-loaded nil))
  (if (boundp (quote dot-emacs-loaded)) nil (let ((emacs-exec-path (expand-file-name invocation-name invocation-directory))) (cond ((string-match ".*old" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-old/") (setq package-user-dir "~/emacs.d-old/elpa"))) ((string-match ".*prelude" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-prelude/") (setq package-user-dir "~/emacs.d-prelude/elpa"))) ((string-match ".*new" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-new/") (setq package-user-dir "~/emacs.d-new/elpa"))) ((string-match ".*emacs-2" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-2/") (setq package-user-dir "~/emacs.d-2/elpa"))) ((string-match ".*emacs-3" (downcase emacs-exec-path)) (progn (setq user-emacs-directory "~/emacs.d-3/") (setq package-user-dir "~/emacs.d-3/elpa"))) (t (progn (setq user-emacs-directory "~/.emacs.d/") (setq package-user-dir "~/.emacs.d/elpa") (message "We are using deault .emacs.d directory")))) (load (expand-file-name "init.el" user-emacs-directory)) (defvar dot-emacs-loaded nil)))
  eval-buffer(#<buffer  *load*> nil "/home/userX/.emacs" nil t)  ; Reading at buffer position 1820
  load-with-code-conversion("/home/userX/.emacs" "/home/userX/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "�\205\262

Support for Export Dispatcher

Do you plan to "integrate" ox-pandoc with Org's Export Dispatcher? It would be great if we can export through same interface as we are used to.

~ in lua-filter not being expanded to path to user directory

Hi there

I'm my .spacemacs, I have (excerpt):

(setq org-pandoc-options-for-latex-pdf '((template . "~/Dropbox/orgSupport/pdf/orgTufte.tex") (pdf-engine . "xelatex") (lua-filter . "~/Dropbox/orgSupport/filters/specialOrgBlocksToLatex.lua"))

ox-pandoc performs shell expansion for the template variable's value, which is expected given this in the ox-pandoc readme:

Values of options defined in org-pandoc-file-options will be expanded to full path if they begin with ~ (tilde) character.

However, the lua-filter options is not expanded, as suggested by this error thrown by Pandoc:

cannot open ~/Dropbox/orgSupport/filters/specialOrgBlocksToLatex.lua: No such file or directory

The error resolves only when I specify the full path.

Cheers

Ian

contrib?

ox-pandoc is so useful that it makes sense to include it in the contrib/ directory of the main org-mode distribution. Would you consider submitting it?

Images are not exported and displayed in resulting document when included with absolute path

  • pandoc.exe 2.2
  • Windows 10
  • Org mode version 9.1.6
  • GNU Emacs 26.0.90
  • First try: ox-pandoc Created: 2014-07-20 Version: 1.171202 (git 55861ad)
  • Then I updated to: ox-pandoc Created: 2014-07-20 Version: 1.171202 (git cd3c59f = latest)
    • Date is same, git hash has changed though. issue remains the same.

My input data is:

works only as link (not displayed "inline") with HTML4:

[[file:C:\Users\karl.voit\archive\file.png]]

does not result in a working link nor being displayed:

[[file:C:/Users/karl.voit/archive/file.png]]

works only as link (not displayed "inline") with HTML4:

[[C:\Users\karl.voit\archive\file.png]]

does not result in a working link nor being displayed:

[[file:C:/Users/karl.voit/archive/file.png]]

I did not find any possible way to convert to docx, html4/5, pdf that includes one of the image include methods I could imagine.

Can someone post an example that should work? My desired output format would be docx.

Internal link descriptions are incorrect for gfm

When exporting to gfm something like:

eqweqwewqqw <<reference>> ewqewqewqe

[[reference][this is a link]]

I get a link like [1](#reference) instead of [this is a link](#reference).

But when I run pandoc from the command line with -t gfm for the same file, the link description is correctly exported.

Referencing figures and tables

I'm opening a new issues based on the question/problem mentioned #8 (comment) and post it again:

Using the plain "pandoc" command I've found that

#+CAPTION: insert figure caption here
#+NAME: fig:1
#+LABEL: fig:1
[[img.png]]

does create

\begin{figure}[htbp]
\centering
\includegraphics{img.png}
\caption{insert figure caption here}
\end{figure}

and the reference [@fig:1] gets correctly translated to fig.~\ref{fig:1} (using pandoc-citeproc), but it doesn't work because \label{fig:1} is missing in the Latex output? Where is the problem org-mode or pandoc?

edit: exporting with standard org-mode export to latex gives:

\caption{\label{fig:orgparagraph1} insert figure caption here}

still not the right label, but at least it is in the latex code

Question: waiting for export process?

I'm using the ox-pandoc export backend in a custom function, like so:

(org-export-to-file 'pandoc (org-export-output-file-name
                                     (concat (make-temp-name ".tmp") ".org") t)
          nil t nil nil nil (lambda (f) (org-pandoc-run-to-buffer-or-file f 'markdown t nil)))

I'm then modifying the output file. However, I'd of course like to ensure the export process is done before beginning modifications. Do you know the easiest way to do this?

`filter` option cannot be repeated in ox-pandoc

Although pandoc allows the --filter option to be repeated, this does not work in ox-pandoc. If I customize org-pandoc-options to have multiple filter options, only the last one is used.

base64 encoding when producing html

Hello,

I'm wondering if it is possible to use ox-pandoc to base64 encode all images to an output html file. I want to do this so that I can share my html files without worrying if the images will load, and so my colleagues don't have to keep track of more than one file.

RStudio can do this when an html is produced from an Rmarkdown file with Knitr, so I have a feeling that ox-pandoc can do this same. I tried to use

PANDOC_VARIABLES: --self-contained

but this wasn't what I was looking for.

#+BEGIN_EXPORT HTML doesn't work

Summary

  • When I use org-pandoc-export-to-html5-and-open, it does not export #+BEGIN_EXPORT html
  • When I run the Pandoc manually pandoc -s -t html5 demo.org -o demo.html, it will export #+BEGIN_EXPORT html

Reproduce

  1. Create org file
    * HTML Export Test
    
    #+BEGIN_EXPORT html
    <h1>Hello World</h1>
    #+END_EXPORT
    
    Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.
    
  2. Run org-pandoc-export-to-html5-and-open
  3. Check the output
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
    <head>
      <meta charset="utf-8" />
      <meta name="generator" content="pandoc" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
      <meta name="author" content="Mo Kweon" />
      <title>demo.tmp21505REF</title>
      <style type="text/css">
          code{white-space: pre-wrap;}
          span.smallcaps{font-variant: small-caps;}
          span.underline{text-decoration: underline;}
          div.column{display: inline-block; vertical-align: top; width: 50%;}
      </style>
      <!--[if lt IE 9]>
        <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
      <![endif]-->
    </head>
    <body>
    <h1 id="html-export-test">HTML Export Test</h1>
    <p>Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.
    </body>
    </html>

Expected Behavior

  1. Generate the same output as pandoc command or export html correctly
  2. this is the HTML generated by the pandoc command
pandoc -s demo.org -o demo.html -t html5 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>demo</title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->
</head>
<body>
<h1 id="html-export-test">HTML Export Test</h1>
<h1>Hello World</h1>

<p>Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.</p>
</body>
</html>

Thank you

Use ox-pandoc as backend for org-publish

Is there any trick to getting ox-pandoc working with org-publish? I have the following as an alist:

(setq org-publish-project-alist 
  '(        ("test"
             :base-directory "~/test/source"
             :base-extension "org"
             :publishing-directory "~/test/output"
             :publishing-function (org-pandoc-export-to-html)
             )
))

With this setup I get the following error messages:

Publishing file /Users/Roambot/test/source/pubtest.org using `org-pandoc-export-to-html'
Initializing asynchronous export process
Publishing file /Users/Roambot/test/source/pubtest.org using `org-pandoc-export-to-html'
Process `org-export-process' exited abnormally

The Org Export Process buffer reads: Before first headline at position 1 in buffer *temp*. I'm not sure what this means.

If I attempt to define my own function, like so:

 (defun org-pandoc-publish-to-html (plist filename pub-dir)
 "Publish an org file to html using ox-pandoc."
 (org-publish-org-to 'org-pandoc-export-to-html filename ".html" plist pub-dir))

It doesn't work. Specifically, with :publishing-function (org-pandoc-publish-to-html) set I get the message: unknown "nil" back-end: Aborting export with no output.

I'm using up to date pandoc, GNU emacs 24.5.1, and ox-pandoc 1.151223.

Ox-pandoc exports normally when not used with org-publish and org-publish works normally when using other standard functions like org-html-publish-to-html.

Latex export fails for plain lists deeper than four, works for html

If a plain list has more than four levels, org-pandoc-export-to-latex-pdf-and-open will produce latex that crashes with the error:

Error occured.
! LaTeX Error: Too deeply nested.
...

Ideally, ox-pandoc latex export would not crash but would instead make a deep list similar to what you get with html export. There are ways:

http://tex.stackexchange.com/questions/41408/a-five-level-deep-list

Thanks,

Scott

-- example org mode file --------------------------------------

  1. level 1.1
    1. level 2.1
      1. level 3.1
        1. level 4.1
          1. level 5.1 (fails in latex unless this level is deleted)
          2. level 5.2 (fails in latex unless this level is deleted)
        2. level 4.2
      2. level 3.2
    2. level 2.2
  2. level 1.2

-- my setup ------------------------------------------------------

Emacs : GNU Emacs 25.1.1 (i686-w64-mingw32)
of 2016-09-17
Package: Org mode version 9.0.1 (9.0.1-elpaplus @ c:/Users/sotterson/home/.emacs.d/elpa/org-plus-contrib-20161118/)

TexLive Latex

Metadata set by org-pandoc-options-for-latex-pdf not being passed to Pandoc

Hi there

In my .spacemacs, I have the following:

(setq org-pandoc-options-for-latex-pdf '((template . "~/Dropbox/orgSupport/pdf/orgTufte.tex") (pdf-engine . "xelatex") (metadata . "headquoteauthor:Dana Perino") )

I've verified that the values for this variable are set in the document I'm exporting from.

However, while I see this in the final Pandoc command:

--template=/Users/.../Dropbox/orgSupport/pdf/orgTufte.tex

I'm not seeing the metadata set as above, like this:

--metadata=headquoteauthor:Dana Perino

Cheers

Ian

some options doesn't work when export to docx

I used the following as the first line in the org file

+OPTIONS: ^:nil

When export to html, it correctly export some word of some_key as literal some_key, instead of treat _ as specially meaning, but if export to docx, it export some_key as somekey, with key as subscript.

Org special blocks not rendering

Hi there

My Org file (snippet):

`
\begin{answer}
This is raw latex, and works
\end{answer}

#+BEGIN_answer
This is an example of an Org special block, which should work... but does not.
#+END_answer
`

The lower BEGIN block is a special block, and should be converted to a Latex environment (answer) when I export to Latex-PDF using Pandoc. I, should, therefore, see the text in two 'answer' environments. I do not, however. Only the first renders.

The intermediate Latex shows this:

`\begin{answer}
This is raw latex, and works
\end{answer}

This is an example of an Org special block, which should work\ldots{}
but does not.`

The second paragraph isn't getting the environment set.

If I use export to Latex outside of Pandoc, the second paragraph does get the correct environment. Any idea what I'm doing wrong?

Best wishes

Ian

PANDOC_VARIABLES aren't recognized

Hi,

I'd like to provide pandoc with the information, that I want A4 as my papersize. On commandline I use:
pandoc -V papersize:a4paper
This works without problems.

Now I want to export my og-files in emacs with ox-pandoc. In ox-pandoc's README I found that I should use
#+PANDOC_VARIABLES: papersize:a4paper
in my org-file. But that doesn't work (PDF is still lettersize). Any ideas? Did I spell something wrong?

Warning (ox-pandoc): Pandoc command is not installed.

I have pandoc installed via cabal.
~/.cabal/bin is in PATH.
My pandoc command from terminal is "pandoc", "$ pandoc -h" works.
But when I start emacs, I get the message "Warning (ox-pandoc): Pandoc command is not installed."

What is causing this?

--top-level-division not supported

--chapters is now deprecated and the preferred way of specifying this in Pandoc is --top-level-division. According to the pandoc docs for --chapter: Deprecated synonym for --top-level-division=chapter.

Multiple filters

Is it possible to define multiple filters e.g.

#+PANDOC_OPTIONS: filter:~/.cabal/bin/pandoc-crossref
#+PANDOC_OPTIONS: filter:~/.cabal/bin/pandoc-citeproc

in my case only the last one is considerd

let: Unknown keyword: :export-block

Hi,

I copied my Emacs setup to a Windows 10 host and have issues using ox-pandoc.

Contrary to my other hosts using the same setup, pandoc export options do not show up when I press C-c C-e. This is probably related (or not) to the real issue of this ticket: When I invoke M-x org-pandoc-export-as-html5 (or latex/PDF or anything other), I end up with: let: Unknown keyword: :export-block

ox-pandoc.el does have only one line where the keyword is mentioned: org-export-define-derived-backend() contains :export-block "PANDOC"

I don't have deeper Elisp knowledge to debug this any further. My (vague) gut feeling tells me that this might be some kind of dependency issue but I have no clue.

Maybe you can give me some advise. Thanks!

export-and-open isn't quite what I'd intended

I just installed ox-pandoc, and tried exporting to MS Word with "org-pandoc-export-to-docx-and-open". This opens the file ... in emacs. Which isn't exactly wrong, but is also not a very useful way to look at a word file. Is there any way to configure it to use the OS default program (e.g. Word) to open the generated file?

Thanks!

Document specific options for "org-pandoc-options-for-FORMAT"

It would be very nice if you can provide document specific option for specific format.

In one occasion, I wanted to include a script file before body. I can easily use include-before-body option of pandoc but I don't want it to be applied for all the format I export. Similar problem can arise in many such occasion, which would be solved with this update.

Properties drawer isn't recognized

In a recent update to the org-reader pandoc now recognizes UNNUMBERED in the PROPERTIES attribute for headers. Running the latest development version of pandoc I can confirm this works via running pandoc on the command line. But it doesn't seem to work via export from org. Is there an easy fix for this? The PROPERTIES drawer has been recognized by pandoc since pandoc 1.17.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.