Re: [O] problem with ox-pandoc export

2015-07-07 Thread Rasmus
Fabrice Popineau fabrice.popin...@supelec.fr writes:

 You are right. I'm curious to see which route is the easiest. I'll try very
 soon.

BTW you might also try tex4ebook, in which case you can go via
ox-latex.el.

Rasmus

-- 
If you can mix business and politics wonderful things can happen!




Re: [O] problem with ox-pandoc export

2015-07-03 Thread Nicolas Goaziou
Richard Lawrence richard.lawre...@berkeley.edu writes:

 Rasmus ras...@gmx.us writes:

 I don't see it as reinventing the wheel.  One example, does pandoc have
 something like the ox filters?

 It does; see e.g. http://pandoc.org/scripting.html

 Pandoc filters are actually more powerful than Org filters in most
 cases, because they are AST transformations.  Pattern matching makes it
 convenient and practical in Haskell to just transform the part of the
 tree you're interested in.  And because the Pandoc data structure has a
 JSON serialization format, filters can be written in just about any
 language, not just Haskell.

 This is an nice system, IMHO, which has one big advantage: it is
 possible to write complex filters (i.e., those that do more than just
 simple string manipulation) in an output-agnostic way.  Pandoc filters
 can do things which are generally only possible or convenient to do in
 Org by creating a derived backend, which isn't output-agnostic.

For the record, you can do the same in Org with a parse tree filter.
Other filters are meant to be less powerful but easier to write.

Regards,



Re: [O] problem with ox-pandoc export

2015-07-03 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 And it is high quality exporter(s)?

I don't know. However it doesn't matter much for formats we are not
going to provide an export back-end anyway.

 Are there any exporters in particular that we need?

rtf, rst, mediawiki might be useful. I think Bastien wanted to write
ox-mediawiki.el at some point.

 I fail to see the logic here.

There is none, but I needed one additional reason to convince myself
I was right.


Regards,



Re: [O] problem with ox-pandoc export

2015-07-02 Thread Nicolas Goaziou


Hello,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:

 Nicolas Goaziou mail-gpy5sjqteqhwkn9pgdnjrvaujnlxr...@public.gmane.org 
 writes:

 So this is not a Pandoc export back-end (i.e. a back-end that translates
 Org syntax into Pandoc's extended Markdown syntax).

 If the pandoc back-end is some flavor of Markdown, shouldn't it be
 better named `ox-md-pandoc'?

Which one are you talking about, the one from ELPA or the one I suggest
adding to core?

The former doesn't translate to Markdown at all. It simply calls pandoc
on an Org document to produce something else. It depends on how well
pandoc's Org importer behaves, i.e, how much Org syntax it does support.

Therefore, I suggest to write an Org to native pandoc's syntax. It would
be derived from ox-md but that doesn't mean its name must be prefixed
with ox-md, consider, for example ox-beamer and ox-latex.

 BTW, when looking at Markdown formats known by Pandoc, there are:

 - Pandoc markdown
 - Pandoc markdown_github
 - Pandoc markdown_mmd
 - Pandoc markdown_phpextra
 - Pandoc markdown_strict

 Is the Pandoc back-end exporting the flavor known as Pandoc
 markdown?

See above.


Regards,

-- 
Nicolas Goaziou




Re: [O] problem with ox-pandoc export

2015-07-02 Thread Sebastien Vauban
Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 Alan Schmitt alan.schm...@polytechnique.org writes:

 In short, it exports the org file to another temporary org file (using
 the pandoc exporter that inherits from the org exporter), then it calls
 the pandoc binary to convert from org to the target format. The first
 step (org to temporary org) is used to extract some information from the
 org file that is used in further steps (like creating a custom CSS or
 adding arguments to the call to the pandoc binary).

 So this is not a Pandoc export back-end (i.e. a back-end that translates
 Org syntax into Pandoc's extended Markdown syntax).

If the pandoc back-end is some flavor of Markdown, shouldn't it be
better named `ox-md-pandoc'?

BTW, when looking at Markdown formats known by Pandoc, there are:

- Pandoc markdown
- Pandoc markdown_github
- Pandoc markdown_mmd
- Pandoc markdown_phpextra
- Pandoc markdown_strict

Is the Pandoc back-end exporting the flavor known as Pandoc markdown?

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] problem with ox-pandoc export

2015-07-02 Thread Sebastien Vauban


Hello,

Nicolas Goaziou writes:
 Sebastien Vauban writes:
 Nicolas Goaziou writes:

 So this is not a Pandoc export back-end (i.e. a back-end that
 translates Org syntax into Pandoc's extended Markdown syntax).

 If the pandoc back-end is some flavor of Markdown, shouldn't it be
 better named `ox-md-pandoc'?

 Which one are you talking about, the one from ELPA or the one
 I suggest adding to core?

The latter.

 The former doesn't translate to Markdown at all. It simply calls
 pandoc on an Org document to produce something else. It depends on how
 well pandoc's Org importer behaves, i.e, how much Org syntax it does
 support.

 Therefore, I suggest to write an Org to native pandoc's syntax. It
 would be derived from ox-md but that doesn't mean its name must be
 prefixed with ox-md,

I'd think it'd make more sense, yes.

 consider, for example ox-beamer and ox-latex.

Even if it's not necessarily like that for all cases.

_My_ point of view is simply to make `ox-pandoc' more visible as an
alternative option when one wants to export to Markdown: simply by
looking at file names, by Googling or by looking at require calls used
in other's configs, one would expect that `ox-md' and `ox-md-pandoc'
would both generate markdown.

For Beamer, it could be similar, except that people don't necessarily
search for latex when trying to export to beamer.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] problem with ox-pandoc export

2015-07-02 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Which one are you talking about, the one from ELPA or the one I suggest
 adding to core?

 The former doesn't translate to Markdown at all. It simply calls pandoc
 on an Org document to produce something else. It depends on how well
 pandoc's Org importer behaves, i.e, how much Org syntax it does support.

Why do we need a pandoc exporter?  And why do we need it in core?

There's already quite a few backends to work on when we want to improve
the general exporter framework.  By all means, I'm not against a pandoc
exporter, I'm just trying to understand the reasoning.

Note: my distro doesn't have a binary pandoc package so I have never tried
it.

Rasmus

-- 
Evidence suggests Snowden used a powerful tool called monospaced fonts




Re: [O] problem with ox-pandoc export

2015-07-02 Thread Rasmus
Fabrice Popineau fabrice.popin...@supelec.fr writes:

 To export documents to the epub format and produce ebooks ?
 (I certainly would be interested in it).

Isn't an EPUB more or less a zipped XHTML project?  Wouldn't ox-html +
magic be a shorter and potentially less error prone route to get an epub?

AFAICT, we support everything for EPUB3: XHTML, SVG, CSS and MathML.
ox-odt has magic to zip projects which can be factored out or replicated.

Rasmus

-- 
I feel emotional landscapes they puzzle me



Re: [O] problem with ox-pandoc export

2015-07-02 Thread Fabrice Popineau
You are right. I'm curious to see which route is the easiest. I'll try very
soon.

Fabrice
Le 2 juil. 2015 16:35, Rasmus ras...@gmx.us a écrit :

 Fabrice Popineau fabrice.popin...@supelec.fr writes:

  To export documents to the epub format and produce ebooks ?
  (I certainly would be interested in it).

 Isn't an EPUB more or less a zipped XHTML project?  Wouldn't ox-html +
 magic be a shorter and potentially less error prone route to get an epub?

 AFAICT, we support everything for EPUB3: XHTML, SVG, CSS and MathML.
 ox-odt has magic to zip projects which can be factored out or replicated.

 Rasmus

 --
 I feel emotional landscapes they puzzle me



Re: [O] problem with ox-pandoc export

2015-07-02 Thread Fabrice Popineau
2015-07-02 14:02 GMT+02:00 Rasmus ras...@gmx.us:


 Why do we need a pandoc exporter?  And why do we need it in core?


To export documents to the epub format and produce ebooks ?
(I certainly would be interested in it).

Emacs could certainly do the job too, but if it is already done ... why
bother ?

Fabrice


Re: [O] problem with ox-pandoc export

2015-07-02 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Why do we need a pandoc exporter?  And why do we need it in core?

Note that I said would be nice, not need.

Pandoc has quite a few export formats that we will probably never have
an export back-end for. It avoids re-inventing the wheel.

Also Pandoc can export to Org syntax. It seems fair to allow the
reciprocal.


Regards,



Re: [O] problem with ox-pandoc export

2015-07-02 Thread Rasmus
Hi,

Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Note that I said would be nice, not need.

OK.

 Pandoc has quite a few export formats that we will probably never have
 an export back-end for. It avoids re-inventing the wheel.

And it is high quality exporter(s)?  Are there any exporters in particular
that we need?

I don't see it as reinventing the wheel.  One example, does pandoc have
something like the ox filters?

 Also Pandoc can export to Org syntax. It seems fair to allow the
 reciprocal.

I fail to see the logic here.

Anyway, great if somebody wants to work on it.

Thanks,
Rasmus

-- 
Governments should be afraid of their people




Re: [O] problem with ox-pandoc export

2015-07-01 Thread Nicolas Goaziou
Alan Schmitt alan.schm...@polytechnique.org writes:

 In short, it exports the org file to another temporary org file (using
 the pandoc exporter that inherits from the org exporter), then it calls
 the pandoc binary to convert from org to the target format. The first
 step (org to temporary org) is used to extract some information from the
 org file that is used in further steps (like creating a custom CSS or
 adding arguments to the call to the pandoc binary).

So this is not a Pandoc export back-end (i.e. a back-end that translates
Org syntax into Pandoc's extended Markdown syntax).

I think it would be nice to have the latter in core, even more so when
we finally introduce citation syntax in Org.

 The problem seems to be that the org to org export part is not the
 identity. Calling `org-org-template' in `org-pandoc-template' solves the
 issue.

Then mimic `org-org-template' in `org-pandoc-template', as it is really
basic.


Regards,



Re: [O] problem with ox-pandoc export

2015-06-30 Thread Alan Schmitt
On 2015-06-29 20:54, Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Alan Schmitt alan.schm...@polytechnique.org writes:

 There is an `org-pandoc-template' already, it just does not deal with
 the metadata used in `org-org-template'. I was thinking of reusing
 `org-org-template' directly, but if I understand your suggestion, we
 should just copy that code in `org-pandoc-template'. Is this correct?

 Correct.

 Also, I don't think you need /exactly/ `org-org-template', since pandoc
 probably uses another syntax for meta-data, doesn't it?

I don't think so. This is the way ox-pandoc works (format is the target
format):

#+begin_src emacs-lisp
  (org-export-to-file 'pandoc (org-export-output-file-name
   (concat (make-temp-name .tmp) .org) s)
a s v b e (lambda (f) (org-pandoc-run-to-buffer-or-file f format s 
buf-or-open)))
#+end_src

In short, it exports the org file to another temporary org file (using
the pandoc exporter that inherits from the org exporter), then it calls
the pandoc binary to convert from org to the target format. The first
step (org to temporary org) is used to extract some information from the
org file that is used in further steps (like creating a custom CSS or
adding arguments to the call to the pandoc binary).

The problem seems to be that the org to org export part is not the
identity. Calling `org-org-template' in `org-pandoc-template' solves the
issue.

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-29 Thread Nicolas Goaziou
Alan Schmitt alan.schm...@polytechnique.org writes:

 It seems that (org-org-template) is not available in the currently
 released version (I looked into the maint branch and could not see
 it).

Correct.

 Is there a way to support both the master and the maint branch for
 ox-pandoc?

Since you are going to override it anyway, how does it matter? Just
define `org-pandoc-template' and associate it to `template' context in
ox-pandoc.el. Am I mistaken?

Regards,



Re: [O] problem with ox-pandoc export

2015-06-29 Thread Alan Schmitt
Hello Nicolas,

On 2015-06-27 12:26, Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 ox-org inserts meta-data in its template function (org-org-template).
 Since you're overriding it in the `mytest' back-end, you need to take
 care of that.

It seems that (org-org-template) is not available in the currently
released version (I looked into the maint branch and could not see it).
Is there a way to support both the master and the maint branch for
ox-pandoc?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-29 Thread Alan Schmitt
On 2015-06-29 14:19, Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Alan Schmitt alan.schm...@polytechnique.org writes:

 Is there a way to support both the master and the maint branch for
 ox-pandoc?

 Since you are going to override it anyway, how does it matter? Just
 define `org-pandoc-template' and associate it to `template' context in
 ox-pandoc.el. Am I mistaken?

There is an `org-pandoc-template' already, it just does not deal with
the metadata used in `org-org-template'. I was thinking of reusing
`org-org-template' directly, but if I understand your suggestion, we
should just copy that code in `org-pandoc-template'. Is this correct?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-29 Thread Nicolas Goaziou
Alan Schmitt alan.schm...@polytechnique.org writes:

 There is an `org-pandoc-template' already, it just does not deal with
 the metadata used in `org-org-template'. I was thinking of reusing
 `org-org-template' directly, but if I understand your suggestion, we
 should just copy that code in `org-pandoc-template'. Is this correct?

Correct.

Also, I don't think you need /exactly/ `org-org-template', since pandoc
probably uses another syntax for meta-data, doesn't it?


Regards,



Re: [O] problem with ox-pandoc export

2015-06-28 Thread Alan Schmitt
On 2015-06-27 12:26, Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 ox-org inserts meta-data in its template function (org-org-template).
 Since you're overriding it in the `mytest' back-end, you need to take
 care of that.

Ah, I was not aware of this. Thanks!

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-27 Thread Alan Schmitt
On 2015-06-26 17:36, Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Alan Schmitt alan.schm...@polytechnique.org writes:

 Is there any reason why the options would disappear during export?

 Maybe ox-pandoc doesn't handle this meta-data.

ox-pandoc does not do anything with that meta-data when generating the
temporary org file. Shouldn't it inherited from the org exporter?

 Perhaps you're doing a body-only export.

No, I just checked.

 Or you have `org-export-with-title' and al. set to nil...

No, and I can reproduce this with an empty configuration. So I guess
there is something fishy going on in the generation of the temporary org
file.

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-27 Thread Alan Schmitt
On 2015-06-27 12:07, Alan Schmitt alan.schm...@polytechnique.org writes:

 No, and I can reproduce this with an empty configuration. So I guess
 there is something fishy going on in the generation of the temporary org
 file.

Here is an ECM to show the issue. Evaluate this code:

#+begin_src emacs-lisp
(org-export-define-derived-backend 'mytest 'org
  :translate-alist '((template . org-pandoc-template))
  :export-block MYTEST
  :menu-entry '(?t test as/org-export-test))

(defun as/org-export-test (optional a s v b e)
  (org-export-to-file 'mytest
  (org-export-output-file-name
   (concat (make-temp-name .tmp) .org) s)))
#+end_src

Then try it with this file

--8---cut here---start-8---
#+title: This is a title
#+date: 1/2/3

* First section
foo

* Second section
bar
--8---cut here---end---8---

The resulting exported file is missing the title and date.

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] problem with ox-pandoc export

2015-06-27 Thread Nicolas Goaziou
Alan Schmitt alan.schm...@polytechnique.org writes:

 On 2015-06-27 12:07, Alan Schmitt alan.schm...@polytechnique.org writes:

 No, and I can reproduce this with an empty configuration. So I guess
 there is something fishy going on in the generation of the temporary org
 file.

 Here is an ECM to show the issue. Evaluate this code:

 #+begin_src emacs-lisp
 (org-export-define-derived-backend 'mytest 'org
   :translate-alist '((template . org-pandoc-template))
   :export-block MYTEST
   :menu-entry '(?t test as/org-export-test))

 (defun as/org-export-test (optional a s v b e)
   (org-export-to-file 'mytest
   (org-export-output-file-name
(concat (make-temp-name .tmp) .org) s)))
 #+end_src

ox-org inserts meta-data in its template function (org-org-template).
Since you're overriding it in the `mytest' back-end, you need to take
care of that.

Regards,



Re: [O] problem with ox-pandoc export

2015-06-26 Thread Nicolas Goaziou
Hello,

Alan Schmitt alan.schm...@polytechnique.org writes:

 Is there any reason why the options would disappear during export?

Maybe ox-pandoc doesn't handle this meta-data. Perhaps you're doing
a body-only export. Or you have `org-export-with-title' and al. set to
nil...


Regards,

-- 
Nicolas Goaziou