diagrams / diagrams-contrib

User-contributed extensions to diagrams
BSD 3-Clause "New" or "Revised" License
27 stars 30 forks source link

org-mode babel support #12

Closed michelk closed 11 years ago

michelk commented 11 years ago

I'm wondering, if someone has thought about creating an org-mode babel plugin; which could let you specify drawings inline org-documents.

In reports, I use org-mode and R a lot to plot stuff.

byorgey commented 11 years ago

That would be extremely cool! I haven't heard anyone talk about doing this before. Do you know what is required to create a babel plugin? The diagrams-builder package (http://github.com/diagrams/diagrams-builder) is intended to make it easy to create this sort of thing.

michelk commented 11 years ago

I'm sorry, I don't have any experience in babal-plugin development; so far, I'm just a heavy user, and wanted to suggest support for diagrams.

Starting-points could be:

In ob-julia.el Gadfly (and hence Compose -- which is actually inspired by your diagrams-package) - plotting is not supported.

Maybe we can workout a solution for graphics - engines.

bergey commented 11 years ago

I took a look at the Babel framework, and I think diagrams-builder-cairo already does everything necessary. Babel takes the .org file, extracts the text of the source block, runs a function named like "org-babel-execute:diagrams" (yes, that's dynamically assembled by string concatenation) and inserts the result back into the file. So what's needed is a definition of org-babel-execute:diagrams, in lisp, that calls diagrams-builder-cairo, and returns the filepath with the image.

There should also be several related functions for handling HTML export, LaTeX export, etc, by picking the right image format.

bergey commented 11 years ago

Initial code: https://github.com/bergey/org-babel-diagrams

byorgey commented 11 years ago

Cool!

Re: the instructions in the README, note that cabal install diagrams-builder doesn't actually get you any of the executables such as diagrams-builder-cairo; you have to cabal install -fcairo diagrams-builder (and/or -fsvg, -fps).

On Wed, Mar 27, 2013 at 7:19 PM, Daniel Bergey notifications@github.comwrote:

Initial code: https://github.com/bergey/org-babel-diagrams

— Reply to this email directly or view it on GitHubhttps://github.com/diagrams/diagrams-contrib/issues/12#issuecomment-15559296 .

michelk commented 11 years ago

Fantastic, works like a charm.

Maybe the README needs a hint how to export the whole document to pdf. I guess you have to specify :file circle.eps, then the executable shoud be dispatched to diagrams-builder-ps.

Thanks a lot